Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3849)

Unified Diff: base/trace_event/memory_dump_provider.h

Issue 2537363003: [memory-infra] Add support for polling memory totals in MemoryDumpManager (Closed)
Patch Set: nits. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/memory_dump_manager_unittest.cc ('k') | base/trace_event/memory_dump_session_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..244319efa7b7996c4b45e399028886cc3e61ee06 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) {}
+
+ // Indicates that fast memory polling is not going to be used in the near
+ // future and the MDP can tear down any resource kept around for fast memory
+ // polling.
+ virtual void SuspendFastMemoryPolling() {}
+
protected:
MemoryDumpProvider() {}
« no previous file with comments | « base/trace_event/memory_dump_manager_unittest.cc ('k') | base/trace_event/memory_dump_session_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698