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

Unified Diff: base/trace_event/memory_allocator_dump.cc

Issue 1106943002: [tracing] Fix JSON format for memory allocator dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_allocator_dump.cc
diff --git a/base/trace_event/memory_allocator_dump.cc b/base/trace_event/memory_allocator_dump.cc
index 13f5dcb6ca8a888a58329f901f74e165a76fb22c..5dc53eb4956645e83262103ede8afedf244ef8b8 100644
--- a/base/trace_event/memory_allocator_dump.cc
+++ b/base/trace_event/memory_allocator_dump.cc
@@ -74,16 +74,30 @@ void MemoryAllocatorDump::AsValueInto(TracedValue* value) const {
static const char kHexFmt[] = "%" PRIx64;
value->BeginDictionary(GetAbsoluteName().c_str());
-
- value->SetString("physical_size_in_bytes",
- StringPrintf(kHexFmt, physical_size_in_bytes_));
- value->SetString("allocated_objects_count",
- StringPrintf(kHexFmt, allocated_objects_count_));
- value->SetString("allocated_objects_size_in_bytes",
+ value->BeginDictionary("attrs");
+
+ // TODO(primiano): these hard-coded types are temporary to transition to the
+ // new generalized attribute format. This code will be refactored by May 2015.
petrcermak 2015/04/27 14:22:14 nit: "by May 2015" is ambiguous. Do you mean "by t
Primiano Tucci (use gerrit) 2015/04/27 15:03:18 Done.
+ value->BeginDictionary("outer_size");
+ value->SetString("type", "scalar");
+ value->SetString("units", "bytes");
+ value->SetString("value", StringPrintf(kHexFmt, physical_size_in_bytes_));
+ value->EndDictionary();
+
+ value->BeginDictionary("inner_size");
+ value->SetString("type", "scalar");
+ value->SetString("units", "bytes");
+ value->SetString("value",
StringPrintf(kHexFmt, allocated_objects_size_in_bytes_));
+ value->EndDictionary();
+
+ value->BeginDictionary("objects_count");
+ value->SetString("type", "scalar");
+ value->SetString("units", "objects");
+ value->SetString("value", StringPrintf(kHexFmt, allocated_objects_count_));
+ value->EndDictionary();
// Copy all the extra attributes.
- value->BeginDictionary("args");
for (DictionaryValue::Iterator it(attributes_values_); !it.IsAtEnd();
it.Advance()) {
const std::string& attr_name = it.key();
@@ -96,12 +110,13 @@ void MemoryAllocatorDump::AsValueInto(TracedValue* value) const {
const std::string& attr_type =
GetAttributesTypeInfo().Get(allocator_name_, attr_name);
DCHECK(!attr_type.empty());
- value->SetString("type", attr_type);
+ value->SetString("type", "scalar");
+ value->SetString("units", attr_type);
petrcermak 2015/04/27 14:22:14 Are you forcing all attributes to be scalars now?
Primiano Tucci (use gerrit) 2015/04/27 15:03:18 The latter, all this function is to be refactored.
value->EndDictionary(); // "arg_name": { "type": "...", "value": "..." }
}
- value->EndDictionary(); // "args": { ... }
+ value->EndDictionary(); // "attrs": { ... }
value->EndDictionary(); // "allocator_name/heap_subheap": { ... }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698