OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "base/trace_event/trace_event_impl.h" | 5 #include "base/trace_event/trace_event_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const int g_num_builtin_categories = 5; | 117 const int g_num_builtin_categories = 5; |
118 // Skip default categories. | 118 // Skip default categories. |
119 base::subtle::AtomicWord g_category_index = g_num_builtin_categories; | 119 base::subtle::AtomicWord g_category_index = g_num_builtin_categories; |
120 | 120 |
121 // The name of the current thread. This is used to decide if the current | 121 // The name of the current thread. This is used to decide if the current |
122 // thread name has changed. We combine all the seen thread names into the | 122 // thread name has changed. We combine all the seen thread names into the |
123 // output name for the thread. | 123 // output name for the thread. |
124 LazyInstance<ThreadLocalPointer<const char> >::Leaky | 124 LazyInstance<ThreadLocalPointer<const char> >::Leaky |
125 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; | 125 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; |
126 | 126 |
127 TimeTicks ThreadNow() { | 127 ThreadTicks ThreadNow() { |
128 return TimeTicks::IsThreadNowSupported() ? | 128 return ThreadTicks::IsSupported() ? ThreadTicks::Now() : ThreadTicks(); |
129 TimeTicks::ThreadNow() : TimeTicks(); | |
130 } | 129 } |
131 | 130 |
132 class TraceBufferRingBuffer : public TraceBuffer { | 131 class TraceBufferRingBuffer : public TraceBuffer { |
133 public: | 132 public: |
134 TraceBufferRingBuffer(size_t max_chunks) | 133 TraceBufferRingBuffer(size_t max_chunks) |
135 : max_chunks_(max_chunks), | 134 : max_chunks_(max_chunks), |
136 recyclable_chunks_queue_(new size_t[queue_capacity()]), | 135 recyclable_chunks_queue_(new size_t[queue_capacity()]), |
137 queue_head_(0), | 136 queue_head_(0), |
138 queue_tail_(max_chunks), | 137 queue_tail_(max_chunks), |
139 current_iteration_index_(0), | 138 current_iteration_index_(0), |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 const char* metadata_name, const char* arg_name, | 375 const char* metadata_name, const char* arg_name, |
377 const T& value) { | 376 const T& value) { |
378 if (!trace_event) | 377 if (!trace_event) |
379 return; | 378 return; |
380 | 379 |
381 int num_args = 1; | 380 int num_args = 1; |
382 unsigned char arg_type; | 381 unsigned char arg_type; |
383 unsigned long long arg_value; | 382 unsigned long long arg_value; |
384 ::trace_event_internal::SetTraceValue(value, &arg_type, &arg_value); | 383 ::trace_event_internal::SetTraceValue(value, &arg_type, &arg_value); |
385 trace_event->Initialize(thread_id, | 384 trace_event->Initialize(thread_id, |
386 TimeTicks(), TimeTicks(), TRACE_EVENT_PHASE_METADATA, | 385 TraceTicks(), ThreadTicks(), |
| 386 TRACE_EVENT_PHASE_METADATA, |
387 &g_category_group_enabled[g_category_metadata], | 387 &g_category_group_enabled[g_category_metadata], |
388 metadata_name, ::trace_event_internal::kNoEventId, | 388 metadata_name, ::trace_event_internal::kNoEventId, |
389 num_args, &arg_name, &arg_type, &arg_value, NULL, | 389 num_args, &arg_name, &arg_type, &arg_value, NULL, |
390 TRACE_EVENT_FLAG_NONE); | 390 TRACE_EVENT_FLAG_NONE); |
391 } | 391 } |
392 | 392 |
393 class AutoThreadLocalBoolean { | 393 class AutoThreadLocalBoolean { |
394 public: | 394 public: |
395 explicit AutoThreadLocalBoolean(ThreadLocalBoolean* thread_local_boolean) | 395 explicit AutoThreadLocalBoolean(ThreadLocalBoolean* thread_local_boolean) |
396 : thread_local_boolean_(thread_local_boolean) { | 396 : thread_local_boolean_(thread_local_boolean) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 for (int i = 0; i < kTraceMaxNumArgs; ++i) { | 521 for (int i = 0; i < kTraceMaxNumArgs; ++i) { |
522 arg_names_[i] = other.arg_names_[i]; | 522 arg_names_[i] = other.arg_names_[i]; |
523 arg_types_[i] = other.arg_types_[i]; | 523 arg_types_[i] = other.arg_types_[i]; |
524 arg_values_[i] = other.arg_values_[i]; | 524 arg_values_[i] = other.arg_values_[i]; |
525 convertable_values_[i] = other.convertable_values_[i]; | 525 convertable_values_[i] = other.convertable_values_[i]; |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 void TraceEvent::Initialize( | 529 void TraceEvent::Initialize( |
530 int thread_id, | 530 int thread_id, |
531 TimeTicks timestamp, | 531 TraceTicks timestamp, |
532 TimeTicks thread_timestamp, | 532 ThreadTicks thread_timestamp, |
533 char phase, | 533 char phase, |
534 const unsigned char* category_group_enabled, | 534 const unsigned char* category_group_enabled, |
535 const char* name, | 535 const char* name, |
536 unsigned long long id, | 536 unsigned long long id, |
537 int num_args, | 537 int num_args, |
538 const char** arg_names, | 538 const char** arg_names, |
539 const unsigned char* arg_types, | 539 const unsigned char* arg_types, |
540 const unsigned long long* arg_values, | 540 const unsigned long long* arg_values, |
541 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 541 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
542 unsigned char flags) { | 542 unsigned char flags) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 615 |
616 void TraceEvent::Reset() { | 616 void TraceEvent::Reset() { |
617 // Only reset fields that won't be initialized in Initialize(), or that may | 617 // Only reset fields that won't be initialized in Initialize(), or that may |
618 // hold references to other objects. | 618 // hold references to other objects. |
619 duration_ = TimeDelta::FromInternalValue(-1); | 619 duration_ = TimeDelta::FromInternalValue(-1); |
620 parameter_copy_storage_ = NULL; | 620 parameter_copy_storage_ = NULL; |
621 for (int i = 0; i < kTraceMaxNumArgs; ++i) | 621 for (int i = 0; i < kTraceMaxNumArgs; ++i) |
622 convertable_values_[i] = NULL; | 622 convertable_values_[i] = NULL; |
623 } | 623 } |
624 | 624 |
625 void TraceEvent::UpdateDuration(const TimeTicks& now, | 625 void TraceEvent::UpdateDuration(const TraceTicks& now, |
626 const TimeTicks& thread_now) { | 626 const ThreadTicks& thread_now) { |
627 DCHECK_EQ(duration_.ToInternalValue(), -1); | 627 DCHECK_EQ(duration_.ToInternalValue(), -1); |
628 duration_ = now - timestamp_; | 628 duration_ = now - timestamp_; |
629 thread_duration_ = thread_now - thread_timestamp_; | 629 thread_duration_ = thread_now - thread_timestamp_; |
630 } | 630 } |
631 | 631 |
632 // static | 632 // static |
633 void TraceEvent::AppendValueAsJSON(unsigned char type, | 633 void TraceEvent::AppendValueAsJSON(unsigned char type, |
634 TraceEvent::TraceValue value, | 634 TraceEvent::TraceValue value, |
635 std::string* out) { | 635 std::string* out) { |
636 switch (type) { | 636 switch (type) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 //////////////////////////////////////////////////////////////////////////////// | 1037 //////////////////////////////////////////////////////////////////////////////// |
1038 | 1038 |
1039 class TraceLog::ThreadLocalEventBuffer | 1039 class TraceLog::ThreadLocalEventBuffer |
1040 : public MessageLoop::DestructionObserver { | 1040 : public MessageLoop::DestructionObserver { |
1041 public: | 1041 public: |
1042 ThreadLocalEventBuffer(TraceLog* trace_log); | 1042 ThreadLocalEventBuffer(TraceLog* trace_log); |
1043 ~ThreadLocalEventBuffer() override; | 1043 ~ThreadLocalEventBuffer() override; |
1044 | 1044 |
1045 TraceEvent* AddTraceEvent(TraceEventHandle* handle); | 1045 TraceEvent* AddTraceEvent(TraceEventHandle* handle); |
1046 | 1046 |
1047 void ReportOverhead(const TimeTicks& event_timestamp, | 1047 void ReportOverhead(const TraceTicks& event_timestamp, |
1048 const TimeTicks& event_thread_timestamp); | 1048 const ThreadTicks& event_thread_timestamp); |
1049 | 1049 |
1050 TraceEvent* GetEventByHandle(TraceEventHandle handle) { | 1050 TraceEvent* GetEventByHandle(TraceEventHandle handle) { |
1051 if (!chunk_ || handle.chunk_seq != chunk_->seq() || | 1051 if (!chunk_ || handle.chunk_seq != chunk_->seq() || |
1052 handle.chunk_index != chunk_index_) | 1052 handle.chunk_index != chunk_index_) |
1053 return NULL; | 1053 return NULL; |
1054 | 1054 |
1055 return chunk_->GetEventAt(handle.event_index); | 1055 return chunk_->GetEventAt(handle.event_index); |
1056 } | 1056 } |
1057 | 1057 |
1058 int generation() const { return generation_; } | 1058 int generation() const { return generation_; } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 | 1135 |
1136 size_t event_index; | 1136 size_t event_index; |
1137 TraceEvent* trace_event = chunk_->AddTraceEvent(&event_index); | 1137 TraceEvent* trace_event = chunk_->AddTraceEvent(&event_index); |
1138 if (trace_event && handle) | 1138 if (trace_event && handle) |
1139 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); | 1139 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); |
1140 | 1140 |
1141 return trace_event; | 1141 return trace_event; |
1142 } | 1142 } |
1143 | 1143 |
1144 void TraceLog::ThreadLocalEventBuffer::ReportOverhead( | 1144 void TraceLog::ThreadLocalEventBuffer::ReportOverhead( |
1145 const TimeTicks& event_timestamp, | 1145 const TraceTicks& event_timestamp, |
1146 const TimeTicks& event_thread_timestamp) { | 1146 const ThreadTicks& event_thread_timestamp) { |
1147 if (!g_category_group_enabled[g_category_trace_event_overhead]) | 1147 if (!g_category_group_enabled[g_category_trace_event_overhead]) |
1148 return; | 1148 return; |
1149 | 1149 |
1150 CheckThisIsCurrentBuffer(); | 1150 CheckThisIsCurrentBuffer(); |
1151 | 1151 |
1152 event_count_++; | 1152 event_count_++; |
1153 TimeTicks thread_now = ThreadNow(); | 1153 ThreadTicks thread_now = ThreadNow(); |
1154 TimeTicks now = trace_log_->OffsetNow(); | 1154 TraceTicks now = trace_log_->OffsetNow(); |
1155 TimeDelta overhead = now - event_timestamp; | 1155 TimeDelta overhead = now - event_timestamp; |
1156 if (overhead.InMicroseconds() >= kOverheadReportThresholdInMicroseconds) { | 1156 if (overhead.InMicroseconds() >= kOverheadReportThresholdInMicroseconds) { |
1157 TraceEvent* trace_event = AddTraceEvent(NULL); | 1157 TraceEvent* trace_event = AddTraceEvent(NULL); |
1158 if (trace_event) { | 1158 if (trace_event) { |
1159 trace_event->Initialize( | 1159 trace_event->Initialize( |
1160 static_cast<int>(PlatformThread::CurrentId()), | 1160 static_cast<int>(PlatformThread::CurrentId()), |
1161 event_timestamp, event_thread_timestamp, | 1161 event_timestamp, event_thread_timestamp, |
1162 TRACE_EVENT_PHASE_COMPLETE, | 1162 TRACE_EVENT_PHASE_COMPLETE, |
1163 &g_category_group_enabled[g_category_trace_event_overhead], | 1163 &g_category_group_enabled[g_category_trace_event_overhead], |
1164 "overhead", 0, 0, NULL, NULL, NULL, NULL, 0); | 1164 "overhead", 0, 0, NULL, NULL, NULL, NULL, 0); |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 const unsigned char* category_group_enabled, | 1885 const unsigned char* category_group_enabled, |
1886 const char* name, | 1886 const char* name, |
1887 unsigned long long id, | 1887 unsigned long long id, |
1888 int num_args, | 1888 int num_args, |
1889 const char** arg_names, | 1889 const char** arg_names, |
1890 const unsigned char* arg_types, | 1890 const unsigned char* arg_types, |
1891 const unsigned long long* arg_values, | 1891 const unsigned long long* arg_values, |
1892 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1892 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1893 unsigned char flags) { | 1893 unsigned char flags) { |
1894 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1894 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
1895 base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime(); | 1895 base::TraceTicks now = base::TraceTicks::Now(); |
1896 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1896 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
1897 name, id, thread_id, now, | 1897 name, id, thread_id, now, |
1898 num_args, arg_names, | 1898 num_args, arg_names, |
1899 arg_types, arg_values, | 1899 arg_types, arg_values, |
1900 convertable_values, flags); | 1900 convertable_values, flags); |
1901 } | 1901 } |
1902 | 1902 |
1903 TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( | 1903 TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
1904 char phase, | 1904 char phase, |
1905 const unsigned char* category_group_enabled, | 1905 const unsigned char* category_group_enabled, |
1906 const char* name, | 1906 const char* name, |
1907 unsigned long long id, | 1907 unsigned long long id, |
1908 int thread_id, | 1908 int thread_id, |
1909 const TimeTicks& timestamp, | 1909 const TraceTicks& timestamp, |
1910 int num_args, | 1910 int num_args, |
1911 const char** arg_names, | 1911 const char** arg_names, |
1912 const unsigned char* arg_types, | 1912 const unsigned char* arg_types, |
1913 const unsigned long long* arg_values, | 1913 const unsigned long long* arg_values, |
1914 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1914 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1915 unsigned char flags) { | 1915 unsigned char flags) { |
1916 TraceEventHandle handle = { 0, 0, 0 }; | 1916 TraceEventHandle handle = { 0, 0, 0 }; |
1917 if (!*category_group_enabled) | 1917 if (!*category_group_enabled) |
1918 return handle; | 1918 return handle; |
1919 | 1919 |
1920 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when | 1920 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when |
1921 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> | 1921 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> |
1922 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 1922 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
1923 if (thread_is_in_trace_event_.Get()) | 1923 if (thread_is_in_trace_event_.Get()) |
1924 return handle; | 1924 return handle; |
1925 | 1925 |
1926 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 1926 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
1927 | 1927 |
1928 DCHECK(name); | 1928 DCHECK(name); |
1929 DCHECK(!timestamp.is_null()); | 1929 DCHECK(!timestamp.is_null()); |
1930 | 1930 |
1931 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) | 1931 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) |
1932 id = MangleEventId(id); | 1932 id = MangleEventId(id); |
1933 | 1933 |
1934 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); | 1934 TraceTicks offset_event_timestamp = OffsetTimestamp(timestamp); |
1935 TimeTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? | 1935 TraceTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? |
1936 OffsetNow() : offset_event_timestamp; | 1936 OffsetNow() : offset_event_timestamp; |
1937 TimeTicks thread_now = ThreadNow(); | 1937 ThreadTicks thread_now = ThreadNow(); |
1938 | 1938 |
1939 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; | 1939 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; |
1940 // A ThreadLocalEventBuffer needs the message loop | 1940 // A ThreadLocalEventBuffer needs the message loop |
1941 // - to know when the thread exits; | 1941 // - to know when the thread exits; |
1942 // - to handle the final flush. | 1942 // - to handle the final flush. |
1943 // For a thread without a message loop or the message loop may be blocked, the | 1943 // For a thread without a message loop or the message loop may be blocked, the |
1944 // trace events will be added into the main buffer directly. | 1944 // trace events will be added into the main buffer directly. |
1945 if (!thread_blocks_message_loop_.Get() && MessageLoop::current()) { | 1945 if (!thread_blocks_message_loop_.Get() && MessageLoop::current()) { |
1946 thread_local_event_buffer = thread_local_event_buffer_.Get(); | 1946 thread_local_event_buffer = thread_local_event_buffer_.Get(); |
1947 if (thread_local_event_buffer && | 1947 if (thread_local_event_buffer && |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 | 2065 |
2066 if (thread_local_event_buffer) | 2066 if (thread_local_event_buffer) |
2067 thread_local_event_buffer->ReportOverhead(now, thread_now); | 2067 thread_local_event_buffer->ReportOverhead(now, thread_now); |
2068 | 2068 |
2069 return handle; | 2069 return handle; |
2070 } | 2070 } |
2071 | 2071 |
2072 // May be called when a COMPELETE event ends and the unfinished event has been | 2072 // May be called when a COMPELETE event ends and the unfinished event has been |
2073 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). | 2073 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). |
2074 std::string TraceLog::EventToConsoleMessage(unsigned char phase, | 2074 std::string TraceLog::EventToConsoleMessage(unsigned char phase, |
2075 const TimeTicks& timestamp, | 2075 const TraceTicks& timestamp, |
2076 TraceEvent* trace_event) { | 2076 TraceEvent* trace_event) { |
2077 AutoLock thread_info_lock(thread_info_lock_); | 2077 AutoLock thread_info_lock(thread_info_lock_); |
2078 | 2078 |
2079 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to | 2079 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to |
2080 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. | 2080 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. |
2081 DCHECK(phase != TRACE_EVENT_PHASE_COMPLETE); | 2081 DCHECK(phase != TRACE_EVENT_PHASE_COMPLETE); |
2082 | 2082 |
2083 TimeDelta duration; | 2083 TimeDelta duration; |
2084 int thread_id = trace_event ? | 2084 int thread_id = trace_event ? |
2085 trace_event->thread_id() : PlatformThread::CurrentId(); | 2085 trace_event->thread_id() : PlatformThread::CurrentId(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 const char* name, | 2145 const char* name, |
2146 TraceEventHandle handle) { | 2146 TraceEventHandle handle) { |
2147 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when | 2147 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when |
2148 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> | 2148 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> |
2149 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 2149 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
2150 if (thread_is_in_trace_event_.Get()) | 2150 if (thread_is_in_trace_event_.Get()) |
2151 return; | 2151 return; |
2152 | 2152 |
2153 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 2153 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
2154 | 2154 |
2155 TimeTicks thread_now = ThreadNow(); | 2155 ThreadTicks thread_now = ThreadNow(); |
2156 TimeTicks now = OffsetNow(); | 2156 TraceTicks now = OffsetNow(); |
2157 | 2157 |
2158 std::string console_message; | 2158 std::string console_message; |
2159 if (*category_group_enabled & ENABLED_FOR_RECORDING) { | 2159 if (*category_group_enabled & ENABLED_FOR_RECORDING) { |
2160 OptionalAutoLock lock(&lock_); | 2160 OptionalAutoLock lock(&lock_); |
2161 | 2161 |
2162 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); | 2162 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); |
2163 if (trace_event) { | 2163 if (trace_event) { |
2164 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); | 2164 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); |
2165 trace_event->UpdateDuration(now, thread_now); | 2165 trace_event->UpdateDuration(now, thread_now); |
2166 #if defined(OS_ANDROID) | 2166 #if defined(OS_ANDROID) |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; | 2623 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; |
2624 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( | 2624 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( |
2625 category_group, atomic, category_group_enabled_); | 2625 category_group, atomic, category_group_enabled_); |
2626 name_ = name; | 2626 name_ = name; |
2627 if (*category_group_enabled_) { | 2627 if (*category_group_enabled_) { |
2628 event_handle_ = | 2628 event_handle_ = |
2629 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 2629 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
2630 TRACE_EVENT_PHASE_COMPLETE, category_group_enabled_, name, | 2630 TRACE_EVENT_PHASE_COMPLETE, category_group_enabled_, name, |
2631 trace_event_internal::kNoEventId, | 2631 trace_event_internal::kNoEventId, |
2632 static_cast<int>(base::PlatformThread::CurrentId()), | 2632 static_cast<int>(base::PlatformThread::CurrentId()), |
2633 base::TimeTicks::NowFromSystemTraceTime(), | 2633 base::TraceTicks::Now(), 0, NULL, NULL, NULL, NULL, |
2634 0, NULL, NULL, NULL, NULL, TRACE_EVENT_FLAG_NONE); | 2634 TRACE_EVENT_FLAG_NONE); |
2635 } | 2635 } |
2636 } | 2636 } |
2637 | 2637 |
2638 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2638 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
2639 if (*category_group_enabled_) { | 2639 if (*category_group_enabled_) { |
2640 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2640 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
2641 name_, event_handle_); | 2641 name_, event_handle_); |
2642 } | 2642 } |
2643 } | 2643 } |
2644 | 2644 |
2645 } // namespace trace_event_internal | 2645 } // namespace trace_event_internal |
OLD | NEW |