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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 776 |
778 RuntimeCallStats() { Reset(); } | 777 RuntimeCallStats() { Reset(); } |
779 | 778 |
780 private: | 779 private: |
781 // Counter to track recursive time events. | 780 // Counter to track recursive time events. |
782 RuntimeCallTimer* current_timer_ = NULL; | 781 RuntimeCallTimer* current_timer_ = NULL; |
783 }; | 782 }; |
784 | 783 |
785 #define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ | 784 #define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ |
786 do { \ | 785 do { \ |
787 TRACE_RUNTIME_CALL(#counter_name); \ | |
788 if (FLAG_runtime_call_stats) { \ | 786 if (FLAG_runtime_call_stats) { \ |
789 RuntimeCallStats::CorrectCurrentCounterId( \ | 787 RuntimeCallStats::CorrectCurrentCounterId( \ |
790 isolate, &RuntimeCallStats::counter_name); \ | 788 isolate, &RuntimeCallStats::counter_name); \ |
791 } \ | 789 } \ |
792 } while (false) | 790 } while (false) |
793 | 791 |
794 #define TRACE_HANDLER_STATS(isolate, counter_name) \ | 792 #define TRACE_HANDLER_STATS(isolate, counter_name) \ |
795 TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name) | 793 TRACE_RUNTIME_CALL_STATS(isolate, Handler_##counter_name) |
796 | 794 |
797 // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the | 795 // A RuntimeCallTimerScopes wraps around a RuntimeCallTimer to measure the |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 | 1231 |
1234 explicit Counters(Isolate* isolate); | 1232 explicit Counters(Isolate* isolate); |
1235 | 1233 |
1236 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 1234 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
1237 }; | 1235 }; |
1238 | 1236 |
1239 } // namespace internal | 1237 } // namespace internal |
1240 } // namespace v8 | 1238 } // namespace v8 |
1241 | 1239 |
1242 #endif // V8_COUNTERS_H_ | 1240 #endif // V8_COUNTERS_H_ |
OLD | NEW |