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

Unified Diff: base/chromeos/memory_pressure_observer_chromeos.cc

Issue 874483008: Add UMA stats to get the quality of service of memory pressure handling scheme in ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « base/chromeos/memory_pressure_observer_chromeos.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/chromeos/memory_pressure_observer_chromeos.cc
diff --git a/base/chromeos/memory_pressure_observer_chromeos.cc b/base/chromeos/memory_pressure_observer_chromeos.cc
index 8112c761e5e713e747cb015d8226e62a754c87a8..2f132c24564c14f5b0b825300474ce388f2525e4 100644
--- a/base/chromeos/memory_pressure_observer_chromeos.cc
+++ b/base/chromeos/memory_pressure_observer_chromeos.cc
@@ -5,6 +5,7 @@
#include "base/chromeos/memory_pressure_observer_chromeos.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram_macros.h"
#include "base/process/process_metrics.h"
#include "base/time/time.h"
@@ -74,11 +75,32 @@ MemoryPressureObserverChromeOS::MemoryPressureObserverChromeOS(
GetModerateMemoryThresholdInPercent(thresholds)),
critical_pressure_threshold_percent_(
GetCriticalMemoryThresholdInPercent(thresholds)),
+ time_non_critical_pressure_(0),
+ time_critical_pressure_(0),
weak_ptr_factory_(this) {
StartObserving();
}
MemoryPressureObserverChromeOS::~MemoryPressureObserverChromeOS() {
+ // Record quality of service of memory pressure handling scheme in ChromeOS.
+ // 1 day (approximately in Millisecond) is a good enough upper limit.
+ const int kMaxQualityOfPressureHandleService = 100000000;
+ if (time_critical_pressure_ != 0) {
+ int ratio = time_non_critical_pressure_ / time_critical_pressure_;
+ ratio = (ratio > kMaxQualityOfPressureHandleService)
+ ? kMaxQualityOfPressureHandleService
+ : ratio;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "ChromeOS.MemoryPressureHandleQuality.TimeRatio", ratio,
+ kMemoryPressureIntervalMs, kMaxQualityOfPressureHandleService, 50);
+ } else {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "ChromeOS.MemoryPressureHandleQuality.TimeRatio",
+ kMaxQualityOfPressureHandleService, kMemoryPressureIntervalMs,
+ kMaxQualityOfPressureHandleService, 50);
+ }
+ time_non_critical_pressure_ = 0;
+ time_critical_pressure_ = 0;
StopObserving();
}
@@ -108,6 +130,13 @@ void MemoryPressureObserverChromeOS::CheckMemoryPressure() {
GetMemoryPressureLevelFromFillLevel(GetUsedMemoryInPercent(),
moderate_pressure_threshold_percent_,
critical_pressure_threshold_percent_);
+
+ if (current_memory_pressure_level_ ==
+ MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL)
Mr4D (OOO till 08-26) 2015/01/27 13:49:42 Instead of adding the ms value here, you should re
+ time_critical_pressure_ += kMemoryPressureIntervalMs;
+ else
+ time_non_critical_pressure_ += kMemoryPressureIntervalMs;
+
// In case there is no memory pressure we do not notify.
if (current_memory_pressure_level_ ==
MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE) {
« no previous file with comments | « base/chromeos/memory_pressure_observer_chromeos.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698