Index: src/counters-inl.h |
diff --git a/src/counters-inl.h b/src/counters-inl.h |
index 7219ef778a6ea6a06ce25ad457b7a1299c5d7194..066a827a853f9620720089ec8c691067d504348a 100644 |
--- a/src/counters-inl.h |
+++ b/src/counters-inl.h |
@@ -10,6 +10,33 @@ |
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_->Increment(); |
+ AddAndSubmitResults(delta); |
+ |
+ RuntimeCallTimer* parent_timer = parent(); |
+ if (parent_timer) { |
+ // Subtract the elapsed time from the parent to correctly calculate its own |
+ // time. |
+ parent_timer->SubtractSubtime(delta); |
+ } |
+ return parent_timer; |
+} |
+ |
RuntimeCallTimerScope::RuntimeCallTimerScope( |
Isolate* isolate, RuntimeCallStats::CounterId counter_id) { |
if (V8_UNLIKELY(FLAG_runtime_stats)) { |