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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 2582453002: [tracing] Implement polling in MemoryDumpManager (Closed)
Patch Set: 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
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 f068b704c52ece4a6f5a92f7b96fc65d11c900e2..dbc959943c6451268b5ba3dcd53457fc41c9f2d1 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -18,7 +18,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
-#include "base/timer/timer.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
@@ -33,6 +32,7 @@ namespace trace_event {
class MemoryDumpManagerDelegate;
class MemoryDumpProvider;
class MemoryDumpSessionState;
+class MemoryDumpTrigger;
// This is the interface exposed to the rest of the codebase to deal with
// memory tracing. The main entry point for clients is represented by
@@ -152,6 +152,7 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
friend struct DefaultSingletonTraits<MemoryDumpManager>;
friend class MemoryDumpManagerDelegate;
friend class MemoryDumpManagerTest;
+ friend class MemoryDumpTrigger;
// Descriptor used to hold information about registered MDPs.
// Some important considerations about lifetime of this object:
@@ -274,31 +275,6 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDumpAsyncState);
};
- // Sets up periodic memory dump timers to start global dump requests based on
- // the dump triggers from trace config.
- class BASE_EXPORT PeriodicGlobalDumpTimer {
- public:
- PeriodicGlobalDumpTimer();
- ~PeriodicGlobalDumpTimer();
-
- void Start(const std::vector<TraceConfig::MemoryDumpConfig::Trigger>&
- triggers_list);
- void Stop();
-
- bool IsRunning();
-
- private:
- // Periodically called by the timer.
- void RequestPeriodicGlobalDump();
-
- RepeatingTimer timer_;
- uint32_t periodic_dumps_count_;
- uint32_t light_dump_rate_;
- uint32_t heavy_dump_rate_;
-
- DISALLOW_COPY_AND_ASSIGN(PeriodicGlobalDumpTimer);
- };
-
static const int kMaxConsecutiveFailuresCount;
static const char* const kSystemAllocatorPoolName;
@@ -335,7 +311,8 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// record all data from dump providers. This value is approximate to trade-off
// speed, and not consistent with the rest of the memory-infra metrics. Must
// be called on the dump thread.
- void PollFastMemoryTotal(uint64_t* memory_total);
+ // Returns true if |memory_total| was updated by polling at least 1 MDP.
+ bool PollFastMemoryTotal(uint64_t* memory_total);
// Helper for RegierDumpProvider* functions.
void RegisterDumpProviderInternal(
@@ -368,9 +345,6 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
MemoryDumpManagerDelegate* delegate_; // Not owned.
- // When true, this instance is in charge of coordinating periodic dumps.
- bool is_coordinator_;
-
// Protects from concurrent accesses to the |dump_providers_*| and |delegate_|
// to guard against disabling logging while dumping on another thread.
Lock lock_;
@@ -379,8 +353,8 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// dump_providers_enabled_ list) when tracing is not enabled.
subtle::AtomicWord memory_tracing_enabled_;
- // For time-triggered periodic dumps.
- PeriodicGlobalDumpTimer periodic_dump_timer_;
+ // For triggering memory dumps.
+ std::unique_ptr<MemoryDumpTrigger> dump_trigger_;
// Thread used for MemoryDumpProviders which don't specify a task runner
// affinity.

Powered by Google App Engine
This is Rietveld 408576698