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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 2537363003: [memory-infra] Add support for polling memory totals in MemoryDumpManager (Closed)
Patch Set: Fixes. 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 | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.h
diff --git a/base/trace_event/memory_dump_manager.h b/base/trace_event/memory_dump_manager.h
index 06b772c6e4bd5f050ee6079ba6aacf1b987dfb19..40a45943ff6a96f2a07dee675996408ce242341f 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -94,7 +94,8 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// This method takes ownership of the dump provider and guarantees that:
// - The |mdp| will be deleted at some point in the near future.
// - Its deletion will not happen concurrently with the OnMemoryDump() call.
- // Note that OnMemoryDump() calls can still happen after this method returns.
+ // Note that OnMemoryDump() and PollFastMemoryTotal() calls can still happen
+ // after this method returns.
void UnregisterAndDeleteDumpProviderSoon(
std::unique_ptr<MemoryDumpProvider> mdp);
@@ -329,6 +330,12 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// runner.
void InvokeOnMemoryDump(ProcessMemoryDumpAsyncState* owned_pmd_async_state);
+ // Records a quick total memory usage value that can be polled in short
+ // intervals. This is used to track the memory usage of process without having
+ // to record all data from dump providers and for detecting peak usages.
+ // Must be called on the dump thread task runner.
+ void PollFastMemoryTotal(uint64_t* memory_total);
+
// Helper for RegierDumpProvider* functions.
void RegisterDumpProviderInternal(
MemoryDumpProvider* mdp,
@@ -340,6 +347,14 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
void UnregisterDumpProviderInternal(MemoryDumpProvider* mdp,
bool take_mdp_ownership_and_delete_async);
+ // Adds / removes polling supported provider to the copy
+ // |mdps_for_fast_polling_|. This function should run on the dump thread so
+ // that we don't need lock for polling.
+ void RegisterPollingMDPOnDumpThread(
+ scoped_refptr<MemoryDumpProviderInfo> mdpinfo);
+ void UnregisterPollingMDPOnDumpThread(
+ scoped_refptr<MemoryDumpProviderInfo> mdpinfo);
+
// An ordererd set of registered MemoryDumpProviderInfo(s), sorted by task
// runner affinity (MDPs belonging to the same task runners are adjacent).
MemoryDumpProviderInfo::OrderedSet dump_providers_;
@@ -349,6 +364,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
MemoryDumpManagerDelegate* delegate_; // Not owned.
+ // A copy of mdpinfo list that support polling. It must be accessed only on
+ // the dump thread for polling without taking lock.
+ MemoryDumpProviderInfo::OrderedSet mdps_for_fast_polling_;
+
// When true, this instance is in charge of coordinating periodic dumps.
bool is_coordinator_;
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698