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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 2650863003: [tracing] Switch to new heap dump format. (Closed)
Patch Set: Address comments (heaps_v2) Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/process_memory_dump_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/process_memory_dump.cc
diff --git a/base/trace_event/process_memory_dump.cc b/base/trace_event/process_memory_dump.cc
index 63d1340e42e3222c3ee99e92a7e676279cffb8a1..45a3c038f1de08dc9932a97b271b2889301747df 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -11,7 +11,8 @@
#include "base/memory/ptr_util.h"
#include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h"
-#include "base/trace_event/heap_profiler_heap_dump_writer.h"
+#include "base/trace_event/heap_profiler_allocation_register.h"
+#include "base/trace_event/heap_profiler_event_writer.h"
#include "base/trace_event/memory_infra_background_whitelist.h"
#include "base/trace_event/process_memory_totals.h"
#include "base/trace_event/trace_event_argument.h"
@@ -239,17 +240,18 @@ MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump(
}
void ProcessMemoryDump::DumpHeapUsage(
- const base::hash_map<base::trace_event::AllocationContext,
- base::trace_event::AllocationMetrics>& metrics_by_context,
- base::trace_event::TraceEventMemoryOverhead& overhead,
+ const AllocationRegister& allocation_register,
const char* allocator_name) {
- if (!metrics_by_context.empty()) {
+ if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::DETAILED &&
+ allocation_register.begin() != allocation_register.end()) {
DCHECK_EQ(0ul, heap_dumps_.count(allocator_name));
- std::unique_ptr<TracedValue> heap_dump = ExportHeapDump(
- metrics_by_context, *session_state());
+ std::unique_ptr<TracedValue> heap_dump =
+ SerializeHeapDump(allocation_register, *session_state());
heap_dumps_[allocator_name] = std::move(heap_dump);
}
+ TraceEventMemoryOverhead overhead;
+ allocation_register.EstimateTraceMemoryOverhead(&overhead);
std::string base_name = base::StringPrintf("tracing/heap_profiler_%s",
allocator_name);
overhead.DumpInto(base_name.c_str(), this);
@@ -314,10 +316,9 @@ void ProcessMemoryDump::AsValueInto(TracedValue* value) const {
}
if (heap_dumps_.size() > 0) {
- value->BeginDictionary("heaps");
- for (const auto& name_and_dump : heap_dumps_)
- value->SetValueWithCopiedName(name_and_dump.first, *name_and_dump.second);
- value->EndDictionary(); // "heaps"
+ auto profile_data =
+ SerializeHeapProfileEventData(heap_dumps_, *session_state_);
+ value->SetValue("heaps_v2", *profile_data);
}
value->BeginArray("allocators_graph");
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/process_memory_dump_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698