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

Unified Diff: src/counters-inl.h

Issue 2519073002: Revert of [counters] RuntimeStats: fix wrong bookkeeping when dynamically changing counters. (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/counters.cc ('k') | test/unittests/counters-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters-inl.h
diff --git a/src/counters-inl.h b/src/counters-inl.h
index c71a7592cc3190955f783f9fa7be33eda7fa1dc3..7219ef778a6ea6a06ce25ad457b7a1299c5d7194 100644
--- a/src/counters-inl.h
+++ b/src/counters-inl.h
@@ -9,53 +9,6 @@
namespace v8 {
namespace internal {
-
-void RuntimeCallTimer::Start(RuntimeCallCounter* counter,
- RuntimeCallTimer* parent) {
- counter_ = counter;
- parent_.SetValue(parent);
- if (FLAG_runtime_stats !=
- v8::tracing::TracingCategoryObserver::ENABLED_BY_SAMPLING) {
- timer_.Start();
- }
-}
-
-RuntimeCallTimer* RuntimeCallTimer::Stop() {
- if (!timer_.IsStarted()) return parent();
- base::TimeDelta delta = timer_.Elapsed();
- timer_.Stop();
- counter_->count++;
- counter_->time += delta;
- if (parent()) {
- // Adjust parent timer so that it does not include sub timer's time.
- parent()->Subtract(delta);
- }
- return parent();
-}
-
-void RuntimeCallTimer::Subtract(base::TimeDelta delta) {
- // Adjust the current timer instead of directly subtracting the sub-timers
- // from the current counter. This way we can easily change the counter of an
- // active timer scope. Otherwise we would end up subtracting the time from the
- // previous counter and add the own time to the newly changed counter.
- timer_.Subtract(delta);
-}
-
-void RuntimeCallTimer::Snapshot() {
- base::TimeTicks now = base::TimeTicks::HighResolutionNow();
- RuntimeCallTimer* timer = this;
- base::TimeDelta delta = base::TimeDelta::FromMicroseconds(0);
- // Walk up the timer chain until the the timer doesn't have a parent.
- while (timer != nullptr) {
- // Iteration 1: subtract 0 from the current timer (this).
- // Iteration n+1: subtract subtimer's time (delta) from the the current
- // timer.
- timer->Subtract(delta);
- delta = timer->timer_.Restart(now);
- timer->counter_->time += delta;
- timer = timer->parent();
- }
-}
RuntimeCallTimerScope::RuntimeCallTimerScope(
Isolate* isolate, RuntimeCallStats::CounterId counter_id) {
« no previous file with comments | « src/counters.cc ('k') | test/unittests/counters-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698