| 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_PROCESS_MEMORY_DUMP_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
| 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/containers/small_map.h" | 10 #include "base/containers/small_map.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 bool has_process_totals() const { return has_process_totals_; } | 45 bool has_process_totals() const { return has_process_totals_; } |
| 46 void set_has_process_totals() { has_process_totals_ = true; } | 46 void set_has_process_totals() { has_process_totals_ = true; } |
| 47 | 47 |
| 48 ProcessMemoryMaps* process_mmaps() { return &process_mmaps_; } | 48 ProcessMemoryMaps* process_mmaps() { return &process_mmaps_; } |
| 49 bool has_process_mmaps() const { return has_process_mmaps_; } | 49 bool has_process_mmaps() const { return has_process_mmaps_; } |
| 50 void set_has_process_mmaps() { has_process_mmaps_ = true; } | 50 void set_has_process_mmaps() { has_process_mmaps_ = true; } |
| 51 | 51 |
| 52 // Creates a new MemoryAllocatorDump with the given name and returns the | 52 // Creates a new MemoryAllocatorDump with the given name and returns the |
| 53 // empty object back to the caller. | 53 // empty object back to the caller. |
| 54 // Arguments: | 54 // Arguments: |
| 55 // allocator_name: a name that univocally identifies allocator dumps | 55 // absolute_name: a name that uniquely identifies allocator dumps produced |
| 56 // produced by this provider. It acts as a type w.r.t. the allocator | 56 // by this provider. It is possible to specify nesting by using a |
| 57 // attributes, in the sense that all the MAD with the same allocator_name | 57 // path-like string (e.g., v8/isolate1/heap1, v8/isolate1/heap2). |
| 58 // are expected to have the same attributes. | 58 // Leading or trailing slashes are not allowed. |
| 59 // heap_name, either: | |
| 60 // - kRootHeap: if the allocator has only one default heap. | |
| 61 // - a string identifing a heap name (e.g., isolate1, isolate2 ...). It is | |
| 62 // possible to specify nesting by using a path-like string (e.g., | |
| 63 // isolate1/heap_spaceX, isolate1/heap_spaceY, isolate2/heap_spaceX). | |
| 64 // The tuple (|allocator_name|, |heap_name|) is unique inside a PMD. | |
| 65 // ProcessMemoryDump handles the memory ownership of its MemoryAllocatorDumps. | 59 // ProcessMemoryDump handles the memory ownership of its MemoryAllocatorDumps. |
| 66 MemoryAllocatorDump* CreateAllocatorDump(const std::string& allocator_name, | 60 MemoryAllocatorDump* CreateAllocatorDump(const std::string& absolute_name); |
| 67 const std::string& heap_name); | |
| 68 | 61 |
| 69 // Looks up a MemoryAllocatorDump given its allocator and heap names, or | 62 // Looks up a MemoryAllocatorDump given its allocator and heap names, or |
| 70 // nullptr if not found. | 63 // nullptr if not found. |
| 71 MemoryAllocatorDump* GetAllocatorDump(const std::string& allocator_name, | 64 MemoryAllocatorDump* GetAllocatorDump(const std::string& absolute_name) const; |
| 72 const std::string& heap_name) const; | |
| 73 | 65 |
| 74 // Returns the map of the MemoryAllocatorDumps added to this dump. | 66 // Returns the map of the MemoryAllocatorDumps added to this dump. |
| 75 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } | 67 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } |
| 76 | 68 |
| 77 const scoped_refptr<MemoryDumpSessionState>& session_state() const { | 69 const scoped_refptr<MemoryDumpSessionState>& session_state() const { |
| 78 return session_state_; | 70 return session_state_; |
| 79 } | 71 } |
| 80 | 72 |
| 81 private: | 73 private: |
| 82 ProcessMemoryTotals process_totals_; | 74 ProcessMemoryTotals process_totals_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 // State shared among all PMDs instances created in a given trace session. | 85 // State shared among all PMDs instances created in a given trace session. |
| 94 scoped_refptr<MemoryDumpSessionState> session_state_; | 86 scoped_refptr<MemoryDumpSessionState> session_state_; |
| 95 | 87 |
| 96 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 88 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
| 97 }; | 89 }; |
| 98 | 90 |
| 99 } // namespace trace_event | 91 } // namespace trace_event |
| 100 } // namespace base | 92 } // namespace base |
| 101 | 93 |
| 102 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 94 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
| OLD | NEW |