4040#include " sta/TimingArc.hh"
4141#include " sta/Units.hh"
4242#include " utl/Logger.h"
43+ #include " utl/timer.h"
4344
4445namespace rsz {
4546
@@ -64,33 +65,6 @@ using BnetSeq = BufferedNetSeq;
6465using BnetPtr = BufferedNetPtr;
6566using BnetMetrics = BufferedNet::Metrics;
6667
67- class ScopedTimer
68- {
69- public:
70- using Clock = std::chrono::steady_clock;
71-
72- ScopedTimer (Logger* logger, double & accumulator)
73- : logger_(logger), accumulator_(accumulator)
74- {
75- if (logger_->debugCheck (RSZ, " rebuffer" , 1 )) {
76- start_ = Clock::now ();
77- }
78- }
79-
80- ~ScopedTimer ()
81- {
82- if (logger_->debugCheck (RSZ, " rebuffer" , 1 )) {
83- accumulator_
84- += std::chrono::duration<double >{Clock::now () - start_}.count ();
85- }
86- }
87-
88- private:
89- Logger* logger_;
90- double & accumulator_;
91- std::chrono::time_point<Clock> start_;
92- };
93-
9468// Template magic to make it easier to write algorithms descending
9569// over the buffer tree in the form of lambdas; it allows recursive
9670// lambda calling and it keeps track of the level number which is important
@@ -679,7 +653,7 @@ BnetPtr Rebuffer::bufferForTiming(const BnetPtr& tree,
679653 return opts1;
680654 }
681655
682- ScopedTimer timer (logger_, long_wire_stepping_runtime_);
656+ utl::DebugScopedTimer timer (long_wire_stepping_runtime_);
683657 int round = 0 ;
684658 while (location != node->location ()) {
685659 debugPrint (logger_,
@@ -2112,7 +2086,7 @@ void Rebuffer::fullyRebuffer(Pin* user_pin)
21122086 Vertex* drvr = graph_->pinDrvrVertex (drvr_pin);
21132087
21142088 {
2115- ScopedTimer timer (logger_, sta_runtime);
2089+ utl::DebugScopedTimer timer (sta_runtime);
21162090 search_->findRequireds (drvr->level ());
21172091 }
21182092
@@ -2160,7 +2134,7 @@ void Rebuffer::fullyRebuffer(Pin* user_pin)
21602134 BnetPtr timing_tree = unbuffered_tree;
21612135
21622136 {
2163- ScopedTimer timer (logger_, bft_runtime);
2137+ utl::DebugScopedTimer timer (bft_runtime);
21642138 for (int i = 0 ; i < 3 ; i++) {
21652139 timing_tree = bufferForTiming (timing_tree);
21662140 if (!timing_tree) {
@@ -2227,7 +2201,7 @@ void Rebuffer::fullyRebuffer(Pin* user_pin)
22272201
22282202 BnetPtr area_opt_tree = timing_tree;
22292203 {
2230- ScopedTimer timer (logger_, ra_runtime);
2204+ utl::DebugScopedTimer timer (ra_runtime);
22312205 for (int i = 0 ; i < 5 && area_opt_tree; i++) {
22322206 area_opt_tree
22332207 = recoverArea (area_opt_tree, target_slack, ((float ) (1 + i)) / 5 );
@@ -2317,7 +2291,7 @@ void Rebuffer::fullyRebuffer(Pin* user_pin)
23172291 estimate_parasitics_->updateParasitics ();
23182292
23192293 {
2320- ScopedTimer timer (logger_, sta_runtime);
2294+ utl::DebugScopedTimer timer (sta_runtime);
23212295 sta_->findDelays (max_level);
23222296 search_->findArrivals (max_level);
23232297 }
0 commit comments