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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 796 |
797 RuntimeCallTimer* current_timer() { return current_timer_; } | 797 RuntimeCallTimer* current_timer() { return current_timer_; } |
798 bool InUse() { return in_use_; } | 798 bool InUse() { return in_use_; } |
799 | 799 |
800 private: | 800 private: |
801 std::stringstream buffer_; | 801 std::stringstream buffer_; |
802 std::unique_ptr<char[]> buffer_c_str_; | 802 std::unique_ptr<char[]> buffer_c_str_; |
803 size_t len_ = 0; | 803 size_t len_ = 0; |
804 // Counter to track recursive time events. | 804 // Counter to track recursive time events. |
805 RuntimeCallTimer* current_timer_ = NULL; | 805 RuntimeCallTimer* current_timer_ = NULL; |
| 806 // Used to track nested tracing scopes. |
806 bool in_use_; | 807 bool in_use_; |
807 }; | 808 }; |
808 | 809 |
809 #define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ | 810 #define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \ |
810 do { \ | 811 do { \ |
811 if (FLAG_runtime_call_stats) { \ | 812 if (FLAG_runtime_call_stats) { \ |
812 RuntimeCallStats::CorrectCurrentCounterId( \ | 813 RuntimeCallStats::CorrectCurrentCounterId( \ |
813 isolate->counters()->runtime_call_stats(), \ | 814 isolate->counters()->runtime_call_stats(), \ |
814 &RuntimeCallStats::counter_name); \ | 815 &RuntimeCallStats::counter_name); \ |
815 } \ | 816 } \ |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 // isolate reference and a timer for both. | 1283 // isolate reference and a timer for both. |
1283 Isolate* isolate_for_tracing_ = nullptr; | 1284 Isolate* isolate_for_tracing_ = nullptr; |
1284 RuntimeCallTimer timer_; | 1285 RuntimeCallTimer timer_; |
1285 RuntimeCallTimer trace_event_timer_; | 1286 RuntimeCallTimer trace_event_timer_; |
1286 }; | 1287 }; |
1287 | 1288 |
1288 } // namespace internal | 1289 } // namespace internal |
1289 } // namespace v8 | 1290 } // namespace v8 |
1290 | 1291 |
1291 #endif // V8_COUNTERS_H_ | 1292 #endif // V8_COUNTERS_H_ |
OLD | NEW |