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

Unified Diff: base/memory/memory_pressure_monitor_chromeos.cc

Issue 2434103003: Add Mac memory pressure statistic reporting and consolidate platform code (Closed)
Patch Set: Add radar ID Created 4 years, 1 month 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/memory/memory_pressure_monitor_chromeos.h ('k') | base/memory/memory_pressure_monitor_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor_chromeos.cc
diff --git a/base/memory/memory_pressure_monitor_chromeos.cc b/base/memory/memory_pressure_monitor_chromeos.cc
index 0e1aa815ab0e4882efc7b9fb9f14816747cc1170..b90075d903ef32968256ddce68d1d25e630a0aa3 100644
--- a/base/memory/memory_pressure_monitor_chromeos.cc
+++ b/base/memory/memory_pressure_monitor_chromeos.cc
@@ -108,6 +108,7 @@ MemoryPressureMonitor::MemoryPressureMonitor(
: current_memory_pressure_level_(
MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE),
moderate_pressure_repeat_count_(0),
+ seconds_since_reporting_(0),
moderate_pressure_threshold_percent_(
GetModerateMemoryThresholdInPercent(thresholds)),
critical_pressure_threshold_percent_(
@@ -158,8 +159,13 @@ void MemoryPressureMonitor::StopObserving() {
void MemoryPressureMonitor::CheckMemoryPressureAndRecordStatistics() {
CheckMemoryPressure();
-
+ if (seconds_since_reporting_++ == 5) {
+ seconds_since_reporting_ = 0;
+ RecordMemoryPressure(current_memory_pressure_level_, 1);
+ }
// Record UMA histogram statistics for the current memory pressure level.
+ // TODO(lgrey): Remove this once there's a usable history for the
+ // "Memory.PressureLevel" statistic
MemoryPressureLevelUMA memory_pressure_level_uma(MEMORY_PRESSURE_LEVEL_NONE);
switch (current_memory_pressure_level_) {
case MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
« no previous file with comments | « base/memory/memory_pressure_monitor_chromeos.h ('k') | base/memory/memory_pressure_monitor_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698