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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 v8::Platform* TraceEventHelper::GetCurrentPlatform() { | 21 v8::Platform* TraceEventHelper::GetCurrentPlatform() { |
22 return v8::internal::V8::GetCurrentPlatform(); | 22 return v8::internal::V8::GetCurrentPlatform(); |
23 } | 23 } |
24 | 24 |
25 void CallStatsScopedTracer::AddEndTraceEvent() { | 25 void CallStatsScopedTracer::AddEndTraceEvent() { |
26 if (!has_parent_scope_ && p_data_->isolate) { | 26 if (!has_parent_scope_ && p_data_->isolate) { |
27 v8::internal::tracing::AddTraceEvent( | 27 v8::internal::tracing::AddTraceEvent( |
28 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, | 28 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, |
29 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, | 29 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, |
30 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE, | 30 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE, |
31 "runtime-call-stats", TRACE_STR_COPY(p_data_->isolate->counters() | 31 "runtime-call-stats", |
32 ->tracing_runtime_call_stats() | 32 TRACE_STR_COPY( |
33 ->Dump())); | 33 p_data_->isolate->counters()->runtime_call_stats()->Dump())); |
34 } else { | 34 } else { |
35 v8::internal::tracing::AddTraceEvent( | 35 v8::internal::tracing::AddTraceEvent( |
36 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, | 36 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, |
37 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, | 37 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, |
38 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE); | 38 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 void CallStatsScopedTracer::Initialize(v8::internal::Isolate* isolate, | 42 void CallStatsScopedTracer::Initialize(v8::internal::Isolate* isolate, |
43 const uint8_t* category_group_enabled, | 43 const uint8_t* category_group_enabled, |
44 const char* name) { | 44 const char* name) { |
45 data_.isolate = isolate; | 45 data_.isolate = isolate; |
46 data_.category_group_enabled = category_group_enabled; | 46 data_.category_group_enabled = category_group_enabled; |
47 data_.name = name; | 47 data_.name = name; |
48 p_data_ = &data_; | 48 p_data_ = &data_; |
49 RuntimeCallStats* table = isolate->counters()->tracing_runtime_call_stats(); | 49 RuntimeCallStats* table = isolate->counters()->runtime_call_stats(); |
50 has_parent_scope_ = table->InUse(); | 50 has_parent_scope_ = table->InUse(); |
51 if (!has_parent_scope_) table->Reset(); | 51 if (!has_parent_scope_) table->Reset(); |
52 v8::internal::tracing::AddTraceEvent( | 52 v8::internal::tracing::AddTraceEvent( |
53 TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name, | 53 TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name, |
54 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, | 54 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, |
55 TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId); | 55 TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId); |
56 } | 56 } |
57 | 57 |
58 } // namespace tracing | 58 } // namespace tracing |
59 } // namespace internal | 59 } // namespace internal |
60 } // namespace v8 | 60 } // namespace v8 |
OLD | NEW |