| 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 a2b5ed342ec152c0d5a42f1b54f529cf6244bdff..1e8a416a3801313119561ba8129b025c3fc9f3fa 100644
|
| --- a/base/trace_event/memory_dump_manager.cc
|
| +++ b/base/trace_event/memory_dump_manager.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "base/trace_event/memory_dump_manager.h"
|
|
|
| +#include <inttypes.h>
|
| +#include <stdio.h>
|
| +
|
| #include <algorithm>
|
| #include <utility>
|
|
|
| @@ -80,9 +83,12 @@ const char* const kStrictThreadCheckBlacklist[] = {
|
| void OnGlobalDumpDone(MemoryDumpCallback wrapped_callback,
|
| uint64_t dump_guid,
|
| bool success) {
|
| - TRACE_EVENT_NESTABLE_ASYNC_END1(
|
| - MemoryDumpManager::kTraceCategory, "GlobalMemoryDump",
|
| - TRACE_ID_MANGLE(dump_guid), "success", success);
|
| + char guid_str[20];
|
| + sprintf(guid_str, "0x%" PRIx64, dump_guid);
|
| + TRACE_EVENT_NESTABLE_ASYNC_END2(MemoryDumpManager::kTraceCategory,
|
| + "GlobalMemoryDump", TRACE_ID_LOCAL(dump_guid),
|
| + "dump_guid", TRACE_STR_COPY(guid_str),
|
| + "success", success);
|
|
|
| if (!wrapped_callback.is_null()) {
|
| wrapped_callback.Run(dump_guid, success);
|
| @@ -456,8 +462,10 @@ void MemoryDumpManager::RequestGlobalDump(
|
| // Creates an async event to keep track of the global dump evolution.
|
| // The |wrapped_callback| will generate the ASYNC_END event and then invoke
|
| // the real |callback| provided by the caller.
|
| - TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "GlobalMemoryDump",
|
| - TRACE_ID_MANGLE(guid));
|
| + TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(
|
| + kTraceCategory, "GlobalMemoryDump", TRACE_ID_LOCAL(guid), "dump_type",
|
| + MemoryDumpTypeToString(dump_type), "level_of_detail",
|
| + MemoryDumpLevelOfDetailToString(level_of_detail));
|
| MemoryDumpCallback wrapped_callback = Bind(&OnGlobalDumpDone, callback);
|
|
|
| // Technically there is no need to grab the |lock_| here as the delegate is
|
| @@ -496,8 +504,11 @@ bool MemoryDumpManager::IsDumpProviderRegisteredForTesting(
|
|
|
| void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
|
| const MemoryDumpCallback& callback) {
|
| - TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump",
|
| - TRACE_ID_MANGLE(args.dump_guid));
|
| + char guid_str[20];
|
| + sprintf(guid_str, "0x%" PRIx64, args.dump_guid);
|
| + TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(kTraceCategory, "ProcessMemoryDump",
|
| + TRACE_ID_LOCAL(args.dump_guid), "dump_guid",
|
| + TRACE_STR_COPY(guid_str));
|
|
|
| // If argument filter is enabled then only background mode dumps should be
|
| // allowed. In case the trace config passed for background tracing session
|
| @@ -527,10 +538,6 @@ void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
|
| session_state_->IsDumpModeAllowed(args.level_of_detail));
|
| }
|
|
|
| - TRACE_EVENT_WITH_FLOW0(kTraceCategory, "MemoryDumpManager::CreateProcessDump",
|
| - TRACE_ID_MANGLE(args.dump_guid),
|
| - TRACE_EVENT_FLAG_FLOW_OUT);
|
| -
|
| // Start the process dump. This involves task runner hops as specified by the
|
| // MemoryDumpProvider(s) in RegisterDumpProvider()).
|
| SetupNextMemoryDump(std::move(pmd_async_state));
|
| @@ -674,11 +681,8 @@ void MemoryDumpManager::InvokeOnMemoryDump(
|
|
|
| if (should_dump) {
|
| // Invoke the dump provider.
|
| - TRACE_EVENT_WITH_FLOW1(kTraceCategory,
|
| - "MemoryDumpManager::InvokeOnMemoryDump",
|
| - TRACE_ID_MANGLE(pmd_async_state->req_args.dump_guid),
|
| - TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
|
| - "dump_provider.name", mdpinfo->name);
|
| + TRACE_EVENT1(kTraceCategory, "MemoryDumpManager::InvokeOnMemoryDump",
|
| + "dump_provider.name", mdpinfo->name);
|
|
|
| // A stack allocated string with dump provider name is useful to debug
|
| // crashes while invoking dump after a |dump_provider| is not unregistered
|
| @@ -744,9 +748,7 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
|
| return;
|
| }
|
|
|
| - TRACE_EVENT_WITH_FLOW0(kTraceCategory,
|
| - "MemoryDumpManager::FinalizeDumpAndAddToTrace",
|
| - TRACE_ID_MANGLE(dump_guid), TRACE_EVENT_FLAG_FLOW_IN);
|
| + TRACE_EVENT0(kTraceCategory, "MemoryDumpManager::FinalizeDumpAndAddToTrace");
|
|
|
| for (const auto& kv : pmd_async_state->process_dumps) {
|
| ProcessId pid = kv.first; // kNullProcessId for the current process.
|
| @@ -784,7 +786,7 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
|
| }
|
|
|
| TRACE_EVENT_NESTABLE_ASYNC_END0(kTraceCategory, "ProcessMemoryDump",
|
| - TRACE_ID_MANGLE(dump_guid));
|
| + TRACE_ID_LOCAL(dump_guid));
|
| }
|
|
|
| void MemoryDumpManager::OnTraceLogEnabled() {
|
|
|