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.
5 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
10 #include "base/logging.h"
11 #include "base/trace_event/memory_allocator_attributes.h"
12 #include "base/values.h"
15 namespace trace_event
{
17 class MemoryDumpManager
;
20 // Data model for user-land memory allocator dumps.
21 class BASE_EXPORT MemoryAllocatorDump
{
23 MemoryAllocatorDump(const std::string
& name
, MemoryAllocatorDump
* parent
);
24 ~MemoryAllocatorDump();
26 const std::string
& name() const { return name_
; }
27 const MemoryAllocatorDump
* parent() const { return parent_
; }
29 void set_physical_size_in_bytes(uint64 value
) {
30 physical_size_in_bytes_
= value
;
32 uint64
physical_size_in_bytes() const { return physical_size_in_bytes_
; }
34 void set_allocated_objects_count(uint64 value
) {
35 allocated_objects_count_
= value
;
37 uint64
allocated_objects_count() const { return allocated_objects_count_
; }
39 void set_allocated_objects_size_in_bytes(uint64 value
) {
40 allocated_objects_size_in_bytes_
= value
;
42 uint64
allocated_objects_size_in_bytes() const {
43 return allocated_objects_size_in_bytes_
;
46 void SetExtraAttribute(const std::string
& name
, int value
);
47 int GetExtraIntegerAttribute(const std::string
& name
) const;
49 // Called at trace generation time to populate the TracedValue.
50 void AsValueInto(TracedValue
* value
) const;
53 const std::string name_
;
54 MemoryAllocatorDump
* const parent_
; // Not owned.
55 uint64 physical_size_in_bytes_
;
56 uint64 allocated_objects_count_
;
57 uint64 allocated_objects_size_in_bytes_
;
58 DictionaryValue extra_attributes_
;
60 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump
);
63 } // namespace trace_event
66 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_