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_MEMORY_DUMP_REQUEST_ARGS_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ |
7 | 7 |
8 // This file defines the types and structs used to issue memory dump requests. | 8 // This file defines the types and structs used to issue memory dump requests. |
9 // These are also used in the IPCs for coordinating inter-process memory dumps. | 9 // These are also used in the IPCs for coordinating inter-process memory dumps. |
10 | 10 |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 #include <map> | |
12 #include <string> | 13 #include <string> |
13 | 14 |
14 #include "base/base_export.h" | 15 #include "base/base_export.h" |
15 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/process/process_handle.h" | |
16 | 18 |
17 namespace base { | 19 namespace base { |
18 namespace trace_event { | 20 namespace trace_event { |
19 | 21 |
20 // Captures the reason why a memory dump is being requested. This is to allow | 22 // Captures the reason why a memory dump is being requested. This is to allow |
21 // selective enabling of dumps, filtering and post-processing. Important: this | 23 // selective enabling of dumps, filtering and post-processing. Important: this |
22 // must be kept consistent with | 24 // must be kept consistent with |
23 // services/resource_coordinator/public/cpp/memory/memory_infra_traits.cc. | 25 // services/resource_coordinator/public/cpp/memory/memory_infra_traits.cc. |
24 enum class MemoryDumpType { | 26 enum class MemoryDumpType { |
25 PERIODIC_INTERVAL, // Dumping memory at periodic intervals. | 27 PERIODIC_INTERVAL, // Dumping memory at periodic intervals. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 MemoryDumpLevelOfDetail level_of_detail; | 67 MemoryDumpLevelOfDetail level_of_detail; |
66 }; | 68 }; |
67 | 69 |
68 // Args for ProcessMemoryDump and passed to OnMemoryDump calls for memory dump | 70 // Args for ProcessMemoryDump and passed to OnMemoryDump calls for memory dump |
69 // providers. Dump providers are expected to read the args for creating dumps. | 71 // providers. Dump providers are expected to read the args for creating dumps. |
70 struct MemoryDumpArgs { | 72 struct MemoryDumpArgs { |
71 // Specifies how detailed the dumps should be. | 73 // Specifies how detailed the dumps should be. |
72 MemoryDumpLevelOfDetail level_of_detail; | 74 MemoryDumpLevelOfDetail level_of_detail; |
73 }; | 75 }; |
74 | 76 |
77 struct MemoryDumpCallbackResult { | |
Primiano Tucci (use gerrit)
2017/03/21 15:26:06
maybe add a comment explaiing what this will be fo
| |
78 struct OSMemDump { | |
79 uint32_t pss_kb; | |
80 uint32_t private_dirty; | |
Primiano Tucci (use gerrit)
2017/03/21 15:26:06
+kb
| |
81 }; | |
82 struct ChromeMemDump { | |
83 uint32_t malloc_total_kb; | |
84 uint32_t partition_alloc_total_kb; | |
85 uint32_t blink_gc_total_kb; | |
86 uint32_t v8_total_kb; | |
87 }; | |
88 | |
89 // These are for the current process. | |
90 OSMemDump os_dump; | |
91 ChromeMemDump chrome_dump; | |
92 | |
93 // This is optional and is used only in one case (Linux desktop) by the | |
94 // browser process, when it needs to communicate the details of the | |
95 // OSMemDump of other processes. | |
96 std::map<ProcessId, OSMemDump> os_dump_for_child_processes; | |
Primiano Tucci (use gerrit)
2017/03/21 15:26:06
maybe call this |extra_processes_dump|
base is no
| |
97 | |
98 MemoryDumpCallbackResult(); | |
99 ~MemoryDumpCallbackResult(); | |
100 }; | |
101 | |
75 using MemoryDumpCallback = Callback<void(uint64_t dump_guid, bool success)>; | 102 using MemoryDumpCallback = Callback<void(uint64_t dump_guid, bool success)>; |
76 | 103 |
77 BASE_EXPORT const char* MemoryDumpTypeToString(const MemoryDumpType& dump_type); | 104 BASE_EXPORT const char* MemoryDumpTypeToString(const MemoryDumpType& dump_type); |
78 | 105 |
79 BASE_EXPORT MemoryDumpType StringToMemoryDumpType(const std::string& str); | 106 BASE_EXPORT MemoryDumpType StringToMemoryDumpType(const std::string& str); |
80 | 107 |
81 BASE_EXPORT const char* MemoryDumpLevelOfDetailToString( | 108 BASE_EXPORT const char* MemoryDumpLevelOfDetailToString( |
82 const MemoryDumpLevelOfDetail& level_of_detail); | 109 const MemoryDumpLevelOfDetail& level_of_detail); |
83 | 110 |
84 BASE_EXPORT MemoryDumpLevelOfDetail | 111 BASE_EXPORT MemoryDumpLevelOfDetail |
85 StringToMemoryDumpLevelOfDetail(const std::string& str); | 112 StringToMemoryDumpLevelOfDetail(const std::string& str); |
86 | 113 |
87 } // namespace trace_event | 114 } // namespace trace_event |
88 } // namespace base | 115 } // namespace base |
89 | 116 |
90 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ | 117 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ |
OLD | NEW |