Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: src/counters.h

Issue 2457523002: [Tracing] Fix inaccurate timer calculation in runtime statistics. (Closed)
Patch Set: Address cbruni's comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/counters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.h
diff --git a/src/counters.h b/src/counters.h
index beb44ad153d67212827e028cd723aa038ef047bd..bc430d71478dbead2f34650f725a47126d845c10 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -521,6 +521,16 @@ class RuntimeCallTimer {
return parent_;
}
+ inline void Elapsed() {
+ base::TimeDelta delta = timer_.Elapsed();
+ counter_->time += delta;
+ if (parent_ != nullptr) {
+ parent_->counter_->time -= delta;
+ parent_->Elapsed();
+ }
+ timer_.Restart();
+ }
+
RuntimeCallCounter* counter_ = nullptr;
RuntimeCallTimer* parent_ = nullptr;
base::ElapsedTimer timer_;
« no previous file with comments | « no previous file | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698