| 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 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... | 1901 // GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ... |
| 1902 if (thread_is_in_trace_event_.Get()) | 1902 if (thread_is_in_trace_event_.Get()) |
| 1903 return handle; | 1903 return handle; |
| 1904 | 1904 |
| 1905 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); | 1905 AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_); |
| 1906 | 1906 |
| 1907 DCHECK(name); | 1907 DCHECK(name); |
| 1908 DCHECK(!timestamp.is_null()); | 1908 DCHECK(!timestamp.is_null()); |
| 1909 | 1909 |
| 1910 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) | 1910 if (flags & TRACE_EVENT_FLAG_MANGLE_ID) |
| 1911 id ^= process_id_hash_; | 1911 id = HashEventId(id); |
| 1912 | 1912 |
| 1913 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); | 1913 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); |
| 1914 TimeTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? | 1914 TimeTicks now = flags & TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP ? |
| 1915 OffsetNow() : offset_event_timestamp; | 1915 OffsetNow() : offset_event_timestamp; |
| 1916 TimeTicks thread_now = ThreadNow(); | 1916 TimeTicks thread_now = ThreadNow(); |
| 1917 | 1917 |
| 1918 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; | 1918 ThreadLocalEventBuffer* thread_local_event_buffer = NULL; |
| 1919 // A ThreadLocalEventBuffer needs the message loop | 1919 // A ThreadLocalEventBuffer needs the message loop |
| 1920 // - to know when the thread exits; | 1920 // - to know when the thread exits; |
| 1921 // - to handle the final flush. | 1921 // - to handle the final flush. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 watch_event_callback_ = callback; | 2170 watch_event_callback_ = callback; |
| 2171 } | 2171 } |
| 2172 | 2172 |
| 2173 void TraceLog::CancelWatchEvent() { | 2173 void TraceLog::CancelWatchEvent() { |
| 2174 AutoLock lock(lock_); | 2174 AutoLock lock(lock_); |
| 2175 subtle::NoBarrier_Store(&watch_category_, 0); | 2175 subtle::NoBarrier_Store(&watch_category_, 0); |
| 2176 watch_event_name_ = ""; | 2176 watch_event_name_ = ""; |
| 2177 watch_event_callback_.Reset(); | 2177 watch_event_callback_.Reset(); |
| 2178 } | 2178 } |
| 2179 | 2179 |
| 2180 uint64 TraceLog::HashEventId(uint64 id) { |
| 2181 return id ^ process_id_hash_; |
| 2182 } |
| 2183 |
| 2184 |
| 2180 void TraceLog::AddMetadataEventsWhileLocked() { | 2185 void TraceLog::AddMetadataEventsWhileLocked() { |
| 2181 lock_.AssertAcquired(); | 2186 lock_.AssertAcquired(); |
| 2182 | 2187 |
| 2183 #if !defined(OS_NACL) // NaCl shouldn't expose the process id. | 2188 #if !defined(OS_NACL) // NaCl shouldn't expose the process id. |
| 2184 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | 2189 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), |
| 2185 0, | 2190 0, |
| 2186 "num_cpus", "number", | 2191 "num_cpus", "number", |
| 2187 base::SysInfo::NumberOfProcessors()); | 2192 base::SysInfo::NumberOfProcessors()); |
| 2188 #endif | 2193 #endif |
| 2189 | 2194 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2602 } | 2607 } |
| 2603 | 2608 |
| 2604 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2609 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 2605 if (*category_group_enabled_) { | 2610 if (*category_group_enabled_) { |
| 2606 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2611 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
| 2607 name_, event_handle_); | 2612 name_, event_handle_); |
| 2608 } | 2613 } |
| 2609 } | 2614 } |
| 2610 | 2615 |
| 2611 } // namespace trace_event_internal | 2616 } // namespace trace_event_internal |
| OLD | NEW |