Chromium Code Reviews

Unified Diff: base/trace_event/malloc_dump_provider.cc

Issue 1900223003: [tracing] Ignore tracing allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: base/trace_event/malloc_dump_provider.cc
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
index 17e5c1e62074f95720442ee3b49a944607b490bf..cc26b5254cd9d38840c2b4a75c6fd6dea065555a 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -85,6 +85,21 @@ AllocatorDispatch g_allocator_hooks = {
} // namespace
#endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM)
+MallocDumpProvider::ScopedHeapProfilerIgnoreMalloc::
+ ScopedHeapProfilerIgnoreMalloc() {
+ if (UNLIKELY(AllocationContextTracker::capture_enabled())) {
+ AllocationContextTracker::GetInstanceForCurrentThread()
+ ->start_ignore_scope();
+ }
+}
+
+MallocDumpProvider::ScopedHeapProfilerIgnoreMalloc::
+ ~ScopedHeapProfilerIgnoreMalloc() {
+ if (UNLIKELY(AllocationContextTracker::capture_enabled())) {
+ AllocationContextTracker::GetInstanceForCurrentThread()->end_ignore_scope();
+ }
+}
+
// static
const char MallocDumpProvider::kAllocatedObjects[] = "malloc/allocated_objects";

Powered by Google App Engine