Index: base/trace_event/memory_dump_provider.h |
diff --git a/base/trace_event/memory_dump_provider.h b/base/trace_event/memory_dump_provider.h |
index c899ea9c3464f9bda11c4f2918425227f2c312d6..0375e0833b7441ca949a8505eab32820883e4dd2 100644 |
--- a/base/trace_event/memory_dump_provider.h |
+++ b/base/trace_event/memory_dump_provider.h |
@@ -22,7 +22,8 @@ class BASE_EXPORT MemoryDumpProvider { |
struct Options { |
Options() |
: target_pid(kNullProcessId), |
- dumps_on_single_thread_task_runner(false) {} |
+ dumps_on_single_thread_task_runner(false), |
+ is_fast_polling_supported(false) {} |
// If the dump provider generates dumps on behalf of another process, |
// |target_pid| contains the pid of that process. |
@@ -34,6 +35,11 @@ class BASE_EXPORT MemoryDumpProvider { |
// a SingleThreadTaskRunner, which is usually the case. It is faster to run |
// all providers that run on the same thread together without thread hops. |
bool dumps_on_single_thread_task_runner; |
+ |
+ // Set to true if the dump provider implementation supports high frequency |
+ // polling. Only providers running without task runner affinity are |
+ // supported. |
+ bool is_fast_polling_supported; |
}; |
virtual ~MemoryDumpProvider() {} |
@@ -52,6 +58,18 @@ class BASE_EXPORT MemoryDumpProvider { |
// collecting extensive allocation data, if supported. |
virtual void OnHeapProfilingEnabled(bool enabled) {} |
+ // Quickly record the total memory usage in |memory_total|. This method will |
+ // be called only when the dump provider registration has |
+ // |is_fast_polling_supported| set to true. This method is used for polling at |
+ // high frequency for detecting peaks. See comment on |
+ // |is_fast_polling_supported| option if you need to override this method. |
+ virtual void PollFastMemoryTotal(uint64_t* memory_total) {} |
+ |
+ // Notifies polling enabled and disabled states. Polling is set enabled before |
+ // the first call to PollFastMemoryTotal() and set disabled after the last |
+ // call to PollFastMemoryTotal() in a tracing session. |
+ virtual void SetFastMemoryPollingEnabled(bool enabled) {} |
+ |
protected: |
MemoryDumpProvider() {} |