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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 934323002: [tracing] Add a dump provider to dump process memory totals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 0a3e0965f0bc0e24ec8934b4676608c2d8d20090..d3bb0a9d33d327c2f5fa2d84759962dd0b5d54c3 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -5,6 +5,7 @@
#include "base/trace_event/process_memory_dump.h"
#include "base/json/json_writer.h"
+#include "base/trace_event/process_memory_totals.h"
#include "base/values.h"
namespace base {
@@ -16,11 +17,18 @@ ProcessMemoryDump::ProcessMemoryDump() {
ProcessMemoryDump::~ProcessMemoryDump() {
}
+void ProcessMemoryDump::SetProcessTotals(scoped_ptr<ProcessMemoryTotals> pmt) {
+ process_totals_ = pmt.Pass();
+}
+
void ProcessMemoryDump::AppendAsTraceFormat(std::string* out) const {
// Build up the [dumper name] -> [serialized snapshot] JSON dictionary.
DictionaryValue dict;
std::string json_dict;
- // TODO(primiano): this will append here the actual dumps from the dumpers.
+
+ if (process_totals_)
+ dict.Set("process_totals", process_totals_->AsValue());
+
base::JSONWriter::Write(&dict, &json_dict);
*out += json_dict;
}

Powered by Google App Engine
This is Rietveld 408576698