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

Unified Diff: src/counters.h

Issue 2457523002: [Tracing] Fix inaccurate timer calculation in runtime statistics. (Closed)
Patch Set: 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') | src/counters.cc » ('J')
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();
+ }
Camillo Bruni 2016/10/27 09:00:58 Maybe let's write this in a loop instead of recurs
lpy 2016/10/27 16:59:21 We need to maintain the order of timer restart fro
+
RuntimeCallCounter* counter_ = nullptr;
RuntimeCallTimer* parent_ = nullptr;
base::ElapsedTimer timer_;
« no previous file with comments | « no previous file | src/counters.cc » ('j') | src/counters.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698