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_MANAGER_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const MemoryDumpCallback& callback); | 108 const MemoryDumpCallback& callback); |
109 | 109 |
110 // Same as above (still asynchronous), but without callback. | 110 // Same as above (still asynchronous), but without callback. |
111 void RequestGlobalDump(MemoryDumpType dump_type, | 111 void RequestGlobalDump(MemoryDumpType dump_type, |
112 MemoryDumpLevelOfDetail level_of_detail); | 112 MemoryDumpLevelOfDetail level_of_detail); |
113 | 113 |
114 // TraceLog::EnabledStateObserver implementation. | 114 // TraceLog::EnabledStateObserver implementation. |
115 void OnTraceLogEnabled() override; | 115 void OnTraceLogEnabled() override; |
116 void OnTraceLogDisabled() override; | 116 void OnTraceLogDisabled() override; |
117 | 117 |
| 118 // Returns true if the dump mode is allowed for current tracing session. |
| 119 bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode) const; |
| 120 |
118 // Returns the MemoryDumpSessionState object, which is shared by all the | 121 // Returns the MemoryDumpSessionState object, which is shared by all the |
119 // ProcessMemoryDump and MemoryAllocatorDump instances through all the tracing | 122 // ProcessMemoryDump and MemoryAllocatorDump instances through all the tracing |
120 // session lifetime. | 123 // session lifetime. |
121 const scoped_refptr<MemoryDumpSessionState>& session_state() const { | 124 const scoped_refptr<MemoryDumpSessionState>& session_state() const { |
122 return session_state_; | 125 return session_state_; |
123 } | 126 } |
124 | 127 |
125 // Returns a unique id for identifying the processes. The id can be | 128 // Returns a unique id for identifying the processes. The id can be |
126 // retrieved by child processes only when tracing is enabled. This is | 129 // retrieved by child processes only when tracing is enabled. This is |
127 // intended to express cross-process sharing of memory dumps on the | 130 // intended to express cross-process sharing of memory dumps on the |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 const scoped_refptr<SingleThreadTaskRunner> dump_thread_task_runner; | 268 const scoped_refptr<SingleThreadTaskRunner> dump_thread_task_runner; |
266 | 269 |
267 private: | 270 private: |
268 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDumpAsyncState); | 271 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDumpAsyncState); |
269 }; | 272 }; |
270 | 273 |
271 // Sets up periodic memory dump timers to start global dump requests based on | 274 // Sets up periodic memory dump timers to start global dump requests based on |
272 // the dump triggers from trace config. | 275 // the dump triggers from trace config. |
273 class BASE_EXPORT PeriodicGlobalDumpTimer { | 276 class BASE_EXPORT PeriodicGlobalDumpTimer { |
274 public: | 277 public: |
275 PeriodicGlobalDumpTimer(); | 278 explicit PeriodicGlobalDumpTimer(MemoryDumpManager* mdm); |
276 ~PeriodicGlobalDumpTimer(); | 279 ~PeriodicGlobalDumpTimer(); |
277 | 280 |
278 void Start(const std::vector<TraceConfig::MemoryDumpConfig::Trigger>& | 281 void Start(const std::vector<TraceConfig::MemoryDumpConfig::Trigger>& |
279 triggers_list); | 282 triggers_list); |
280 void Stop(); | 283 void Stop(); |
281 | 284 |
282 bool IsRunning(); | 285 bool IsRunning(); |
283 | 286 |
284 private: | 287 private: |
285 // Periodically called by the timer. | 288 // Periodically called by the timer. |
286 void RequestPeriodicGlobalDump(); | 289 void RequestPeriodicGlobalDump(); |
287 | 290 |
| 291 MemoryDumpManager* mdm_; |
| 292 |
288 RepeatingTimer timer_; | 293 RepeatingTimer timer_; |
289 uint32_t periodic_dumps_count_; | 294 uint32_t periodic_dumps_count_; |
290 uint32_t light_dump_rate_; | 295 uint32_t light_dump_rate_; |
291 uint32_t heavy_dump_rate_; | 296 uint32_t heavy_dump_rate_; |
292 | 297 |
293 DISALLOW_COPY_AND_ASSIGN(PeriodicGlobalDumpTimer); | 298 DISALLOW_COPY_AND_ASSIGN(PeriodicGlobalDumpTimer); |
294 }; | 299 }; |
295 | 300 |
296 static const int kMaxConsecutiveFailuresCount; | 301 static const int kMaxConsecutiveFailuresCount; |
297 static const char* const kSystemAllocatorPoolName; | 302 static const char* const kSystemAllocatorPoolName; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 401 } |
397 | 402 |
398 private: | 403 private: |
399 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); | 404 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
400 }; | 405 }; |
401 | 406 |
402 } // namespace trace_event | 407 } // namespace trace_event |
403 } // namespace base | 408 } // namespace base |
404 | 409 |
405 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 410 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
OLD | NEW |