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

Side by Side Diff: base/trace_event/memory_tracing_observer.cc

Issue 2838913002: memory-infra: Add SUMMARY_ONLY MemoryDumpType (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/trace_event/memory_tracing_observer.h" 5 #include "base/trace_event/memory_tracing_observer.h"
6 6
7 #include "base/trace_event/memory_dump_manager.h" 7 #include "base/trace_event/memory_dump_manager.h"
8 #include "base/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 bool MemoryTracingObserver::AddDumpToTraceIfEnabled( 66 bool MemoryTracingObserver::AddDumpToTraceIfEnabled(
67 const MemoryDumpRequestArgs* req_args, 67 const MemoryDumpRequestArgs* req_args,
68 const ProcessId pid, 68 const ProcessId pid,
69 const ProcessMemoryDump* process_memory_dump) { 69 const ProcessMemoryDump* process_memory_dump) {
70 // If tracing has been disabled early out to avoid the cost of serializing the 70 // If tracing has been disabled early out to avoid the cost of serializing the
71 // dump then ignoring the result. 71 // dump then ignoring the result.
72 if (!IsMemoryInfraTracingEnabled()) 72 if (!IsMemoryInfraTracingEnabled())
73 return false; 73 return false;
74 // Some dumps are requested just to cacluate the summary. These shouldn't be
75 // added to the trace to avoid confusing trace consumers.
76 if (req_args->dump_type == MemoryDumpType::SUMMARY_ONLY)
77 return false;
74 78
75 const uint64_t dump_guid = req_args->dump_guid; 79 const uint64_t dump_guid = req_args->dump_guid;
76 80
77 std::unique_ptr<TracedValue> traced_value(new TracedValue); 81 std::unique_ptr<TracedValue> traced_value(new TracedValue);
78 process_memory_dump->AsValueInto(traced_value.get()); 82 process_memory_dump->AsValueInto(traced_value.get());
79 traced_value->SetString("level_of_detail", MemoryDumpLevelOfDetailToString( 83 traced_value->SetString("level_of_detail", MemoryDumpLevelOfDetailToString(
80 req_args->level_of_detail)); 84 req_args->level_of_detail));
81 const char* const event_name = MemoryDumpTypeToString(req_args->dump_type); 85 const char* const event_name = MemoryDumpTypeToString(req_args->dump_type);
82 86
83 std::unique_ptr<ConvertableToTraceFormat> event_value( 87 std::unique_ptr<ConvertableToTraceFormat> event_value(
84 std::move(traced_value)); 88 std::move(traced_value));
85 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID( 89 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID(
86 TRACE_EVENT_PHASE_MEMORY_DUMP, 90 TRACE_EVENT_PHASE_MEMORY_DUMP,
87 TraceLog::GetCategoryGroupEnabled(MemoryDumpManager::kTraceCategory), 91 TraceLog::GetCategoryGroupEnabled(MemoryDumpManager::kTraceCategory),
88 event_name, trace_event_internal::kGlobalScope, dump_guid, pid, 92 event_name, trace_event_internal::kGlobalScope, dump_guid, pid,
89 kTraceEventNumArgs, kTraceEventArgNames, kTraceEventArgTypes, 93 kTraceEventNumArgs, kTraceEventArgNames, kTraceEventArgTypes,
90 nullptr /* arg_values */, &event_value, TRACE_EVENT_FLAG_HAS_ID); 94 nullptr /* arg_values */, &event_value, TRACE_EVENT_FLAG_HAS_ID);
91 95
92 return true; 96 return true;
93 } 97 }
94 98
95 } // namespace trace_event 99 } // namespace trace_event
96 } // namespace base 100 } // namespace base
OLDNEW
« base/trace_event/memory_dump_request_args.h ('K') | « base/trace_event/memory_dump_request_args.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698