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

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

Issue 2838913002: memory-infra: Add SUMMARY_ONLY MemoryDumpType (Closed)
Patch Set: fix for rebase 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 74
75 CHECK_NE(MemoryDumpType::SUMMARY_ONLY, req_args->dump_type);
76
75 const uint64_t dump_guid = req_args->dump_guid; 77 const uint64_t dump_guid = req_args->dump_guid;
76 78
77 std::unique_ptr<TracedValue> traced_value(new TracedValue); 79 std::unique_ptr<TracedValue> traced_value(new TracedValue);
78 process_memory_dump->AsValueInto(traced_value.get()); 80 process_memory_dump->AsValueInto(traced_value.get());
79 traced_value->SetString("level_of_detail", MemoryDumpLevelOfDetailToString( 81 traced_value->SetString("level_of_detail", MemoryDumpLevelOfDetailToString(
80 req_args->level_of_detail)); 82 req_args->level_of_detail));
81 const char* const event_name = MemoryDumpTypeToString(req_args->dump_type); 83 const char* const event_name = MemoryDumpTypeToString(req_args->dump_type);
82 84
83 std::unique_ptr<ConvertableToTraceFormat> event_value( 85 std::unique_ptr<ConvertableToTraceFormat> event_value(
84 std::move(traced_value)); 86 std::move(traced_value));
85 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID( 87 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID(
86 TRACE_EVENT_PHASE_MEMORY_DUMP, 88 TRACE_EVENT_PHASE_MEMORY_DUMP,
87 TraceLog::GetCategoryGroupEnabled(MemoryDumpManager::kTraceCategory), 89 TraceLog::GetCategoryGroupEnabled(MemoryDumpManager::kTraceCategory),
88 event_name, trace_event_internal::kGlobalScope, dump_guid, pid, 90 event_name, trace_event_internal::kGlobalScope, dump_guid, pid,
89 kTraceEventNumArgs, kTraceEventArgNames, kTraceEventArgTypes, 91 kTraceEventNumArgs, kTraceEventArgNames, kTraceEventArgTypes,
90 nullptr /* arg_values */, &event_value, TRACE_EVENT_FLAG_HAS_ID); 92 nullptr /* arg_values */, &event_value, TRACE_EVENT_FLAG_HAS_ID);
91 93
92 return true; 94 return true;
93 } 95 }
94 96
95 } // namespace trace_event 97 } // namespace trace_event
96 } // namespace base 98 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698