| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Looks up a shared MemoryAllocatorDump given its guid. | 112 // Looks up a shared MemoryAllocatorDump given its guid. |
| 113 MemoryAllocatorDump* GetSharedGlobalAllocatorDump( | 113 MemoryAllocatorDump* GetSharedGlobalAllocatorDump( |
| 114 const MemoryAllocatorDumpGuid& guid) const; | 114 const MemoryAllocatorDumpGuid& guid) const; |
| 115 | 115 |
| 116 // Returns the map of the MemoryAllocatorDumps added to this dump. | 116 // Returns the map of the MemoryAllocatorDumps added to this dump. |
| 117 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } | 117 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } |
| 118 | 118 |
| 119 // Adds a heap dump for the allocator with |absolute_name|. The |TracedValue| | 119 // Adds a heap dump for the allocator with |absolute_name|. The |TracedValue| |
| 120 // must have the correct format. |trace_event::HeapDumper| will generate such | 120 // must have the correct format. |trace_event::HeapDumper| will generate such |
| 121 // a value from a |trace_event::AllocationRegister|. | 121 // a value from a |trace_event::AllocationRegister|. |
| 122 // TODO(bashi): Remove this when WebMemoryDumpProvider is gone. |
| 123 // http://crbug.com/605822 |
| 122 void AddHeapDump(const std::string& absolute_name, | 124 void AddHeapDump(const std::string& absolute_name, |
| 123 std::unique_ptr<TracedValue> heap_dump); | 125 std::unique_ptr<TracedValue> heap_dump); |
| 124 | 126 |
| 127 // Dumps heap usage with |allocator_name|. |
| 128 void DumpHeapUsage(const base::hash_map<base::trace_event::AllocationContext, |
| 129 base::trace_event::AllocationMetrics>& |
| 130 metrics_by_context, |
| 131 base::trace_event::TraceEventMemoryOverhead& overhead, |
| 132 const char* allocator_name); |
| 133 |
| 125 // Adds an ownership relationship between two MemoryAllocatorDump(s) with the | 134 // Adds an ownership relationship between two MemoryAllocatorDump(s) with the |
| 126 // semantics: |source| owns |target|, and has the effect of attributing | 135 // semantics: |source| owns |target|, and has the effect of attributing |
| 127 // the memory usage of |target| to |source|. |importance| is optional and | 136 // the memory usage of |target| to |source|. |importance| is optional and |
| 128 // relevant only for the cases of co-ownership, where it acts as a z-index: | 137 // relevant only for the cases of co-ownership, where it acts as a z-index: |
| 129 // the owner with the highest importance will be attributed |target|'s memory. | 138 // the owner with the highest importance will be attributed |target|'s memory. |
| 130 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, | 139 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, |
| 131 const MemoryAllocatorDumpGuid& target, | 140 const MemoryAllocatorDumpGuid& target, |
| 132 int importance); | 141 int importance); |
| 133 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, | 142 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, |
| 134 const MemoryAllocatorDumpGuid& target); | 143 const MemoryAllocatorDumpGuid& target); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // Keeps track of relationships between MemoryAllocatorDump(s). | 202 // Keeps track of relationships between MemoryAllocatorDump(s). |
| 194 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; | 203 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; |
| 195 | 204 |
| 196 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 205 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
| 197 }; | 206 }; |
| 198 | 207 |
| 199 } // namespace trace_event | 208 } // namespace trace_event |
| 200 } // namespace base | 209 } // namespace base |
| 201 | 210 |
| 202 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 211 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
| OLD | NEW |