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

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

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 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
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_allocator_dump.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/trace_event/memory_allocator_dump_guid.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 13
13 namespace base { 14 namespace base {
14 namespace trace_event { 15 namespace trace_event {
15 16
16 class MemoryDumpManager; 17 class MemoryDumpManager;
17 class ProcessMemoryDump; 18 class ProcessMemoryDump;
18 class TracedValue; 19 class TracedValue;
19 20
20 // Data model for user-land memory allocator dumps. 21 // Data model for user-land memory allocator dumps.
21 class BASE_EXPORT MemoryAllocatorDump { 22 class BASE_EXPORT MemoryAllocatorDump {
22 public: 23 public:
23 // MemoryAllocatorDump is owned by ProcessMemoryDump. 24 // MemoryAllocatorDump is owned by ProcessMemoryDump.
24 MemoryAllocatorDump(const std::string& absolute_name, 25 MemoryAllocatorDump(const std::string& absolute_name,
26 ProcessMemoryDump* process_memory_dump,
27 const MemoryAllocatorDumpGuid& guid);
28 MemoryAllocatorDump(const std::string& absolute_name,
25 ProcessMemoryDump* process_memory_dump); 29 ProcessMemoryDump* process_memory_dump);
26 ~MemoryAllocatorDump(); 30 ~MemoryAllocatorDump();
27 31
32 // Standard attribute name to model allocated space.
33 static const char kNameSize[];
34
28 // Standard attribute name to model total space requested by the allocator 35 // Standard attribute name to model total space requested by the allocator
29 // (e.g., amount of pages requested to the system). 36 // (e.g., amount of pages requested to the system).
30 static const char kNameOuterSize[]; 37 static const char kNameOuterSize[];
31 38
32 // Standard attribute name to model space for allocated objects, without 39 // Standard attribute name to model space for allocated objects, without
33 // taking into account allocator metadata or fragmentation. 40 // taking into account allocator metadata or fragmentation.
34 static const char kNameInnerSize[]; 41 static const char kNameInnerSize[];
35 42
36 // Standard attribute name to model the number of objects allocated. 43 // Standard attribute name to model the number of objects allocated.
37 static const char kNameObjectsCount[]; 44 static const char kNameObjectsCount[];
(...skipping 11 matching lines...) Expand all
49 const char* type, 56 const char* type,
50 const char* units, 57 const char* units,
51 scoped_ptr<Value> value); 58 scoped_ptr<Value> value);
52 bool Get(const std::string& name, 59 bool Get(const std::string& name,
53 const char** out_type, 60 const char** out_type,
54 const char** out_units, 61 const char** out_units,
55 const Value** out_value) const; 62 const Value** out_value) const;
56 63
57 // Helper setter for scalar attributes. 64 // Helper setter for scalar attributes.
58 void AddScalar(const std::string& name, const char* units, uint64 value); 65 void AddScalar(const std::string& name, const char* units, uint64 value);
66 void AddScalarF(const std::string& name, const char* units, double value);
59 void AddString(const std::string& name, 67 void AddString(const std::string& name,
60 const char* units, 68 const char* units,
61 const std::string& value); 69 const std::string& value);
62 70
63 // Called at trace generation time to populate the TracedValue. 71 // Called at trace generation time to populate the TracedValue.
64 void AsValueInto(TracedValue* value) const; 72 void AsValueInto(TracedValue* value) const;
65 73
66 // Get the ProcessMemoryDump instance that owns this. 74 // Get the ProcessMemoryDump instance that owns this.
67 ProcessMemoryDump* process_memory_dump() const { 75 ProcessMemoryDump* process_memory_dump() const {
68 return process_memory_dump_; 76 return process_memory_dump_;
69 } 77 }
70 78
79 // |guid| is an optional global dump identifier, unique across all processes
80 // within the scope of a global dump. It is only required when using the
81 // graph APIs (see TODO_method_name) to express retention / suballocation or
82 // cross process sharing. See crbug.com/492102 for design docs.
83 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are
84 // expected to have the same guid.
85 const MemoryAllocatorDumpGuid& guid() const { return guid_; }
86
71 private: 87 private:
72 const std::string absolute_name_; 88 const std::string absolute_name_;
73 ProcessMemoryDump* const process_memory_dump_; // Not owned (PMD owns this). 89 ProcessMemoryDump* const process_memory_dump_; // Not owned (PMD owns this).
74 DictionaryValue attributes_; 90 DictionaryValue attributes_;
91 MemoryAllocatorDumpGuid guid_;
75 92
76 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump); 93 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump);
77 }; 94 };
78 95
79 } // namespace trace_event 96 } // namespace trace_event
80 } // namespace base 97 } // namespace base
81 98
82 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ 99 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
OLDNEW
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_allocator_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698