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

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

Issue 2883693002: [Memory-UMA] Implement basic working prototype. (Closed)
Patch Set: Respecify dependent CL, which had somehow gotten lost. Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_allocator_dump.h" 5 #include "base/trace_event/memory_allocator_dump.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/memory_dump_manager.h" 9 #include "base/trace_event/memory_dump_manager.h"
10 #include "base/trace_event/memory_dump_provider.h" 10 #include "base/trace_event/memory_dump_provider.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 attributes_->SetDouble("value", value); 79 attributes_->SetDouble("value", value);
80 attributes_->EndDictionary(); 80 attributes_->EndDictionary();
81 } 81 }
82 82
83 void MemoryAllocatorDump::AddString(const char* name, 83 void MemoryAllocatorDump::AddString(const char* name,
84 const char* units, 84 const char* units,
85 const std::string& value) { 85 const std::string& value) {
86 // String attributes are disabled in background mode. 86 // String attributes are disabled in background mode.
87 if (process_memory_dump_->dump_args().level_of_detail == 87 if (process_memory_dump_->dump_args().level_of_detail ==
88 MemoryDumpLevelOfDetail::BACKGROUND) { 88 MemoryDumpLevelOfDetail::BACKGROUND) {
89 NOTREACHED();
Primiano Tucci (use gerrit) 2017/05/15 03:48:09 Hmm why? This shouldn't really happen. If it happe
erikchen 2017/05/15 17:29:15 Done.
90 return; 89 return;
91 } 90 }
92 91
93 attributes_->BeginDictionary(name); 92 attributes_->BeginDictionary(name);
94 attributes_->SetString("type", kTypeString); 93 attributes_->SetString("type", kTypeString);
95 attributes_->SetString("units", units); 94 attributes_->SetString("units", units);
96 attributes_->SetString("value", value); 95 attributes_->SetString("value", value);
97 attributes_->EndDictionary(); 96 attributes_->EndDictionary();
98 } 97 }
99 98
100 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { 99 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const {
101 value->BeginDictionaryWithCopiedName(absolute_name_); 100 value->BeginDictionaryWithCopiedName(absolute_name_);
102 value->SetString("guid", guid_.ToString()); 101 value->SetString("guid", guid_.ToString());
103 value->SetValue("attrs", *attributes_); 102 value->SetValue("attrs", *attributes_);
104 if (flags_) 103 if (flags_)
105 value->SetInteger("flags", flags_); 104 value->SetInteger("flags", flags_);
106 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } 105 value->EndDictionary(); // "allocator_name/heap_subheap": { ... }
107 } 106 }
108 107
109 } // namespace trace_event 108 } // namespace trace_event
110 } // namespace base 109 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698