| 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" |
| 11 #include "src/base/platform/time.h" | 11 #include "src/base/platform/time.h" |
| 12 #include "src/builtins.h" | 12 #include "src/builtins.h" |
| 13 #include "src/globals.h" | 13 #include "src/globals.h" |
| 14 #include "src/objects.h" | 14 #include "src/objects.h" |
| 15 #include "src/runtime/runtime.h" | 15 #include "src/runtime/runtime.h" |
| 16 #include "src/tracing/trace-event.h" |
| 16 | 17 |
| 17 namespace v8 { | 18 namespace v8 { |
| 18 namespace internal { | 19 namespace internal { |
| 19 | 20 |
| 20 // StatsCounters is an interface for plugging into external | 21 // StatsCounters is an interface for plugging into external |
| 21 // counters for monitoring. Counters can be looked up and | 22 // counters for monitoring. Counters can be looked up and |
| 22 // manipulated by name. | 23 // manipulated by name. |
| 23 | 24 |
| 24 class StatsTable { | 25 class StatsTable { |
| 25 public: | 26 public: |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 RuntimeCallStats() { Reset(); } | 780 RuntimeCallStats() { Reset(); } |
| 780 RuntimeCallTimer* current_timer() { return current_timer_; } | 781 RuntimeCallTimer* current_timer() { return current_timer_; } |
| 781 | 782 |
| 782 private: | 783 private: |
| 783 // Counter to track recursive time events. | 784 // Counter to track recursive time events. |
| 784 RuntimeCallTimer* current_timer_ = NULL; | 785 RuntimeCallTimer* current_timer_ = NULL; |
| 785 }; | 786 }; |
| 786 | 787 |
| 787 #define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ | 788 #define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ |
| 788 do { \ | 789 do { \ |
| 790 TRACE_RUNTIME_CALL(#counter_name); \ |
| 789 if (FLAG_runtime_call_stats) { \ | 791 if (FLAG_runtime_call_stats) { \ |
| 790 RuntimeCallStats::CorrectCurrentCounterId( \ | 792 RuntimeCallStats::CorrectCurrentCounterId( \ |
| 791 isolate, &RuntimeCallStats::counter_name); \ | 793 isolate, &RuntimeCallStats::counter_name); \ |
| 792 } \ | 794 } \ |
| 793 } while (false) | 795 } while (false) |
| 794 | 796 |
| 795 #define TRACE_HANDLER_STATS(isolate, counter_name) \ | 797 #define TRACE_HANDLER_STATS(isolate, counter_name) \ |
| 796 TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name) | 798 TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name) |
| 797 | 799 |
| 798 // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the | 800 // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1235 |
| 1234 explicit Counters(Isolate* isolate); | 1236 explicit Counters(Isolate* isolate); |
| 1235 | 1237 |
| 1236 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 1238 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
| 1237 }; | 1239 }; |
| 1238 | 1240 |
| 1239 } // namespace internal | 1241 } // namespace internal |
| 1240 } // namespace v8 | 1242 } // namespace v8 |
| 1241 | 1243 |
| 1242 #endif // V8_COUNTERS_H_ | 1244 #endif // V8_COUNTERS_H_ |
| OLD | NEW |