Index: src/counters.h |
diff --git a/src/counters.h b/src/counters.h |
index 67c0be215d5b3d1a7b19440ae72afc31d3b21191..e6df874eb6a82bff6f03f99abb5f7fc65c22fbf8 100644 |
--- a/src/counters.h |
+++ b/src/counters.h |
@@ -506,37 +506,10 @@ class RuntimeCallTimer { |
private: |
friend class RuntimeCallStats; |
- inline void Start(RuntimeCallCounter* counter, RuntimeCallTimer* parent) { |
- counter_ = counter; |
- parent_.SetValue(parent); |
- if (FLAG_runtime_stats != |
- v8::tracing::TracingCategoryObserver::ENABLED_BY_SAMPLING) { |
- timer_.Start(); |
- } |
- } |
- |
- inline 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()->counter_->time -= delta; |
- } |
- return parent(); |
- } |
- |
- inline void Elapsed() { |
- base::TimeDelta delta = timer_.Elapsed(); |
- counter_->time += delta; |
- if (parent()) { |
- parent()->counter_->time -= delta; |
- parent()->Elapsed(); |
- } |
- timer_.Restart(); |
- } |
Camillo Bruni
2016/11/17 14:02:00
moved all functions to counters-inl.h
|
+ inline void Start(RuntimeCallCounter* counter, RuntimeCallTimer* parent); |
+ inline RuntimeCallTimer* Stop(); |
+ inline void Elapsed(); |
+ inline void Subtract(base::TimeDelta delta); |
const char* name() { return counter_->name; } |
@@ -892,6 +865,36 @@ class RuntimeCallStats : public ZoneObject { |
CHANGE_CURRENT_RUNTIME_COUNTER(isolate->counters()->runtime_call_stats(), \ |
Handler_##counter_name) |
+// A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the |
+// the time of C++ scope. |
+class RuntimeCallTimerScope { |
+ public: |
+ inline RuntimeCallTimerScope(Isolate* isolate, |
+ RuntimeCallStats::CounterId counter_id); |
+ // This constructor is here just to avoid calling GetIsolate() when the |
+ // stats are disabled and the isolate is not directly available. |
+ inline RuntimeCallTimerScope(HeapObject* heap_object, |
+ RuntimeCallStats::CounterId counter_id); |
+ inline RuntimeCallTimerScope(RuntimeCallStats* stats, |
+ RuntimeCallStats::CounterId counter_id); |
+ |
+ inline ~RuntimeCallTimerScope() { |
+ if (V8_UNLIKELY(stats_ != nullptr)) { |
+ RuntimeCallStats::Leave(stats_, &timer_); |
+ } |
+ } |
+ |
+ private: |
+ V8_INLINE void Initialize(RuntimeCallStats* stats, |
+ RuntimeCallStats::CounterId counter_id) { |
+ stats_ = stats; |
+ RuntimeCallStats::Enter(stats_, &timer_, counter_id); |
+ } |
+ |
+ RuntimeCallStats* stats_ = nullptr; |
+ RuntimeCallTimer timer_; |
+}; |
+ |
#define HISTOGRAM_RANGE_LIST(HR) \ |
/* Generic range histograms */ \ |
HR(detached_context_age_in_gc, V8.DetachedContextAgeInGC, 0, 20, 21) \ |
@@ -1303,36 +1306,6 @@ class Counters { |
DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
}; |
-// A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the |
-// the time of C++ scope. |
-class RuntimeCallTimerScope { |
- public: |
- inline RuntimeCallTimerScope(Isolate* isolate, |
- RuntimeCallStats::CounterId counter_id); |
- // This constructor is here just to avoid calling GetIsolate() when the |
- // stats are disabled and the isolate is not directly available. |
- inline RuntimeCallTimerScope(HeapObject* heap_object, |
- RuntimeCallStats::CounterId counter_id); |
- inline RuntimeCallTimerScope(RuntimeCallStats* stats, |
- RuntimeCallStats::CounterId counter_id); |
- |
- inline ~RuntimeCallTimerScope() { |
- if (V8_UNLIKELY(stats_ != nullptr)) { |
- RuntimeCallStats::Leave(stats_, &timer_); |
- } |
- } |
- |
- private: |
- V8_INLINE void Initialize(RuntimeCallStats* stats, |
- RuntimeCallStats::CounterId counter_id) { |
- stats_ = stats; |
- RuntimeCallStats::Enter(stats_, &timer_, counter_id); |
- } |
- |
- RuntimeCallStats* stats_ = nullptr; |
- RuntimeCallTimer timer_; |
-}; |
Camillo Bruni
2016/11/17 14:02:00
Just moved this whole block to put all runtime stu
|
- |
} // namespace internal |
} // namespace v8 |