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/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace tracing { | 14 namespace tracing { |
15 | 15 |
16 // A global flag used as a shortcut to check for the | 16 // A global flag used as a shortcut to check for the |
17 // v8.runtime-call-stats category due to its high frequency use. | 17 // v8.runtime-call-stats category due to its high frequency use. |
18 base::Atomic32 kRuntimeCallStatsTracingEnabled = false; | 18 base::Atomic32 kRuntimeCallStatsTracingEnabled = false; |
19 | 19 |
20 v8::Platform* TraceEventHelper::GetCurrentPlatform() { | 20 v8::Platform* TraceEventHelper::GetCurrentPlatform() { |
21 return v8::internal::V8::GetCurrentPlatform(); | 21 return v8::internal::V8::GetCurrentPlatform(); |
22 } | 22 } |
23 | 23 |
24 void CallStatsScopedTracer::AddEndTraceEvent() { | 24 void CallStatsScopedTracer::AddEndTraceEvent() { |
25 if (!has_parent_scope_ && p_data_->isolate) { | 25 if (!has_parent_scope_ && p_data_->isolate) { |
26 v8::internal::tracing::AddTraceEvent( | 26 v8::internal::tracing::AddTraceEvent( |
27 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, |
28 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, | 28 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, |
29 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_COPY, | 29 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE, |
30 "runtime-call-stat", | 30 "runtime-call-stats", |
31 TRACE_STR_COPY(p_data_->isolate->trace_event_stats_table()->Dump())); | 31 TRACE_STR_COPY(p_data_->isolate->trace_event_stats_table()->Dump())); |
32 } else { | 32 } else { |
33 v8::internal::tracing::AddTraceEvent( | 33 v8::internal::tracing::AddTraceEvent( |
34 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, | 34 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, |
35 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, | 35 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, |
36 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE); | 36 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 void CallStatsScopedTracer::Initialize(Isolate* isolate, | 40 void CallStatsScopedTracer::Initialize(Isolate* isolate, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 len_ = length; | 131 len_ = length; |
132 } | 132 } |
133 strncpy(buffer_c_str_.get(), buffer_str.c_str(), length + 1); | 133 strncpy(buffer_c_str_.get(), buffer_str.c_str(), length + 1); |
134 in_use_ = false; | 134 in_use_ = false; |
135 return buffer_c_str_.get(); | 135 return buffer_c_str_.get(); |
136 } | 136 } |
137 | 137 |
138 } // namespace tracing | 138 } // namespace tracing |
139 } // namespace internal | 139 } // namespace internal |
140 } // namespace v8 | 140 } // namespace v8 |
OLD | NEW |