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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // Define COUNT_RESIDENT_BYTES_SUPPORTED if platform supports counting of the | 25 // Define COUNT_RESIDENT_BYTES_SUPPORTED if platform supports counting of the |
26 // resident memory. | 26 // resident memory. |
27 #if (defined(OS_POSIX) && !defined(OS_NACL)) || defined(OS_WIN) | 27 #if (defined(OS_POSIX) && !defined(OS_NACL)) || defined(OS_WIN) |
28 #define COUNT_RESIDENT_BYTES_SUPPORTED | 28 #define COUNT_RESIDENT_BYTES_SUPPORTED |
29 #endif | 29 #endif |
30 | 30 |
31 namespace base { | 31 namespace base { |
32 namespace trace_event { | 32 namespace trace_event { |
33 | 33 |
| 34 class AllocationRegister; |
34 class MemoryDumpSessionState; | 35 class MemoryDumpSessionState; |
35 class TracedValue; | 36 class TracedValue; |
36 | 37 |
37 // ProcessMemoryDump is as a strongly typed container which holds the dumps | 38 // ProcessMemoryDump is as a strongly typed container which holds the dumps |
38 // produced by the MemoryDumpProvider(s) for a specific process. | 39 // produced by the MemoryDumpProvider(s) for a specific process. |
39 class BASE_EXPORT ProcessMemoryDump { | 40 class BASE_EXPORT ProcessMemoryDump { |
40 public: | 41 public: |
41 struct MemoryAllocatorDumpEdge { | 42 struct MemoryAllocatorDumpEdge { |
42 MemoryAllocatorDumpGuid source; | 43 MemoryAllocatorDumpGuid source; |
43 MemoryAllocatorDumpGuid target; | 44 MemoryAllocatorDumpGuid target; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 const MemoryAllocatorDumpGuid& guid); | 112 const MemoryAllocatorDumpGuid& guid); |
112 | 113 |
113 // Looks up a shared MemoryAllocatorDump given its guid. | 114 // Looks up a shared MemoryAllocatorDump given its guid. |
114 MemoryAllocatorDump* GetSharedGlobalAllocatorDump( | 115 MemoryAllocatorDump* GetSharedGlobalAllocatorDump( |
115 const MemoryAllocatorDumpGuid& guid) const; | 116 const MemoryAllocatorDumpGuid& guid) const; |
116 | 117 |
117 // Returns the map of the MemoryAllocatorDumps added to this dump. | 118 // Returns the map of the MemoryAllocatorDumps added to this dump. |
118 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } | 119 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } |
119 | 120 |
120 // Dumps heap usage with |allocator_name|. | 121 // Dumps heap usage with |allocator_name|. |
121 void DumpHeapUsage(const base::hash_map<base::trace_event::AllocationContext, | 122 void DumpHeapUsage(const AllocationRegister& allocation_register, |
122 base::trace_event::AllocationMetrics>& | |
123 metrics_by_context, | |
124 base::trace_event::TraceEventMemoryOverhead& overhead, | |
125 const char* allocator_name); | 123 const char* allocator_name); |
126 | 124 |
127 // Adds an ownership relationship between two MemoryAllocatorDump(s) with the | 125 // Adds an ownership relationship between two MemoryAllocatorDump(s) with the |
128 // semantics: |source| owns |target|, and has the effect of attributing | 126 // semantics: |source| owns |target|, and has the effect of attributing |
129 // the memory usage of |target| to |source|. |importance| is optional and | 127 // the memory usage of |target| to |source|. |importance| is optional and |
130 // relevant only for the cases of co-ownership, where it acts as a z-index: | 128 // relevant only for the cases of co-ownership, where it acts as a z-index: |
131 // the owner with the highest importance will be attributed |target|'s memory. | 129 // the owner with the highest importance will be attributed |target|'s memory. |
132 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, | 130 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, |
133 const MemoryAllocatorDumpGuid& target, | 131 const MemoryAllocatorDumpGuid& target, |
134 int importance); | 132 int importance); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // background mode are disabled for testing. | 211 // background mode are disabled for testing. |
214 static bool is_black_hole_non_fatal_for_testing_; | 212 static bool is_black_hole_non_fatal_for_testing_; |
215 | 213 |
216 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 214 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
217 }; | 215 }; |
218 | 216 |
219 } // namespace trace_event | 217 } // namespace trace_event |
220 } // namespace base | 218 } // namespace base |
221 | 219 |
222 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 220 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
OLD | NEW |