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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 //////////////////////////////////////////////////////////////////////////////// | 1042 //////////////////////////////////////////////////////////////////////////////// |
1043 | 1043 |
1044 class TraceLog::ThreadLocalEventBuffer | 1044 class TraceLog::ThreadLocalEventBuffer |
1045 : public MessageLoop::DestructionObserver { | 1045 : public MessageLoop::DestructionObserver { |
1046 public: | 1046 public: |
1047 ThreadLocalEventBuffer(TraceLog* trace_log); | 1047 ThreadLocalEventBuffer(TraceLog* trace_log); |
1048 ~ThreadLocalEventBuffer() override; | 1048 ~ThreadLocalEventBuffer() override; |
1049 | 1049 |
1050 TraceEvent* AddTraceEvent(TraceEventHandle* handle); | 1050 TraceEvent* AddTraceEvent(TraceEventHandle* handle); |
1051 | 1051 |
1052 void ReportOverhead(const TimeTicks& event_timestamp, | 1052 void ReportOverhead(const TraceTicks& event_timestamp, |
1053 const TimeTicks& event_thread_timestamp); | 1053 const ThreadTicks& event_thread_timestamp); |
1054 | 1054 |
1055 TraceEvent* GetEventByHandle(TraceEventHandle handle) { | 1055 TraceEvent* GetEventByHandle(TraceEventHandle handle) { |
1056 if (!chunk_ || handle.chunk_seq != chunk_->seq() || | 1056 if (!chunk_ || handle.chunk_seq != chunk_->seq() || |
1057 handle.chunk_index != chunk_index_) | 1057 handle.chunk_index != chunk_index_) |
1058 return NULL; | 1058 return NULL; |
1059 | 1059 |
1060 return chunk_->GetEventAt(handle.event_index); | 1060 return chunk_->GetEventAt(handle.event_index); |
1061 } | 1061 } |
1062 | 1062 |
1063 int generation() const { return generation_; } | 1063 int generation() const { return generation_; } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 | 1140 |
1141 size_t event_index; | 1141 size_t event_index; |
1142 TraceEvent* trace_event = chunk_->AddTraceEvent(&event_index); | 1142 TraceEvent* trace_event = chunk_->AddTraceEvent(&event_index); |
1143 if (trace_event && handle) | 1143 if (trace_event && handle) |
1144 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); | 1144 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); |
1145 | 1145 |
1146 return trace_event; | 1146 return trace_event; |
1147 } | 1147 } |
1148 | 1148 |
1149 void TraceLog::ThreadLocalEventBuffer::ReportOverhead( | 1149 void TraceLog::ThreadLocalEventBuffer::ReportOverhead( |
1150 const TimeTicks& event_timestamp, | 1150 const TraceTicks& event_timestamp, |
1151 const TimeTicks& event_thread_timestamp) { | 1151 const ThreadTicks& event_thread_timestamp) { |
1152 if (!g_category_group_enabled[g_category_trace_event_overhead]) | 1152 if (!g_category_group_enabled[g_category_trace_event_overhead]) |
1153 return; | 1153 return; |
1154 | 1154 |
1155 CheckThisIsCurrentBuffer(); | 1155 CheckThisIsCurrentBuffer(); |
1156 | 1156 |
1157 event_count_++; | 1157 event_count_++; |
1158 TimeTicks thread_now = ThreadNow(); | 1158 ThreadTicks thread_now = ThreadNow(); |
1159 TimeTicks now = trace_log_->OffsetNow(); | 1159 TraceTicks now = trace_log_->OffsetNow(); |
1160 TimeDelta overhead = now - event_timestamp; | 1160 TimeDelta overhead = now - event_timestamp; |
1161 if (overhead.InMicroseconds() >= kOverheadReportThresholdInMicroseconds) { | 1161 if (overhead.InMicroseconds() >= kOverheadReportThresholdInMicroseconds) { |
1162 TraceEvent* trace_event = AddTraceEvent(NULL); | 1162 TraceEvent* trace_event = AddTraceEvent(NULL); |
1163 if (trace_event) { | 1163 if (trace_event) { |
1164 trace_event->Initialize( | 1164 trace_event->Initialize( |
1165 static_cast<int>(PlatformThread::CurrentId()), | 1165 static_cast<int>(PlatformThread::CurrentId()), |
1166 event_timestamp, event_thread_timestamp, | 1166 event_timestamp, event_thread_timestamp, |
1167 TRACE_EVENT_PHASE_COMPLETE, | 1167 TRACE_EVENT_PHASE_COMPLETE, |
1168 &g_category_group_enabled[g_category_trace_event_overhead], | 1168 &g_category_group_enabled[g_category_trace_event_overhead], |
1169 "overhead", 0, 0, NULL, NULL, NULL, NULL, 0); | 1169 "overhead", 0, 0, NULL, NULL, NULL, NULL, 0); |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 const unsigned char* category_group_enabled, | 1890 const unsigned char* category_group_enabled, |
1891 const char* name, | 1891 const char* name, |
1892 unsigned long long id, | 1892 unsigned long long id, |
1893 int num_args, | 1893 int num_args, |
1894 const char** arg_names, | 1894 const char** arg_names, |
1895 const unsigned char* arg_types, | 1895 const unsigned char* arg_types, |
1896 const unsigned long long* arg_values, | 1896 const unsigned long long* arg_values, |
1897 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1897 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1898 unsigned char flags) { | 1898 unsigned char flags) { |
1899 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1899 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
1900 base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime(); | 1900 base::TraceTicks now = base::TraceTicks::Now(); |
1901 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1901 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
1902 name, id, thread_id, now, | 1902 name, id, thread_id, now, |
1903 num_args, arg_names, | 1903 num_args, arg_names, |
1904 arg_types, arg_values, | 1904 arg_types, arg_values, |
1905 convertable_values, flags); | 1905 convertable_values, flags); |
1906 } | 1906 } |
1907 | 1907 |
1908 TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( | 1908 TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
1909 char phase, | 1909 char phase, |
1910 const unsigned char* category_group_enabled, | 1910 const unsigned char* category_group_enabled, |
1911 const char* name, | 1911 const char* name, |
1912 unsigned long long id, | 1912 unsigned long long id, |
1913 int thread_id, | 1913 int thread_id, |
1914 const TimeTicks& timestamp, | 1914 const TraceTicks& timestamp, |
1915 int num_args, | 1915 int num_args, |
1916 const char** arg_names, | 1916 const char** arg_names, |
1917 const unsigned char* arg_types, | 1917 const unsigned char* arg_types, |
1918 const unsigned long long* arg_values, | 1918 const unsigned long long* arg_values, |
1919 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1919 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1920 unsigned char flags) { | 1920 unsigned char flags) { |
1921 TraceEventHandle handle = { 0, 0, 0 }; | 1921 TraceEventHandle handle = { 0, 0, 0 }; |
1922 if (!*category_group_enabled) | 1922 if (!*category_group_enabled) |
1923 return handle; | 1923 return handle; |
1924 | 1924 |
1925 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when | 1925 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when |
1926 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> | 1926 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> |
1927 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 1927 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
1928 if (thread_is_in_trace_event_.Get()) | 1928 if (thread_is_in_trace_event_.Get()) |
1929 return handle; | 1929 return handle; |
1930 | 1930 |
1931 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 1931 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
1932 | 1932 |
1933 DCHECK(name); | 1933 DCHECK(name); |
1934 DCHECK(!timestamp.is_null()); | 1934 DCHECK(!timestamp.is_null()); |
1935 | 1935 |
1936 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) | 1936 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) |
1937 id = MangleEventId(id); | 1937 id = MangleEventId(id); |
1938 | 1938 |
1939 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); | 1939 TraceTicks offset_event_timestamp = OffsetTimestamp(timestamp); |
1940 TimeTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? | 1940 TraceTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? |
1941 OffsetNow() : offset_event_timestamp; | 1941 OffsetNow() : offset_event_timestamp; |
1942 TimeTicks thread_now = ThreadNow(); | 1942 ThreadTicks thread_now = ThreadNow(); |
1943 | 1943 |
1944 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; | 1944 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; |
1945 // A ThreadLocalEventBuffer needs the message loop | 1945 // A ThreadLocalEventBuffer needs the message loop |
1946 // - to know when the thread exits; | 1946 // - to know when the thread exits; |
1947 // - to handle the final flush. | 1947 // - to handle the final flush. |
1948 // For a thread without a message loop or the message loop may be blocked, the | 1948 // For a thread without a message loop or the message loop may be blocked, the |
1949 // trace events will be added into the main buffer directly. | 1949 // trace events will be added into the main buffer directly. |
1950 if (!thread_blocks_message_loop_.Get() && MessageLoop::current()) { | 1950 if (!thread_blocks_message_loop_.Get() && MessageLoop::current()) { |
1951 thread_local_event_buffer = thread_local_event_buffer_.Get(); | 1951 thread_local_event_buffer = thread_local_event_buffer_.Get(); |
1952 if (thread_local_event_buffer && | 1952 if (thread_local_event_buffer && |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 | 2070 |
2071 if (thread_local_event_buffer) | 2071 if (thread_local_event_buffer) |
2072 thread_local_event_buffer->ReportOverhead(now, thread_now); | 2072 thread_local_event_buffer->ReportOverhead(now, thread_now); |
2073 | 2073 |
2074 return handle; | 2074 return handle; |
2075 } | 2075 } |
2076 | 2076 |
2077 // May be called when a COMPELETE event ends and the unfinished event has been | 2077 // May be called when a COMPELETE event ends and the unfinished event has been |
2078 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). | 2078 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). |
2079 std::string TraceLog::EventToConsoleMessage(unsigned char phase, | 2079 std::string TraceLog::EventToConsoleMessage(unsigned char phase, |
2080 const TimeTicks& timestamp, | 2080 const TraceTicks& timestamp, |
2081 TraceEvent* trace_event) { | 2081 TraceEvent* trace_event) { |
2082 AutoLock thread_info_lock(thread_info_lock_); | 2082 AutoLock thread_info_lock(thread_info_lock_); |
2083 | 2083 |
2084 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to | 2084 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to |
2085 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. | 2085 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. |
2086 DCHECK(phase != TRACE_EVENT_PHASE_COMPLETE); | 2086 DCHECK(phase != TRACE_EVENT_PHASE_COMPLETE); |
2087 | 2087 |
2088 TimeDelta duration; | 2088 TimeDelta duration; |
2089 int thread_id = trace_event ? | 2089 int thread_id = trace_event ? |
2090 trace_event->thread_id() : PlatformThread::CurrentId(); | 2090 trace_event->thread_id() : PlatformThread::CurrentId(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 const char* name, | 2150 const char* name, |
2151 TraceEventHandle handle) { | 2151 TraceEventHandle handle) { |
2152 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when | 2152 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when |
2153 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> | 2153 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> |
2154 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 2154 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
2155 if (thread_is_in_trace_event_.Get()) | 2155 if (thread_is_in_trace_event_.Get()) |
2156 return; | 2156 return; |
2157 | 2157 |
2158 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 2158 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
2159 | 2159 |
2160 TimeTicks thread_now = ThreadNow(); | 2160 ThreadTicks thread_now = ThreadNow(); |
2161 TimeTicks now = OffsetNow(); | 2161 TraceTicks now = OffsetNow(); |
2162 | 2162 |
2163 std::string console_message; | 2163 std::string console_message; |
2164 if (*category_group_enabled & ENABLED_FOR_RECORDING) { | 2164 if (*category_group_enabled & ENABLED_FOR_RECORDING) { |
2165 OptionalAutoLock lock(&lock_); | 2165 OptionalAutoLock lock(&lock_); |
2166 | 2166 |
2167 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); | 2167 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); |
2168 if (trace_event) { | 2168 if (trace_event) { |
2169 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); | 2169 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); |
2170 trace_event->UpdateDuration(now, thread_now); | 2170 trace_event->UpdateDuration(now, thread_now); |
2171 #if defined(OS_ANDROID) | 2171 #if defined(OS_ANDROID) |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; | 2628 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; |
2629 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( | 2629 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( |
2630 category_group, atomic, category_group_enabled_); | 2630 category_group, atomic, category_group_enabled_); |
2631 name_ = name; | 2631 name_ = name; |
2632 if (*category_group_enabled_) { | 2632 if (*category_group_enabled_) { |
2633 event_handle_ = | 2633 event_handle_ = |
2634 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 2634 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
2635 TRACE_EVENT_PHASE_COMPLETE, category_group_enabled_, name, | 2635 TRACE_EVENT_PHASE_COMPLETE, category_group_enabled_, name, |
2636 trace_event_internal::kNoEventId, | 2636 trace_event_internal::kNoEventId, |
2637 static_cast<int>(base::PlatformThread::CurrentId()), | 2637 static_cast<int>(base::PlatformThread::CurrentId()), |
2638 base::TimeTicks::NowFromSystemTraceTime(), | 2638 base::TraceTicks::Now(), 0, NULL, NULL, NULL, NULL, |
2639 0, NULL, NULL, NULL, NULL, TRACE_EVENT_FLAG_NONE); | 2639 TRACE_EVENT_FLAG_NONE); |
2640 } | 2640 } |
2641 } | 2641 } |
2642 | 2642 |
2643 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2643 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
2644 if (*category_group_enabled_) { | 2644 if (*category_group_enabled_) { |
2645 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2645 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
2646 name_, event_handle_); | 2646 name_, event_handle_); |
2647 } | 2647 } |
2648 } | 2648 } |
2649 | 2649 |
2650 } // namespace trace_event_internal | 2650 } // namespace trace_event_internal |
OLD | NEW |