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

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

Issue 987043003: [tracing] Introduce support for userland memory allocators dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mmaps_en
Patch Set: Created 5 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
7
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
10 #include "base/trace_event/memory_allocator_attributes.h"
11 #include "base/values.h"
12
13 namespace base {
14 namespace trace_event {
15
16 class MemoryDumpManager;
17 class TracedValue;
18
19 // Data model for user-land memory allocator dumps.
20 class BASE_EXPORT MemoryAllocatorDump {
21 public:
22 MemoryAllocatorDump(const std::string& name, MemoryAllocatorDump* parent);
23 ~MemoryAllocatorDump();
24
25 const std::string& name() const { return name_; }
26 const MemoryAllocatorDump* parent() const { return parent_; }
27
28 void set_physical_size_in_bytes(uint64 value) {
29 physical_size_in_bytes_ = value;
30 }
31 uint64 physical_size_in_bytes() const { return physical_size_in_bytes_; }
32
33 void set_allocated_objects_count(uint64 value) {
34 allocated_objects_count_ = value;
35 }
36 uint64 allocated_objects_count() const { return allocated_objects_count_; }
37
38 void set_allocated_objects_size_in_bytes(uint64 value) {
39 allocated_objects_size_in_bytes_ = value;
40 }
41 uint64 allocated_objects_size_in_bytes() const {
42 return allocated_objects_size_in_bytes_;
43 }
44
45 const DictionaryValue& extra_attributes() const { return extra_attributes_; }
nduca 2015/03/12 04:04:10 i wonder if there's a way to do this that would be
Primiano Tucci (use gerrit) 2015/03/13 19:39:07 Ok, I simplified a lot the extra_attributes logic.
46 DictionaryValue& extra_attributes() { return extra_attributes_; }
47
48 // Called at trace generation time to populate the TracedValue.
49 void AsValueInto(TracedValue* value) const;
50
51 protected:
52 friend class MemoryDumpManager;
53 void set_extra_attributes_types(
54 scoped_refptr<MemoryAllocatorDeclaredAttributes> types) {
55 extra_attributes_types_ = types;
56 }
57
58 private:
59 const std::string name_;
60 MemoryAllocatorDump* const parent_; // Not owned.
61 uint64 physical_size_in_bytes_;
62 uint64 allocated_objects_count_;
63 uint64 allocated_objects_size_in_bytes_;
64 DictionaryValue extra_attributes_;
65
66 // TODO(primiano): remove this once crbug.com/466121 gets fixed.
67 scoped_refptr<MemoryAllocatorDeclaredAttributes> extra_attributes_types_;
68
69 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump);
70 };
71
72 } // namespace trace_event
73 } // namespace base
74
75 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698