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

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') | base/trace_event/memory_dump_scheduler.cc » ('J')
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..9fc7ee9819dca093f744a92d06d8971f79fd0e56 100644
--- a/base/trace_event/memory_dump_scheduler.h
+++ b/base/trace_event/memory_dump_scheduler.h
@@ -5,6 +5,8 @@
#ifndef BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H
#define BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H
+#include <deque>
+
#include "base/base_export.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
@@ -85,6 +87,8 @@ class BASE_EXPORT MemoryDumpScheduler {
int num_polls_from_last_dump;
uint64_t last_dump_memory_total;
+ int64_t memory_increase_threshold;
+ std::deque<uint64_t> last_n_memory_totals;
Primiano Tucci (use gerrit) 2017/03/09 18:31:27 I'd drop the "_n" in the name
Primiano Tucci (use gerrit) 2017/03/09 18:31:27 also deque is super silly memory-wise, as dskiba f
ssid 2017/03/09 19:32:44 I didn't want to re-implement deque here and code
ssid 2017/03/09 19:32:44 Done.
DISALLOW_COPY_AND_ASSIGN(PollingTriggerState);
};
@@ -101,6 +105,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);
@@ -112,6 +119,9 @@ class BASE_EXPORT MemoryDumpScheduler {
PeriodicTriggerState periodic_state_;
PollingTriggerState polling_state_;
+ // Total physical memory of the device.
+ size_t total_physical_memory_;
Primiano Tucci (use gerrit) 2017/03/09 18:31:27 I find this a bit of a misleading name, because I
ssid 2017/03/09 19:32:44 sorry, mistake. Removed this field.
+
DISALLOW_COPY_AND_ASSIGN(MemoryDumpScheduler);
};
« no previous file with comments | « no previous file | base/trace_event/memory_dump_scheduler.cc » ('j') | base/trace_event/memory_dump_scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698