Commit aeb8e893 authored by primiano's avatar primiano Committed by Commit bot

[tracing] Fix allocator dump JSON format and roll trace-viewer.

This is to align the attributes used by memory allocator dump with
telemetry values [1] introducing types and units as attributes args.
Follow up patches will clean up the C++ interface to match the new
model.

This also rolls src/third_party/trace-viewer bd416ea:ba605a2 to pick up
the corresponding trace-viewer UI changes.

Summary of changes available at:
https://chromium.googlesource.com/external/trace-viewer/+log/bd416ea..ba605a2

BUG=466141

Review URL: https://codereview.chromium.org/1106943002

Cr-Commit-Position: refs/heads/master@{#327058}
parent 177a1091
...@@ -132,7 +132,7 @@ deps = { ...@@ -132,7 +132,7 @@ deps = {
Var('chromium_git') + '/crashpad/crashpad.git' + '@' + '1baff4ff92fe1a1ead6b88b5f01633a4f0b6b51c', Var('chromium_git') + '/crashpad/crashpad.git' + '@' + '1baff4ff92fe1a1ead6b88b5f01633a4f0b6b51c',
'src/third_party/trace-viewer': 'src/third_party/trace-viewer':
Var('chromium_git') + '/external/trace-viewer.git' + '@' + 'bd416ea61d3632b93796eba2134fe03185e9e63e', Var('chromium_git') + '/external/trace-viewer.git' + '@' + 'ba605a208707d32e80f630ea0d0ecef61cd6cb7e',
'src/third_party/WebKit': 'src/third_party/WebKit':
Var('chromium_git') + '/chromium/blink.git' + '@' + Var('webkit_revision'), Var('chromium_git') + '/chromium/blink.git' + '@' + Var('webkit_revision'),
......
...@@ -74,16 +74,31 @@ void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { ...@@ -74,16 +74,31 @@ void MemoryAllocatorDump::AsValueInto(TracedValue* value) const {
static const char kHexFmt[] = "%" PRIx64; static const char kHexFmt[] = "%" PRIx64;
value->BeginDictionary(GetAbsoluteName().c_str()); value->BeginDictionary(GetAbsoluteName().c_str());
value->BeginDictionary("attrs");
value->SetString("physical_size_in_bytes",
StringPrintf(kHexFmt, physical_size_in_bytes_)); // TODO(primiano): these hard-coded types are temporary to transition to the
value->SetString("allocated_objects_count", // new generalized attribute format. This code will be refactored by the end
StringPrintf(kHexFmt, allocated_objects_count_)); // of May 2015.
value->SetString("allocated_objects_size_in_bytes", 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_)); 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. // Copy all the extra attributes.
value->BeginDictionary("args");
for (DictionaryValue::Iterator it(attributes_values_); !it.IsAtEnd(); for (DictionaryValue::Iterator it(attributes_values_); !it.IsAtEnd();
it.Advance()) { it.Advance()) {
const std::string& attr_name = it.key(); const std::string& attr_name = it.key();
...@@ -91,17 +106,16 @@ void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { ...@@ -91,17 +106,16 @@ void MemoryAllocatorDump::AsValueInto(TracedValue* value) const {
value->BeginDictionary(attr_name.c_str()); value->BeginDictionary(attr_name.c_str());
value->SetValue("value", attr_value.DeepCopy()); value->SetValue("value", attr_value.DeepCopy());
// TODO(primiano): the "type" should be dumped just once, not repeated on
// on every event. The ability of doing so depends on crbug.com/466121.
const std::string& attr_type = const std::string& attr_type =
GetAttributesTypeInfo().Get(allocator_name_, attr_name); GetAttributesTypeInfo().Get(allocator_name_, attr_name);
DCHECK(!attr_type.empty()); DCHECK(!attr_type.empty());
value->SetString("type", attr_type); value->SetString("type", "scalar");
value->SetString("units", attr_type);
value->EndDictionary(); // "arg_name": { "type": "...", "value": "..." } value->EndDictionary(); // "arg_name": { "type": "...", "value": "..." }
} }
value->EndDictionary(); // "args": { ... }
value->EndDictionary(); // "attrs": { ... }
value->EndDictionary(); // "allocator_name/heap_subheap": { ... } value->EndDictionary(); // "allocator_name/heap_subheap": { ... }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment