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 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/base_export.h" | 12 #include "base/base_export.h" |
11 #include "base/basictypes.h" | |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
14 #include "base/trace_event/memory_allocator_dump_guid.h" | 16 #include "base/trace_event/memory_allocator_dump_guid.h" |
15 #include "base/values.h" | 17 #include "base/values.h" |
16 | 18 |
17 namespace base { | 19 namespace base { |
18 namespace trace_event { | 20 namespace trace_event { |
19 | 21 |
20 class MemoryDumpManager; | 22 class MemoryDumpManager; |
21 class ProcessMemoryDump; | 23 class ProcessMemoryDump; |
22 class TracedValue; | 24 class TracedValue; |
(...skipping 21 matching lines...) Expand all Loading... |
44 static const char kTypeScalar[]; // Type name for scalar attributes. | 46 static const char kTypeScalar[]; // Type name for scalar attributes. |
45 static const char kTypeString[]; // Type name for string attributes. | 47 static const char kTypeString[]; // Type name for string attributes. |
46 | 48 |
47 // Setters for scalar attributes. Some examples: | 49 // Setters for scalar attributes. Some examples: |
48 // - "size" column (all dumps are expected to have at least this one): | 50 // - "size" column (all dumps are expected to have at least this one): |
49 // AddScalar(kNameSize, kUnitsBytes, 1234); | 51 // AddScalar(kNameSize, kUnitsBytes, 1234); |
50 // - Some extra-column reporting internal details of the subsystem: | 52 // - Some extra-column reporting internal details of the subsystem: |
51 // AddScalar("number_of_freelist_entires", kUnitsObjects, 42) | 53 // AddScalar("number_of_freelist_entires", kUnitsObjects, 42) |
52 // - Other informational column (will not be auto-added in the UI) | 54 // - Other informational column (will not be auto-added in the UI) |
53 // AddScalarF("kittens_ratio", "ratio", 42.0f) | 55 // AddScalarF("kittens_ratio", "ratio", 42.0f) |
54 void AddScalar(const char* name, const char* units, uint64 value); | 56 void AddScalar(const char* name, const char* units, uint64_t value); |
55 void AddScalarF(const char* name, const char* units, double value); | 57 void AddScalarF(const char* name, const char* units, double value); |
56 void AddString(const char* name, const char* units, const std::string& value); | 58 void AddString(const char* name, const char* units, const std::string& value); |
57 | 59 |
58 // Absolute name, unique within the scope of an entire ProcessMemoryDump. | 60 // Absolute name, unique within the scope of an entire ProcessMemoryDump. |
59 const std::string& absolute_name() const { return absolute_name_; } | 61 const std::string& absolute_name() const { return absolute_name_; } |
60 | 62 |
61 // Called at trace generation time to populate the TracedValue. | 63 // Called at trace generation time to populate the TracedValue. |
62 void AsValueInto(TracedValue* value) const; | 64 void AsValueInto(TracedValue* value) const; |
63 | 65 |
64 // Get the ProcessMemoryDump instance that owns this. | 66 // Get the ProcessMemoryDump instance that owns this. |
(...skipping 21 matching lines...) Expand all Loading... |
86 // temporary strings on each AddScalar() call. | 88 // temporary strings on each AddScalar() call. |
87 std::string string_conversion_buffer_; | 89 std::string string_conversion_buffer_; |
88 | 90 |
89 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump); | 91 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump); |
90 }; | 92 }; |
91 | 93 |
92 } // namespace trace_event | 94 } // namespace trace_event |
93 } // namespace base | 95 } // namespace base |
94 | 96 |
95 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ | 97 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
OLD | NEW |