OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COUNTERS_H_ | 5 #ifndef V8_COUNTERS_H_ |
6 #define V8_COUNTERS_H_ | 6 #define V8_COUNTERS_H_ |
7 | 7 |
8 #include "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 RuntimeCallStats::CounterId counter_id); | 1250 RuntimeCallStats::CounterId counter_id); |
1251 | 1251 |
1252 inline ~RuntimeCallTimerScope() { | 1252 inline ~RuntimeCallTimerScope() { |
1253 if (V8_UNLIKELY(isolate_ != nullptr)) { | 1253 if (V8_UNLIKELY(isolate_ != nullptr)) { |
1254 RuntimeCallStats::Leave(isolate_->counters()->runtime_call_stats(), | 1254 RuntimeCallStats::Leave(isolate_->counters()->runtime_call_stats(), |
1255 &timer_); | 1255 &timer_); |
1256 } | 1256 } |
1257 } | 1257 } |
1258 | 1258 |
1259 private: | 1259 private: |
| 1260 V8_INLINE void Initialize(Isolate* isolate, |
| 1261 RuntimeCallStats::CounterId counter_id) { |
| 1262 isolate_ = isolate; |
| 1263 RuntimeCallStats::Enter(isolate_->counters()->runtime_call_stats(), &timer_, |
| 1264 counter_id); |
| 1265 } |
| 1266 |
1260 Isolate* isolate_ = nullptr; | 1267 Isolate* isolate_ = nullptr; |
1261 RuntimeCallTimer timer_; | 1268 RuntimeCallTimer timer_; |
1262 }; | 1269 }; |
1263 | 1270 |
1264 } // namespace internal | 1271 } // namespace internal |
1265 } // namespace v8 | 1272 } // namespace v8 |
1266 | 1273 |
1267 #endif // V8_COUNTERS_H_ | 1274 #endif // V8_COUNTERS_H_ |
OLD | NEW |