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