OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 TraceLog::GetInstance()->process_id(), | 50 TraceLog::GetInstance()->process_id(), |
51 absolute_name.c_str()))) { | 51 absolute_name.c_str()))) { |
52 string_conversion_buffer_.reserve(16); | 52 string_conversion_buffer_.reserve(16); |
53 } | 53 } |
54 | 54 |
55 MemoryAllocatorDump::~MemoryAllocatorDump() { | 55 MemoryAllocatorDump::~MemoryAllocatorDump() { |
56 } | 56 } |
57 | 57 |
58 void MemoryAllocatorDump::AddScalar(const char* name, | 58 void MemoryAllocatorDump::AddScalar(const char* name, |
59 const char* units, | 59 const char* units, |
60 uint64 value) { | 60 uint64_t value) { |
61 SStringPrintf(&string_conversion_buffer_, "%" PRIx64, value); | 61 SStringPrintf(&string_conversion_buffer_, "%" PRIx64, value); |
62 attributes_->BeginDictionary(name); | 62 attributes_->BeginDictionary(name); |
63 attributes_->SetString("type", kTypeScalar); | 63 attributes_->SetString("type", kTypeScalar); |
64 attributes_->SetString("units", units); | 64 attributes_->SetString("units", units); |
65 attributes_->SetString("value", string_conversion_buffer_); | 65 attributes_->SetString("value", string_conversion_buffer_); |
66 attributes_->EndDictionary(); | 66 attributes_->EndDictionary(); |
67 } | 67 } |
68 | 68 |
69 void MemoryAllocatorDump::AddScalarF(const char* name, | 69 void MemoryAllocatorDump::AddScalarF(const char* name, |
70 const char* units, | 70 const char* units, |
(...skipping 17 matching lines...) Expand all Loading... |
88 | 88 |
89 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { | 89 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { |
90 value->BeginDictionaryWithCopiedName(absolute_name_); | 90 value->BeginDictionaryWithCopiedName(absolute_name_); |
91 value->SetString("guid", guid_.ToString()); | 91 value->SetString("guid", guid_.ToString()); |
92 value->SetValue("attrs", *attributes_); | 92 value->SetValue("attrs", *attributes_); |
93 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } | 93 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } |
94 } | 94 } |
95 | 95 |
96 } // namespace trace_event | 96 } // namespace trace_event |
97 } // namespace base | 97 } // namespace base |
OLD | NEW |