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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2777093009: [Memory UMA] Return a memory summary struct with the ack message (Closed)
Patch Set: Readd the extra_process_dump map Created 3 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/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 6ed1ca8fff3aa55d94af524a1a0e0057183b02ac..a449aeab32415ea56571f0c42552872cb06f338c 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -82,7 +82,7 @@ const char* const kStrictThreadCheckBlacklist[] = {
// Callback wrapper to hook upon the completion of RequestGlobalDump() and
// inject trace markers.
-void OnGlobalDumpDone(MemoryDumpCallback wrapped_callback,
+void OnGlobalDumpDone(GlobalMemoryDumpCallback wrapped_callback,
uint64_t dump_guid,
bool success) {
char guid_str[20];
@@ -450,7 +450,7 @@ void MemoryDumpManager::UnregisterPollingMDPOnDumpThread(
void MemoryDumpManager::RequestGlobalDump(
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail,
- const MemoryDumpCallback& callback) {
+ const GlobalMemoryDumpCallback& callback) {
// Bail out immediately if tracing is not enabled at all or if the dump mode
// is not allowed.
if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_)) ||
@@ -473,7 +473,7 @@ void MemoryDumpManager::RequestGlobalDump(
kTraceCategory, "GlobalMemoryDump", TRACE_ID_LOCAL(guid), "dump_type",
MemoryDumpTypeToString(dump_type), "level_of_detail",
MemoryDumpLevelOfDetailToString(level_of_detail));
- MemoryDumpCallback wrapped_callback = Bind(&OnGlobalDumpDone, callback);
+ GlobalMemoryDumpCallback wrapped_callback = Bind(&OnGlobalDumpDone, callback);
// The delegate will coordinate the IPC broadcast and at some point invoke
// CreateProcessDump() to get a dump for the current process.
@@ -484,7 +484,7 @@ void MemoryDumpManager::RequestGlobalDump(
void MemoryDumpManager::RequestGlobalDump(
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail) {
- RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback());
+ RequestGlobalDump(dump_type, level_of_detail, GlobalMemoryDumpCallback());
}
bool MemoryDumpManager::IsDumpProviderRegisteredForTesting(
@@ -498,8 +498,9 @@ bool MemoryDumpManager::IsDumpProviderRegisteredForTesting(
return false;
}
-void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
- const MemoryDumpCallback& callback) {
+void MemoryDumpManager::CreateProcessDump(
+ const MemoryDumpRequestArgs& args,
+ const ProcessMemoryDumpCallback& callback) {
char guid_str[20];
sprintf(guid_str, "0x%" PRIx64, args.dump_guid);
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(kTraceCategory, "ProcessMemoryDump",
@@ -762,7 +763,7 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
// The results struct to fill.
// TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
- MemoryDumpCallbackResult result;
+ base::Optional<MemoryDumpCallbackResult> result_opt;
hjd 2017/04/06 11:18:45 Should we have #include "base/optional.h"?
Primiano Tucci (use gerrit) 2017/04/07 15:31:36 +1, IWYU (Include What You Use, i.e. don't depen d
fmeawad 2017/04/10 20:20:19 Done.
for (const auto& kv : pmd_async_state->process_dumps) {
ProcessId pid = kv.first; // kNullProcessId for the current process.
@@ -794,6 +795,7 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
// TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
if (pid == kNullProcessId) {
+ MemoryDumpCallbackResult result;
result.chrome_dump.malloc_total_kb =
GetDumpsSumKb("malloc", process_memory_dump);
result.chrome_dump.v8_total_kb =
@@ -807,6 +809,7 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
GetDumpsSumKb("partition_alloc/partitions/*", process_memory_dump);
result.chrome_dump.blink_gc_total_kb =
GetDumpsSumKb("blink_gc", process_memory_dump);
+ result_opt = result;
}
}
@@ -819,7 +822,8 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
}
if (!pmd_async_state->callback.is_null()) {
- pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful);
+ pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful,
+ result_opt);
pmd_async_state->callback.Reset();
}
@@ -960,7 +964,7 @@ MemoryDumpManager::ProcessMemoryDumpAsyncState::ProcessMemoryDumpAsyncState(
MemoryDumpRequestArgs req_args,
const MemoryDumpProviderInfo::OrderedSet& dump_providers,
scoped_refptr<MemoryDumpSessionState> session_state,
- MemoryDumpCallback callback,
+ ProcessMemoryDumpCallback callback,
scoped_refptr<SingleThreadTaskRunner> dump_thread_task_runner)
: req_args(req_args),
session_state(std::move(session_state)),

Powered by Google App Engine
This is Rietveld 408576698