Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 // In most cases, the two are the same. | 60 // In most cases, the two are the same. |
| 61 static size_t GetSystemPageSize(); | 61 static size_t GetSystemPageSize(); |
| 62 | 62 |
| 63 // Returns the total bytes resident for a virtual address range, with given | 63 // Returns the total bytes resident for a virtual address range, with given |
| 64 // |start_address| and |mapped_size|. |mapped_size| is specified in bytes. The | 64 // |start_address| and |mapped_size|. |mapped_size| is specified in bytes. The |
| 65 // value returned is valid only if the given range is currently mmapped by the | 65 // value returned is valid only if the given range is currently mmapped by the |
| 66 // process. The |start_address| must be page-aligned. | 66 // process. The |start_address| must be page-aligned. |
| 67 static size_t CountResidentBytes(void* start_address, size_t mapped_size); | 67 static size_t CountResidentBytes(void* start_address, size_t mapped_size); |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 ProcessMemoryDump(scoped_refptr<MemoryDumpSessionState> session_state); | 70 ProcessMemoryDump(scoped_refptr<MemoryDumpSessionState> session_state, |
| 71 MemoryDumpLevelOfDetail level_of_detail); | |
|
Primiano Tucci (use gerrit)
2016/05/27 17:23:35
Oh right now you need the args here, makes sense.
ssid
2016/05/27 17:42:48
Yes I was thinking the same. Removing the args fro
ssid
2016/05/31 22:33:20
I think this change warrents for removal of the ar
| |
| 71 ~ProcessMemoryDump(); | 72 ~ProcessMemoryDump(); |
| 72 | 73 |
| 73 // Creates a new MemoryAllocatorDump with the given name and returns the | 74 // Creates a new MemoryAllocatorDump with the given name and returns the |
| 74 // empty object back to the caller. | 75 // empty object back to the caller. |
| 75 // Arguments: | 76 // Arguments: |
| 76 // absolute_name: a name that uniquely identifies allocator dumps produced | 77 // absolute_name: a name that uniquely identifies allocator dumps produced |
| 77 // by this provider. It is possible to specify nesting by using a | 78 // by this provider. It is possible to specify nesting by using a |
| 78 // path-like string (e.g., v8/isolate1/heap1, v8/isolate1/heap2). | 79 // path-like string (e.g., v8/isolate1/heap1, v8/isolate1/heap2). |
| 79 // Leading or trailing slashes are not allowed. | 80 // Leading or trailing slashes are not allowed. |
| 80 // guid: an optional identifier, unique among all processes within the | 81 // guid: an optional identifier, unique among all processes within the |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 ProcessMemoryTotals* process_totals() { return &process_totals_; } | 177 ProcessMemoryTotals* process_totals() { return &process_totals_; } |
| 177 bool has_process_totals() const { return has_process_totals_; } | 178 bool has_process_totals() const { return has_process_totals_; } |
| 178 void set_has_process_totals() { has_process_totals_ = true; } | 179 void set_has_process_totals() { has_process_totals_ = true; } |
| 179 | 180 |
| 180 ProcessMemoryMaps* process_mmaps() { return &process_mmaps_; } | 181 ProcessMemoryMaps* process_mmaps() { return &process_mmaps_; } |
| 181 bool has_process_mmaps() const { return has_process_mmaps_; } | 182 bool has_process_mmaps() const { return has_process_mmaps_; } |
| 182 void set_has_process_mmaps() { has_process_mmaps_ = true; } | 183 void set_has_process_mmaps() { has_process_mmaps_ = true; } |
| 183 | 184 |
| 184 const HeapDumpsMap& heap_dumps() const { return heap_dumps_; } | 185 const HeapDumpsMap& heap_dumps() const { return heap_dumps_; } |
| 185 | 186 |
| 187 MemoryDumpLevelOfDetail level_of_detail() const { return level_of_detail_; } | |
| 188 | |
| 186 private: | 189 private: |
| 190 FRIEND_TEST_ALL_PREFIXES(ProcessMemoryDumpTest, BackgroundModeTest); | |
| 187 MemoryAllocatorDump* AddAllocatorDumpInternal( | 191 MemoryAllocatorDump* AddAllocatorDumpInternal( |
| 188 std::unique_ptr<MemoryAllocatorDump> mad); | 192 std::unique_ptr<MemoryAllocatorDump> mad); |
| 189 | 193 |
| 190 ProcessMemoryTotals process_totals_; | 194 ProcessMemoryTotals process_totals_; |
| 191 bool has_process_totals_; | 195 bool has_process_totals_; |
| 192 | 196 |
| 193 ProcessMemoryMaps process_mmaps_; | 197 ProcessMemoryMaps process_mmaps_; |
| 194 bool has_process_mmaps_; | 198 bool has_process_mmaps_; |
| 195 | 199 |
| 196 AllocatorDumpsMap allocator_dumps_; | 200 AllocatorDumpsMap allocator_dumps_; |
| 197 HeapDumpsMap heap_dumps_; | 201 HeapDumpsMap heap_dumps_; |
| 198 | 202 |
| 199 // State shared among all PMDs instances created in a given trace session. | 203 // State shared among all PMDs instances created in a given trace session. |
| 200 scoped_refptr<MemoryDumpSessionState> session_state_; | 204 scoped_refptr<MemoryDumpSessionState> session_state_; |
| 201 | 205 |
| 202 // Keeps track of relationships between MemoryAllocatorDump(s). | 206 // Keeps track of relationships between MemoryAllocatorDump(s). |
| 203 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; | 207 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; |
| 204 | 208 |
| 209 // Level of detail of the current dump. | |
| 210 const MemoryDumpLevelOfDetail level_of_detail_; | |
| 211 | |
| 212 // This dummy allocator dump is returned when an invalid dump is created in | |
| 213 // background mode. The attributes of the dump are not added to the trace. | |
| 214 std::unique_ptr<MemoryAllocatorDump> dummy_mad_; | |
|
Primiano Tucci (use gerrit)
2016/05/27 17:23:35
dummy feels it is for test, it's not the case.
May
ssid
2016/05/31 22:33:20
Done.
| |
| 215 | |
| 216 // When non-null, only the strings matching this name are whitelisted for | |
| 217 // background mode. | |
| 218 const char* whitelisted_name_for_testing_; | |
|
Primiano Tucci (use gerrit)
2016/05/27 17:23:35
can we move this to the memory_infra_background_wh
ssid
2016/05/27 17:42:48
Okay I will make this change in this CL, while the
ssid
2016/05/31 22:33:20
Done.
| |
| 219 | |
| 205 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 220 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
| 206 }; | 221 }; |
| 207 | 222 |
| 208 } // namespace trace_event | 223 } // namespace trace_event |
| 209 } // namespace base | 224 } // namespace base |
| 210 | 225 |
| 211 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 226 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
| OLD | NEW |