File tree Expand file tree Collapse file tree 5 files changed +22
-0
lines changed Expand file tree Collapse file tree 5 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -709,6 +709,8 @@ int main(int argc, char **argv)
709709 total_ns += it.second ->runtime_ns + 1 ;
710710 timedat.insert (make_tuple (it.second ->runtime_ns + 1 , it.second ->call_counter , it.first ));
711711 }
712+ timedat.insert (make_tuple (RTLIL::OwningIdString::garbage_collection_ns () + 1 ,
713+ RTLIL::OwningIdString::garbage_collection_count (), " id_gc" ));
712714
713715 if (timing_details)
714716 {
Original file line number Diff line number Diff line change @@ -129,6 +129,11 @@ void Pass::post_execute(Pass::pre_post_exec_state_t state)
129129 int64_t time_ns = PerformanceTimer::query () - state.begin_ns ;
130130 runtime_ns += time_ns;
131131 current_pass = state.parent_pass ;
132+ subtract_from_current_runtime_ns (time_ns);
133+ }
134+
135+ void Pass::subtract_from_current_runtime_ns (int64_t time_ns)
136+ {
132137 if (current_pass)
133138 current_pass->runtime_ns -= time_ns;
134139}
Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ struct Pass
9595 bool experimental_flag = false ;
9696 bool internal_flag = false ;
9797
98+ static void subtract_from_current_runtime_ns (int64_t time_ns);
99+
98100 void experimental () {
99101 experimental_flag = true ;
100102 }
Original file line number Diff line number Diff line change @@ -243,8 +243,12 @@ struct IdStringCollector {
243243 std::unordered_set<int > live;
244244};
245245
246+ int64_t RTLIL::OwningIdString::gc_ns;
247+ int RTLIL::OwningIdString::gc_count;
248+
246249void RTLIL::OwningIdString::collect_garbage ()
247250{
251+ int64_t start = PerformanceTimer::query ();
248252#ifndef YOSYS_NO_IDS_REFCNT
249253 IdStringCollector collector;
250254 for (auto &[idx, design] : *RTLIL::Design::get_all_designs ()) {
@@ -288,6 +292,10 @@ void RTLIL::OwningIdString::collect_garbage()
288292 it = global_negative_id_prefix_storage_.erase (it);
289293 }
290294#endif
295+ int64_t time_ns = PerformanceTimer::query () - start;
296+ Pass::subtract_from_current_runtime_ns (time_ns);
297+ gc_ns += time_ns;
298+ ++gc_count;
291299}
292300
293301dict<std::string, std::string> RTLIL::constpad;
Original file line number Diff line number Diff line change @@ -576,6 +576,8 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
576576
577577 // Collect all non-owning references.
578578 static void collect_garbage ();
579+ static int64_t garbage_collection_ns () { return gc_ns; }
580+ static int garbage_collection_count () { return gc_count; }
579581
580582 // Used by the ID() macro to create an IdString with no destructor whose string will
581583 // never be released. If ID() creates a closure-static `OwningIdString` then
@@ -587,6 +589,9 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
587589 return result;
588590 }
589591private:
592+ static int64_t gc_ns;
593+ static int gc_count;
594+
590595 void get_reference ()
591596 {
592597 get_reference (index_);
You can’t perform that action at this time.
0 commit comments