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

Unified Diff: base/trace_event/memory_dump_scheduler.h

Issue 2737153002: [memory-infra] Implement peak detection logic (Closed)
Patch Set: Fixes. Created 3 years, 9 months 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_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_scheduler.h
diff --git a/base/trace_event/memory_dump_scheduler.h b/base/trace_event/memory_dump_scheduler.h
index 2214e053b46a3c4e16541b8b0bb66ecf4f412719..be7530691a83748538a55ead0cdc3d458959fc84 100644
--- a/base/trace_event/memory_dump_scheduler.h
+++ b/base/trace_event/memory_dump_scheduler.h
@@ -68,6 +68,8 @@ class BASE_EXPORT MemoryDumpScheduler {
};
struct PollingTriggerState {
+ static const uint32_t kMaxNumMemorySamples = 50;
+
explicit PollingTriggerState(
scoped_refptr<SingleThreadTaskRunner> polling_task_runner);
~PollingTriggerState();
@@ -85,6 +87,9 @@ class BASE_EXPORT MemoryDumpScheduler {
int num_polls_from_last_dump;
uint64_t last_dump_memory_total;
+ int64_t memory_increase_threshold;
+ uint64_t last_memory_totals_kb[kMaxNumMemorySamples];
+ uint32_t last_memory_totals_kb_index;
DISALLOW_COPY_AND_ASSIGN(PollingTriggerState);
};
@@ -101,6 +106,9 @@ class BASE_EXPORT MemoryDumpScheduler {
// Returns true if peak memory value is detected.
bool ShouldTriggerDump(uint64_t current_memory_total);
+ // Helper to detect peaks in memory usage.
+ bool IsCurrentSamplePeak(uint64_t current_memory_total);
+
// Must be set before enabling tracing.
static void SetPollingIntervalForTesting(uint32_t interval);
« no previous file with comments | « no previous file | base/trace_event/memory_dump_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698