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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 1910253003: PartitionAllocMemoryDumpProvider can directly inherit from MemoryDumpProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 56fda8088b8b56a09015dadbea06872ac791326c..eaac62ba4452e5070f4a5fdcfdae93b0cfc9e30e 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -10,6 +10,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/process_memory_totals.h"
#include "base/trace_event/trace_event_argument.h"
#include "build/build_config.h"
@@ -221,6 +223,23 @@ void ProcessMemoryDump::AddHeapDump(const std::string& absolute_name,
heap_dumps_[absolute_name] = std::move(heap_dump);
}
+void ProcessMemoryDump::DumpHeapUsage(
+ const base::hash_map<base::trace_event::AllocationContext,
+ base::trace_event::AllocationMetrics>& metrics_by_context,
+ base::trace_event::TraceEventMemoryOverhead& overhead,
+ const char* allocator_name) {
+ if (!metrics_by_context.empty()) {
+ std::unique_ptr<base::trace_event::TracedValue> heap_dump = ExportHeapDump(
+ metrics_by_context, session_state()->stack_frame_deduplicator(),
+ session_state()->type_name_deduplicator());
+ AddHeapDump(allocator_name, std::move(heap_dump));
+ }
+
+ std::string base_name = base::StringPrintf("tracing/heap_profiler_%s",
+ allocator_name);
+ overhead.DumpInto(base_name.c_str(), this);
+}
+
void ProcessMemoryDump::Clear() {
if (has_process_totals_) {
process_totals_.Clear();

Powered by Google App Engine
This is Rietveld 408576698