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

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

Issue 1911643002: Add configurable limit to allocations in heap profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whitespace change Created 4 years, 7 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
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/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
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());
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
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
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_heap_dump_writer_unittest.cc ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698