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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const int g_num_builtin_categories = 5; | 107 const int g_num_builtin_categories = 5; |
108 // Skip default categories. | 108 // Skip default categories. |
109 base::subtle::AtomicWord g_category_index = g_num_builtin_categories; | 109 base::subtle::AtomicWord g_category_index = g_num_builtin_categories; |
110 | 110 |
111 // The name of the current thread. This is used to decide if the current | 111 // The name of the current thread. This is used to decide if the current |
112 // thread name has changed. We combine all the seen thread names into the | 112 // thread name has changed. We combine all the seen thread names into the |
113 // output name for the thread. | 113 // output name for the thread. |
114 LazyInstance<ThreadLocalPointer<const char> >::Leaky | 114 LazyInstance<ThreadLocalPointer<const char> >::Leaky |
115 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; | 115 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; |
116 | 116 |
117 TimeTicks ThreadNow() { | 117 ThreadTicks ThreadNow() { |
118 return TimeTicks::IsThreadNowSupported() ? | 118 return ThreadTicks::IsSupported() ? ThreadTicks::Now() : ThreadTicks(); |
119 TimeTicks::ThreadNow() : TimeTicks(); | |
120 } | 119 } |
121 | 120 |
122 class TraceBufferRingBuffer : public TraceBuffer { | 121 class TraceBufferRingBuffer : public TraceBuffer { |
123 public: | 122 public: |
124 TraceBufferRingBuffer(size_t max_chunks) | 123 TraceBufferRingBuffer(size_t max_chunks) |
125 : max_chunks_(max_chunks), | 124 : max_chunks_(max_chunks), |
126 recyclable_chunks_queue_(new size_t[queue_capacity()]), | 125 recyclable_chunks_queue_(new size_t[queue_capacity()]), |
127 queue_head_(0), | 126 queue_head_(0), |
128 queue_tail_(max_chunks), | 127 queue_tail_(max_chunks), |
129 current_iteration_index_(0), | 128 current_iteration_index_(0), |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 const char* metadata_name, const char* arg_name, | 365 const char* metadata_name, const char* arg_name, |
367 const T& value) { | 366 const T& value) { |
368 if (!trace_event) | 367 if (!trace_event) |
369 return; | 368 return; |
370 | 369 |
371 int num_args = 1; | 370 int num_args = 1; |
372 unsigned char arg_type; | 371 unsigned char arg_type; |
373 unsigned long long arg_value; | 372 unsigned long long arg_value; |
374 ::trace_event_internal::SetTraceValue(value, &arg_type, &arg_value); | 373 ::trace_event_internal::SetTraceValue(value, &arg_type, &arg_value); |
375 trace_event->Initialize(thread_id, | 374 trace_event->Initialize(thread_id, |
376 TimeTicks(), TimeTicks(), TRACE_EVENT_PHASE_METADATA, | 375 TraceTicks(), ThreadTicks(), |
| 376 TRACE_EVENT_PHASE_METADATA, |
377 &g_category_group_enabled[g_category_metadata], | 377 &g_category_group_enabled[g_category_metadata], |
378 metadata_name, ::trace_event_internal::kNoEventId, | 378 metadata_name, ::trace_event_internal::kNoEventId, |
379 num_args, &arg_name, &arg_type, &arg_value, NULL, | 379 num_args, &arg_name, &arg_type, &arg_value, NULL, |
380 TRACE_EVENT_FLAG_NONE); | 380 TRACE_EVENT_FLAG_NONE); |
381 } | 381 } |
382 | 382 |
383 class AutoThreadLocalBoolean { | 383 class AutoThreadLocalBoolean { |
384 public: | 384 public: |
385 explicit AutoThreadLocalBoolean(ThreadLocalBoolean* thread_local_boolean) | 385 explicit AutoThreadLocalBoolean(ThreadLocalBoolean* thread_local_boolean) |
386 : thread_local_boolean_(thread_local_boolean) { | 386 : thread_local_boolean_(thread_local_boolean) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 for (int i = 0; i < kTraceMaxNumArgs; ++i) { | 511 for (int i = 0; i < kTraceMaxNumArgs; ++i) { |
512 arg_names_[i] = other.arg_names_[i]; | 512 arg_names_[i] = other.arg_names_[i]; |
513 arg_types_[i] = other.arg_types_[i]; | 513 arg_types_[i] = other.arg_types_[i]; |
514 arg_values_[i] = other.arg_values_[i]; | 514 arg_values_[i] = other.arg_values_[i]; |
515 convertable_values_[i] = other.convertable_values_[i]; | 515 convertable_values_[i] = other.convertable_values_[i]; |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 void TraceEvent::Initialize( | 519 void TraceEvent::Initialize( |
520 int thread_id, | 520 int thread_id, |
521 TimeTicks timestamp, | 521 TraceTicks timestamp, |
522 TimeTicks thread_timestamp, | 522 ThreadTicks thread_timestamp, |
523 char phase, | 523 char phase, |
524 const unsigned char* category_group_enabled, | 524 const unsigned char* category_group_enabled, |
525 const char* name, | 525 const char* name, |
526 unsigned long long id, | 526 unsigned long long id, |
527 int num_args, | 527 int num_args, |
528 const char** arg_names, | 528 const char** arg_names, |
529 const unsigned char* arg_types, | 529 const unsigned char* arg_types, |
530 const unsigned long long* arg_values, | 530 const unsigned long long* arg_values, |
531 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 531 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
532 unsigned char flags) { | 532 unsigned char flags) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 605 |
606 void TraceEvent::Reset() { | 606 void TraceEvent::Reset() { |
607 // Only reset fields that won't be initialized in Initialize(), or that may | 607 // Only reset fields that won't be initialized in Initialize(), or that may |
608 // hold references to other objects. | 608 // hold references to other objects. |
609 duration_ = TimeDelta::FromInternalValue(-1); | 609 duration_ = TimeDelta::FromInternalValue(-1); |
610 parameter_copy_storage_ = NULL; | 610 parameter_copy_storage_ = NULL; |
611 for (int i = 0; i < kTraceMaxNumArgs; ++i) | 611 for (int i = 0; i < kTraceMaxNumArgs; ++i) |
612 convertable_values_[i] = NULL; | 612 convertable_values_[i] = NULL; |
613 } | 613 } |
614 | 614 |
615 void TraceEvent::UpdateDuration(const TimeTicks& now, | 615 void TraceEvent::UpdateDuration(const TraceTicks& now, |
616 const TimeTicks& thread_now) { | 616 const ThreadTicks& thread_now) { |
617 DCHECK_EQ(duration_.ToInternalValue(), -1); | 617 DCHECK_EQ(duration_.ToInternalValue(), -1); |
618 duration_ = now - timestamp_; | 618 duration_ = now - timestamp_; |
619 thread_duration_ = thread_now - thread_timestamp_; | 619 thread_duration_ = thread_now - thread_timestamp_; |
620 } | 620 } |
621 | 621 |
622 // static | 622 // static |
623 void TraceEvent::AppendValueAsJSON(unsigned char type, | 623 void TraceEvent::AppendValueAsJSON(unsigned char type, |
624 TraceEvent::TraceValue value, | 624 TraceEvent::TraceValue value, |
625 std::string* out) { | 625 std::string* out) { |
626 switch (type) { | 626 switch (type) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 //////////////////////////////////////////////////////////////////////////////// | 984 //////////////////////////////////////////////////////////////////////////////// |
985 | 985 |
986 class TraceLog::ThreadLocalEventBuffer | 986 class TraceLog::ThreadLocalEventBuffer |
987 : public MessageLoop::DestructionObserver { | 987 : public MessageLoop::DestructionObserver { |
988 public: | 988 public: |
989 ThreadLocalEventBuffer(TraceLog* trace_log); | 989 ThreadLocalEventBuffer(TraceLog* trace_log); |
990 ~ThreadLocalEventBuffer() override; | 990 ~ThreadLocalEventBuffer() override; |
991 | 991 |
992 TraceEvent* AddTraceEvent(TraceEventHandle* handle); | 992 TraceEvent* AddTraceEvent(TraceEventHandle* handle); |
993 | 993 |
994 void ReportOverhead(const TimeTicks& event_timestamp, | 994 void ReportOverhead(const TraceTicks& event_timestamp, |
995 const TimeTicks& event_thread_timestamp); | 995 const ThreadTicks& event_thread_timestamp); |
996 | 996 |
997 TraceEvent* GetEventByHandle(TraceEventHandle handle) { | 997 TraceEvent* GetEventByHandle(TraceEventHandle handle) { |
998 if (!chunk_ || handle.chunk_seq != chunk_->seq() || | 998 if (!chunk_ || handle.chunk_seq != chunk_->seq() || |
999 handle.chunk_index != chunk_index_) | 999 handle.chunk_index != chunk_index_) |
1000 return NULL; | 1000 return NULL; |
1001 | 1001 |
1002 return chunk_->GetEventAt(handle.event_index); | 1002 return chunk_->GetEventAt(handle.event_index); |
1003 } | 1003 } |
1004 | 1004 |
1005 int generation() const { return generation_; } | 1005 int generation() const { return generation_; } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 | 1082 |
1083 size_t event_index; | 1083 size_t event_index; |
1084 TraceEvent* trace_event = chunk_->AddTraceEvent(&event_index); | 1084 TraceEvent* trace_event = chunk_->AddTraceEvent(&event_index); |
1085 if (trace_event && handle) | 1085 if (trace_event && handle) |
1086 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); | 1086 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); |
1087 | 1087 |
1088 return trace_event; | 1088 return trace_event; |
1089 } | 1089 } |
1090 | 1090 |
1091 void TraceLog::ThreadLocalEventBuffer::ReportOverhead( | 1091 void TraceLog::ThreadLocalEventBuffer::ReportOverhead( |
1092 const TimeTicks& event_timestamp, | 1092 const TraceTicks& event_timestamp, |
1093 const TimeTicks& event_thread_timestamp) { | 1093 const ThreadTicks& event_thread_timestamp) { |
1094 if (!g_category_group_enabled[g_category_trace_event_overhead]) | 1094 if (!g_category_group_enabled[g_category_trace_event_overhead]) |
1095 return; | 1095 return; |
1096 | 1096 |
1097 CheckThisIsCurrentBuffer(); | 1097 CheckThisIsCurrentBuffer(); |
1098 | 1098 |
1099 event_count_++; | 1099 event_count_++; |
1100 TimeTicks thread_now = ThreadNow(); | 1100 ThreadTicks thread_now = ThreadNow(); |
1101 TimeTicks now = trace_log_->OffsetNow(); | 1101 TraceTicks now = trace_log_->OffsetNow(); |
1102 TimeDelta overhead = now - event_timestamp; | 1102 TimeDelta overhead = now - event_timestamp; |
1103 if (overhead.InMicroseconds() >= kOverheadReportThresholdInMicroseconds) { | 1103 if (overhead.InMicroseconds() >= kOverheadReportThresholdInMicroseconds) { |
1104 TraceEvent* trace_event = AddTraceEvent(NULL); | 1104 TraceEvent* trace_event = AddTraceEvent(NULL); |
1105 if (trace_event) { | 1105 if (trace_event) { |
1106 trace_event->Initialize( | 1106 trace_event->Initialize( |
1107 static_cast<int>(PlatformThread::CurrentId()), | 1107 static_cast<int>(PlatformThread::CurrentId()), |
1108 event_timestamp, event_thread_timestamp, | 1108 event_timestamp, event_thread_timestamp, |
1109 TRACE_EVENT_PHASE_COMPLETE, | 1109 TRACE_EVENT_PHASE_COMPLETE, |
1110 &g_category_group_enabled[g_category_trace_event_overhead], | 1110 &g_category_group_enabled[g_category_trace_event_overhead], |
1111 "overhead", 0, 0, NULL, NULL, NULL, NULL, 0); | 1111 "overhead", 0, 0, NULL, NULL, NULL, NULL, 0); |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 const unsigned char* category_group_enabled, | 1857 const unsigned char* category_group_enabled, |
1858 const char* name, | 1858 const char* name, |
1859 unsigned long long id, | 1859 unsigned long long id, |
1860 int num_args, | 1860 int num_args, |
1861 const char** arg_names, | 1861 const char** arg_names, |
1862 const unsigned char* arg_types, | 1862 const unsigned char* arg_types, |
1863 const unsigned long long* arg_values, | 1863 const unsigned long long* arg_values, |
1864 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1864 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1865 unsigned char flags) { | 1865 unsigned char flags) { |
1866 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1866 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
1867 base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime(); | 1867 base::TraceTicks now = base::TraceTicks::Now(); |
1868 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1868 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
1869 name, id, thread_id, now, | 1869 name, id, thread_id, now, |
1870 num_args, arg_names, | 1870 num_args, arg_names, |
1871 arg_types, arg_values, | 1871 arg_types, arg_values, |
1872 convertable_values, flags); | 1872 convertable_values, flags); |
1873 } | 1873 } |
1874 | 1874 |
1875 TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( | 1875 TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
1876 char phase, | 1876 char phase, |
1877 const unsigned char* category_group_enabled, | 1877 const unsigned char* category_group_enabled, |
1878 const char* name, | 1878 const char* name, |
1879 unsigned long long id, | 1879 unsigned long long id, |
1880 int thread_id, | 1880 int thread_id, |
1881 const TimeTicks& timestamp, | 1881 const TraceTicks& timestamp, |
1882 int num_args, | 1882 int num_args, |
1883 const char** arg_names, | 1883 const char** arg_names, |
1884 const unsigned char* arg_types, | 1884 const unsigned char* arg_types, |
1885 const unsigned long long* arg_values, | 1885 const unsigned long long* arg_values, |
1886 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1886 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1887 unsigned char flags) { | 1887 unsigned char flags) { |
1888 TraceEventHandle handle = { 0, 0, 0 }; | 1888 TraceEventHandle handle = { 0, 0, 0 }; |
1889 if (!*category_group_enabled) | 1889 if (!*category_group_enabled) |
1890 return handle; | 1890 return handle; |
1891 | 1891 |
1892 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when | 1892 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when |
1893 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> | 1893 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> |
1894 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 1894 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
1895 if (thread_is_in_trace_event_.Get()) | 1895 if (thread_is_in_trace_event_.Get()) |
1896 return handle; | 1896 return handle; |
1897 | 1897 |
1898 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 1898 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
1899 | 1899 |
1900 DCHECK(name); | 1900 DCHECK(name); |
1901 DCHECK(!timestamp.is_null()); | 1901 DCHECK(!timestamp.is_null()); |
1902 | 1902 |
1903 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) | 1903 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) |
1904 id = MangleEventId(id); | 1904 id = MangleEventId(id); |
1905 | 1905 |
1906 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); | 1906 TraceTicks offset_event_timestamp = OffsetTimestamp(timestamp); |
1907 TimeTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? | 1907 TraceTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? |
1908 OffsetNow() : offset_event_timestamp; | 1908 OffsetNow() : offset_event_timestamp; |
1909 TimeTicks thread_now = ThreadNow(); | 1909 ThreadTicks thread_now = ThreadNow(); |
1910 | 1910 |
1911 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; | 1911 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; |
1912 // A ThreadLocalEventBuffer needs the message loop | 1912 // A ThreadLocalEventBuffer needs the message loop |
1913 // - to know when the thread exits; | 1913 // - to know when the thread exits; |
1914 // - to handle the final flush. | 1914 // - to handle the final flush. |
1915 // For a thread without a message loop or the message loop may be blocked, the | 1915 // For a thread without a message loop or the message loop may be blocked, the |
1916 // trace events will be added into the main buffer directly. | 1916 // trace events will be added into the main buffer directly. |
1917 if (!thread_blocks_message_loop_.Get() && MessageLoop::current()) { | 1917 if (!thread_blocks_message_loop_.Get() && MessageLoop::current()) { |
1918 thread_local_event_buffer = thread_local_event_buffer_.Get(); | 1918 thread_local_event_buffer = thread_local_event_buffer_.Get(); |
1919 if (thread_local_event_buffer && | 1919 if (thread_local_event_buffer && |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 | 2037 |
2038 if (thread_local_event_buffer) | 2038 if (thread_local_event_buffer) |
2039 thread_local_event_buffer->ReportOverhead(now, thread_now); | 2039 thread_local_event_buffer->ReportOverhead(now, thread_now); |
2040 | 2040 |
2041 return handle; | 2041 return handle; |
2042 } | 2042 } |
2043 | 2043 |
2044 // May be called when a COMPELETE event ends and the unfinished event has been | 2044 // May be called when a COMPELETE event ends and the unfinished event has been |
2045 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). | 2045 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). |
2046 std::string TraceLog::EventToConsoleMessage(unsigned char phase, | 2046 std::string TraceLog::EventToConsoleMessage(unsigned char phase, |
2047 const TimeTicks& timestamp, | 2047 const TraceTicks& timestamp, |
2048 TraceEvent* trace_event) { | 2048 TraceEvent* trace_event) { |
2049 AutoLock thread_info_lock(thread_info_lock_); | 2049 AutoLock thread_info_lock(thread_info_lock_); |
2050 | 2050 |
2051 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to | 2051 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to |
2052 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. | 2052 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. |
2053 DCHECK(phase != TRACE_EVENT_PHASE_COMPLETE); | 2053 DCHECK(phase != TRACE_EVENT_PHASE_COMPLETE); |
2054 | 2054 |
2055 TimeDelta duration; | 2055 TimeDelta duration; |
2056 int thread_id = trace_event ? | 2056 int thread_id = trace_event ? |
2057 trace_event->thread_id() : PlatformThread::CurrentId(); | 2057 trace_event->thread_id() : PlatformThread::CurrentId(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 const char* name, | 2117 const char* name, |
2118 TraceEventHandle handle) { | 2118 TraceEventHandle handle) { |
2119 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when | 2119 // Avoid re-entrance of AddTraceEvent. This may happen in GPU process when |
2120 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> | 2120 // ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) -> |
2121 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 2121 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
2122 if (thread_is_in_trace_event_.Get()) | 2122 if (thread_is_in_trace_event_.Get()) |
2123 return; | 2123 return; |
2124 | 2124 |
2125 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 2125 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
2126 | 2126 |
2127 TimeTicks thread_now = ThreadNow(); | 2127 ThreadTicks thread_now = ThreadNow(); |
2128 TimeTicks now = OffsetNow(); | 2128 TraceTicks now = OffsetNow(); |
2129 | 2129 |
2130 std::string console_message; | 2130 std::string console_message; |
2131 if (*category_group_enabled & ENABLED_FOR_RECORDING) { | 2131 if (*category_group_enabled & ENABLED_FOR_RECORDING) { |
2132 OptionalAutoLock lock(&lock_); | 2132 OptionalAutoLock lock(&lock_); |
2133 | 2133 |
2134 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); | 2134 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); |
2135 if (trace_event) { | 2135 if (trace_event) { |
2136 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); | 2136 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); |
2137 trace_event->UpdateDuration(now, thread_now); | 2137 trace_event->UpdateDuration(now, thread_now); |
2138 #if defined(OS_ANDROID) | 2138 #if defined(OS_ANDROID) |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2369 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; | 2369 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; |
2370 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( | 2370 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( |
2371 category_group, atomic, category_group_enabled_); | 2371 category_group, atomic, category_group_enabled_); |
2372 name_ = name; | 2372 name_ = name; |
2373 if (*category_group_enabled_) { | 2373 if (*category_group_enabled_) { |
2374 event_handle_ = | 2374 event_handle_ = |
2375 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 2375 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
2376 TRACE_EVENT_PHASE_COMPLETE, category_group_enabled_, name, | 2376 TRACE_EVENT_PHASE_COMPLETE, category_group_enabled_, name, |
2377 trace_event_internal::kNoEventId, | 2377 trace_event_internal::kNoEventId, |
2378 static_cast<int>(base::PlatformThread::CurrentId()), | 2378 static_cast<int>(base::PlatformThread::CurrentId()), |
2379 base::TimeTicks::NowFromSystemTraceTime(), | 2379 base::TraceTicks::Now(), 0, NULL, NULL, NULL, NULL, |
2380 0, NULL, NULL, NULL, NULL, TRACE_EVENT_FLAG_NONE); | 2380 TRACE_EVENT_FLAG_NONE); |
2381 } | 2381 } |
2382 } | 2382 } |
2383 | 2383 |
2384 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2384 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
2385 if (*category_group_enabled_) { | 2385 if (*category_group_enabled_) { |
2386 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2386 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
2387 name_, event_handle_); | 2387 name_, event_handle_); |
2388 } | 2388 } |
2389 } | 2389 } |
2390 | 2390 |
2391 } // namespace trace_event_internal | 2391 } // namespace trace_event_internal |
OLD | NEW |