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

Unified Diff: base/memory/memory_pressure_monitor_mac.cc

Issue 2876793005: Add UMA metrics for desktop memory pressure notifications. (Closed)
Patch Set: Created 3 years, 7 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/process/process_metrics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor_mac.cc
diff --git a/base/memory/memory_pressure_monitor_mac.cc b/base/memory/memory_pressure_monitor_mac.cc
index 9ca520e8f8a0df2d9e898662ede6503bd4d2c829..14eb1d39793656060cedb33916f99b2897fda7b0 100644
--- a/base/memory/memory_pressure_monitor_mac.cc
+++ b/base/memory/memory_pressure_monitor_mac.cc
@@ -104,7 +104,8 @@ int MemoryPressureMonitor::GetMacMemoryPressureLevel() {
size_t length = sizeof(int);
sysctlbyname("kern.memorystatus_vm_pressure_level",
&mac_memory_pressure_level, &length, nullptr, 0);
-
+ printf("kern memory pressure = %d\n", mac_memory_pressure_level);
+
return mac_memory_pressure_level;
}
@@ -112,6 +113,7 @@ void MemoryPressureMonitor::UpdatePressureLevel() {
// Get the current macOS pressure level and convert to the corresponding
// Chrome pressure level.
int mac_memory_pressure_level = GetMacMemoryPressureLevel();
+printf("updating pressure level to %d\n", mac_memory_pressure_level);
MemoryPressureListener::MemoryPressureLevel new_pressure_level =
MemoryPressureLevelForMacMemoryPressureLevel(mac_memory_pressure_level);
@@ -162,7 +164,12 @@ int MemoryPressureMonitor::GetSecondsPerUMATick() {
MemoryPressureListener::MemoryPressureLevel
MemoryPressureMonitor::GetCurrentPressureLevel() {
- return last_pressure_level_;
+ MemoryPressureListener::MemoryPressureLevel level = MemoryPressureLevelForMacMemoryPressureLevel(GetMacMemoryPressureLevel());
+printf(" GetCurrentPressureLevel = %d\n", level);
+ return level;
+
+
+ //return last_pressure_level_;
}
void MemoryPressureMonitor::OnMemoryPressureChanged(
@@ -170,6 +177,7 @@ void MemoryPressureMonitor::OnMemoryPressureChanged(
const MemoryPressureMonitor::DispatchCallback& dispatch_callback) {
// Get the Chrome-equvialent memory pressure level.
int mac_memory_pressure_level = dispatch_source_get_data(event_source);
+printf("OnChanged to %d\n", mac_memory_pressure_level);
MemoryPressureListener::MemoryPressureLevel memory_pressure_level =
MemoryPressureLevelForMacMemoryPressureLevel(mac_memory_pressure_level);
« no previous file with comments | « no previous file | base/process/process_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698