mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-03 13:07:58 +00:00
Add timing stats for IdString garbage collection
This commit is contained in:
parent
cd47727c8b
commit
7371388e1d
5 changed files with 22 additions and 0 deletions
|
|
@ -709,6 +709,8 @@ int main(int argc, char **argv)
|
|||
total_ns += it.second->runtime_ns + 1;
|
||||
timedat.insert(make_tuple(it.second->runtime_ns + 1, it.second->call_counter, it.first));
|
||||
}
|
||||
timedat.insert(make_tuple(RTLIL::OwningIdString::garbage_collection_ns() + 1,
|
||||
RTLIL::OwningIdString::garbage_collection_count(), "id_gc"));
|
||||
|
||||
if (timing_details)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -129,6 +129,11 @@ void Pass::post_execute(Pass::pre_post_exec_state_t state)
|
|||
int64_t time_ns = PerformanceTimer::query() - state.begin_ns;
|
||||
runtime_ns += time_ns;
|
||||
current_pass = state.parent_pass;
|
||||
subtract_from_current_runtime_ns(time_ns);
|
||||
}
|
||||
|
||||
void Pass::subtract_from_current_runtime_ns(int64_t time_ns)
|
||||
{
|
||||
if (current_pass)
|
||||
current_pass->runtime_ns -= time_ns;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ struct Pass
|
|||
bool experimental_flag = false;
|
||||
bool internal_flag = false;
|
||||
|
||||
static void subtract_from_current_runtime_ns(int64_t time_ns);
|
||||
|
||||
void experimental() {
|
||||
experimental_flag = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,8 +243,12 @@ struct IdStringCollector {
|
|||
std::unordered_set<int> live;
|
||||
};
|
||||
|
||||
int64_t RTLIL::OwningIdString::gc_ns;
|
||||
int RTLIL::OwningIdString::gc_count;
|
||||
|
||||
void RTLIL::OwningIdString::collect_garbage()
|
||||
{
|
||||
int64_t start = PerformanceTimer::query();
|
||||
#ifndef YOSYS_NO_IDS_REFCNT
|
||||
IdStringCollector collector;
|
||||
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
|
||||
|
|
@ -288,6 +292,10 @@ void RTLIL::OwningIdString::collect_garbage()
|
|||
it = global_autoidx_id_prefix_storage_.erase(it);
|
||||
}
|
||||
#endif
|
||||
int64_t time_ns = PerformanceTimer::query() - start;
|
||||
Pass::subtract_from_current_runtime_ns(time_ns);
|
||||
gc_ns += time_ns;
|
||||
++gc_count;
|
||||
}
|
||||
|
||||
dict<std::string, std::string> RTLIL::constpad;
|
||||
|
|
|
|||
|
|
@ -578,6 +578,8 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
|
|||
|
||||
// Collect all non-owning references.
|
||||
static void collect_garbage();
|
||||
static int64_t garbage_collection_ns() { return gc_ns; }
|
||||
static int garbage_collection_count() { return gc_count; }
|
||||
|
||||
// Used by the ID() macro to create an IdString with no destructor whose string will
|
||||
// never be released. If ID() creates a closure-static `OwningIdString` then
|
||||
|
|
@ -589,6 +591,9 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
|
|||
return result;
|
||||
}
|
||||
private:
|
||||
static int64_t gc_ns;
|
||||
static int gc_count;
|
||||
|
||||
void get_reference()
|
||||
{
|
||||
get_reference(index_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue