OLD | NEW |
---|---|
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/malloc_dump_provider.h" | 5 #include "base/trace_event/malloc_dump_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
10 #include "base/allocator/allocator_shim.h" | 10 #include "base/allocator/allocator_shim.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 metrics.size += alloc_size.size; | 188 metrics.size += alloc_size.size; |
189 metrics.count++; | 189 metrics.count++; |
190 } | 190 } |
191 } | 191 } |
192 allocation_register_->EstimateTraceMemoryOverhead(&overhead); | 192 allocation_register_->EstimateTraceMemoryOverhead(&overhead); |
193 } | 193 } |
194 } // lock(allocation_register_lock_) | 194 } // lock(allocation_register_lock_) |
195 | 195 |
196 if (!metrics_by_context.empty()) { | 196 if (!metrics_by_context.empty()) { |
197 std::unique_ptr<TracedValue> heap_dump = ExportHeapDump( | 197 std::unique_ptr<TracedValue> heap_dump = ExportHeapDump( |
198 metrics_by_context, pmd->session_state()->stack_frame_deduplicator(), | 198 metrics_by_context, *pmd->session_state()); |
Primiano Tucci (use gerrit)
2016/04/22 14:18:29
yes fantastic :)
Maria
2016/04/25 18:37:23
Acknowledged.
| |
199 pmd->session_state()->type_name_deduplicator()); | |
200 pmd->AddHeapDump("malloc", std::move(heap_dump)); | 199 pmd->AddHeapDump("malloc", std::move(heap_dump)); |
201 } | 200 } |
202 overhead.DumpInto("tracing/heap_profiler_malloc", pmd); | 201 overhead.DumpInto("tracing/heap_profiler_malloc", pmd); |
203 } | 202 } |
204 tid_dumping_heap_ = kInvalidThreadId; | 203 tid_dumping_heap_ = kInvalidThreadId; |
205 | 204 |
206 return true; | 205 return true; |
207 } | 206 } |
208 | 207 |
209 void MallocDumpProvider::OnHeapProfilingEnabled(bool enabled) { | 208 void MallocDumpProvider::OnHeapProfilingEnabled(bool enabled) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 tid_dumping_heap_ == PlatformThread::CurrentId()) | 254 tid_dumping_heap_ == PlatformThread::CurrentId()) |
256 return; | 255 return; |
257 AutoLock lock(allocation_register_lock_); | 256 AutoLock lock(allocation_register_lock_); |
258 if (!allocation_register_) | 257 if (!allocation_register_) |
259 return; | 258 return; |
260 allocation_register_->Remove(address); | 259 allocation_register_->Remove(address); |
261 } | 260 } |
262 | 261 |
263 } // namespace trace_event | 262 } // namespace trace_event |
264 } // namespace base | 263 } // namespace base |
OLD | NEW |