OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/tracing/trace-event.h" | 5 #include "src/tracing/trace-event.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 #include "src/tracing/traced-value.h" | 11 #include "src/tracing/traced-value.h" |
12 #include "src/v8.h" | 12 #include "src/v8.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace tracing { | 16 namespace tracing { |
17 | 17 |
18 // A global flag used as a shortcut to check for the | |
19 // v8.runtime-call-stats category due to its high frequency use. | |
20 base::Atomic32 kRuntimeCallStatsTracingEnabled = false; | |
21 | |
22 v8::Platform* TraceEventHelper::GetCurrentPlatform() { | 18 v8::Platform* TraceEventHelper::GetCurrentPlatform() { |
23 return v8::internal::V8::GetCurrentPlatform(); | 19 return v8::internal::V8::GetCurrentPlatform(); |
24 } | 20 } |
25 | 21 |
26 void CallStatsScopedTracer::AddEndTraceEvent() { | 22 void CallStatsScopedTracer::AddEndTraceEvent() { |
27 if (!has_parent_scope_ && p_data_->isolate) { | 23 if (!has_parent_scope_ && p_data_->isolate) { |
28 auto value = v8::tracing::TracedValue::Create(); | 24 auto value = v8::tracing::TracedValue::Create(); |
29 p_data_->isolate->counters()->runtime_call_stats()->Dump(value.get()); | 25 p_data_->isolate->counters()->runtime_call_stats()->Dump(value.get()); |
30 v8::internal::tracing::AddTraceEvent( | 26 v8::internal::tracing::AddTraceEvent( |
31 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, | 27 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, |
(...skipping 20 matching lines...) Expand all Loading... |
52 if (!has_parent_scope_ && table->current_timer() == NULL) table->Reset(); | 48 if (!has_parent_scope_ && table->current_timer() == NULL) table->Reset(); |
53 v8::internal::tracing::AddTraceEvent( | 49 v8::internal::tracing::AddTraceEvent( |
54 TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name, | 50 TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name, |
55 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, | 51 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, |
56 TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId); | 52 TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId); |
57 } | 53 } |
58 | 54 |
59 } // namespace tracing | 55 } // namespace tracing |
60 } // namespace internal | 56 } // namespace internal |
61 } // namespace v8 | 57 } // namespace v8 |
OLD | NEW |