Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(964)

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 994133002: Generate globally (cross-process) unique IDs for memory tracing dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/trace_event/trace_event_impl.h » ('j') | base/trace_event/trace_event_impl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void MemoryDumpManager::RequestDumpPoint(DumpPointType dump_point_type) { 101 void MemoryDumpManager::RequestDumpPoint(DumpPointType dump_point_type) {
102 // TODO(primiano): this will have more logic to coordinate dump points across 102 // TODO(primiano): this will have more logic to coordinate dump points across
103 // multiple processes via IPC. See crbug.com/462930. 103 // multiple processes via IPC. See crbug.com/462930.
104 104
105 // Bail out immediately if tracing is not enabled at all. 105 // Bail out immediately if tracing is not enabled at all.
106 if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_))) 106 if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_)))
107 return; 107 return;
108 108
109 // TODO(primiano): Make guid actually unique (cross-process) by hashing it 109 const uint64 guid = base::trace_event::TraceLog::GetInstance()->HashEventId(
Primiano Tucci (use gerrit) 2015/04/13 22:13:58 nit: no need for base::trace_event as you are alre
110 // with the PID. See crbug.com/462931 for details. 110 g_next_guid.GetNext());
111 const uint64 guid = g_next_guid.GetNext();
112 CreateLocalDumpPoint(dump_point_type, guid); 111 CreateLocalDumpPoint(dump_point_type, guid);
113 } 112 }
114 113
115 void MemoryDumpManager::BroadcastDumpRequest() { 114 void MemoryDumpManager::BroadcastDumpRequest() {
116 NOTREACHED(); // TODO(primiano): implement IPC synchronization. 115 NOTREACHED(); // TODO(primiano): implement IPC synchronization.
117 } 116 }
118 117
119 // Creates a dump point for the current process and appends it to the trace. 118 // Creates a dump point for the current process and appends it to the trace.
120 void MemoryDumpManager::CreateLocalDumpPoint(DumpPointType dump_point_type, 119 void MemoryDumpManager::CreateLocalDumpPoint(DumpPointType dump_point_type,
121 uint64 guid) { 120 uint64 guid) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 174 }
176 175
177 void MemoryDumpManager::OnTraceLogDisabled() { 176 void MemoryDumpManager::OnTraceLogDisabled() {
178 AutoLock lock(lock_); 177 AutoLock lock(lock_);
179 dump_providers_enabled_.clear(); 178 dump_providers_enabled_.clear();
180 subtle::NoBarrier_Store(&memory_tracing_enabled_, 0); 179 subtle::NoBarrier_Store(&memory_tracing_enabled_, 0);
181 } 180 }
182 181
183 } // namespace trace_event 182 } // namespace trace_event
184 } // namespace base 183 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_event_impl.h » ('j') | base/trace_event/trace_event_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698