| 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 <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 namespace trace_event { | 18 namespace trace_event { |
| 19 | 19 |
| 20 // Captures the reason why a memory dump is being requested. This is to allow | 20 // Captures the reason why a memory dump is being requested. This is to allow |
| 21 // selective enabling of dumps, filtering and post-processing. | 21 // selective enabling of dumps, filtering and post-processing. Important: this |
| 22 // must be kept consistent with |
| 23 // services/memory_infra/public/cpp/memory_infra_traits.cc. |
| 22 enum class MemoryDumpType { | 24 enum class MemoryDumpType { |
| 23 PERIODIC_INTERVAL, // Dumping memory at periodic intervals. | 25 PERIODIC_INTERVAL, // Dumping memory at periodic intervals. |
| 24 EXPLICITLY_TRIGGERED, // Non maskable dump request. | 26 EXPLICITLY_TRIGGERED, // Non maskable dump request. |
| 25 PEAK_MEMORY_USAGE, // Dumping memory at detected peak total memory usage. | 27 PEAK_MEMORY_USAGE, // Dumping memory at detected peak total memory usage. |
| 26 LAST = PEAK_MEMORY_USAGE // For IPC macros. | 28 LAST = PEAK_MEMORY_USAGE // For IPC macros. |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 // Tells the MemoryDumpProvider(s) how much detailed their dumps should be. | 31 // Tells the MemoryDumpProvider(s) how much detailed their dumps should be. |
| 32 // Important: this must be kept consistent with |
| 33 // services/memory_infra/public/cpp/memory_infra_traits.cc. |
| 30 enum class MemoryDumpLevelOfDetail : uint32_t { | 34 enum class MemoryDumpLevelOfDetail : uint32_t { |
| 31 FIRST, | 35 FIRST, |
| 32 | 36 |
| 33 // For background tracing mode. The dump time is quick, and typically just the | 37 // For background tracing mode. The dump time is quick, and typically just the |
| 34 // totals are expected. Suballocations need not be specified. Dump name must | 38 // totals are expected. Suballocations need not be specified. Dump name must |
| 35 // contain only pre-defined strings and string arguments cannot be added. | 39 // contain only pre-defined strings and string arguments cannot be added. |
| 36 BACKGROUND = FIRST, | 40 BACKGROUND = FIRST, |
| 37 | 41 |
| 38 // For the levels below, MemoryDumpProvider instances must guarantee that the | 42 // For the levels below, MemoryDumpProvider instances must guarantee that the |
| 39 // total size reported in the root node is consistent. Only the granularity of | 43 // total size reported in the root node is consistent. Only the granularity of |
| 40 // the child MemoryAllocatorDump(s) differs with the levels. | 44 // the child MemoryAllocatorDump(s) differs with the levels. |
| 41 | 45 |
| 42 // Few entries, typically a fixed number, per dump. | 46 // Few entries, typically a fixed number, per dump. |
| 43 LIGHT, | 47 LIGHT, |
| 44 | 48 |
| 45 // Unrestricted amount of entries per dump. | 49 // Unrestricted amount of entries per dump. |
| 46 DETAILED, | 50 DETAILED, |
| 47 | 51 |
| 48 LAST = DETAILED | 52 LAST = DETAILED |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 // Initial request arguments for a global memory dump. (see | 55 // Initial request arguments for a global memory dump. (see |
| 52 // MemoryDumpManager::RequestGlobalMemoryDump()). | 56 // MemoryDumpManager::RequestGlobalMemoryDump()). Important: this must be kept |
| 57 // consistent with services/memory_infra/public/cpp/memory_infra_traits.cc. |
| 53 struct BASE_EXPORT MemoryDumpRequestArgs { | 58 struct BASE_EXPORT MemoryDumpRequestArgs { |
| 54 // Globally unique identifier. In multi-process dumps, all processes issue a | 59 // Globally unique identifier. In multi-process dumps, all processes issue a |
| 55 // local dump with the same guid. This allows the trace importers to | 60 // local dump with the same guid. This allows the trace importers to |
| 56 // reconstruct the global dump. | 61 // reconstruct the global dump. |
| 57 uint64_t dump_guid; | 62 uint64_t dump_guid; |
| 58 | 63 |
| 59 MemoryDumpType dump_type; | 64 MemoryDumpType dump_type; |
| 60 MemoryDumpLevelOfDetail level_of_detail; | 65 MemoryDumpLevelOfDetail level_of_detail; |
| 61 }; | 66 }; |
| 62 | 67 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 76 BASE_EXPORT const char* MemoryDumpLevelOfDetailToString( | 81 BASE_EXPORT const char* MemoryDumpLevelOfDetailToString( |
| 77 const MemoryDumpLevelOfDetail& level_of_detail); | 82 const MemoryDumpLevelOfDetail& level_of_detail); |
| 78 | 83 |
| 79 BASE_EXPORT MemoryDumpLevelOfDetail | 84 BASE_EXPORT MemoryDumpLevelOfDetail |
| 80 StringToMemoryDumpLevelOfDetail(const std::string& str); | 85 StringToMemoryDumpLevelOfDetail(const std::string& str); |
| 81 | 86 |
| 82 } // namespace trace_event | 87 } // namespace trace_event |
| 83 } // namespace base | 88 } // namespace base |
| 84 | 89 |
| 85 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ | 90 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_REQUEST_ARGS_H_ |
| OLD | NEW |