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

Unified Diff: base/process/process_metrics_mac.cc

Issue 546193002: Add an 'Idle Wake Ups' metric to the Linux task manager, implement backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wakeclean
Patch Set: rebase Created 6 years, 3 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/process/process_metrics_linux.cc ('k') | chrome/browser/task_manager/task_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics_mac.cc
diff --git a/base/process/process_metrics_mac.cc b/base/process/process_metrics_mac.cc
index a450e8d6bb6f132a6295ca3f004b7b0a57facded..a07d3cd1049274e00046071efb593dc744bd82e8 100644
--- a/base/process/process_metrics_mac.cc
+++ b/base/process/process_metrics_mac.cc
@@ -299,30 +299,8 @@ int ProcessMetrics::GetIdleWakeupsPerSecond() {
// where TASK_POWER_INFO isn't supported yet.
return 0;
}
- uint64_t absolute_idle_wakeups = power_info_data.task_platform_idle_wakeups;
-
- TimeTicks time = TimeTicks::Now();
-
- if (last_absolute_idle_wakeups_ == 0) {
- // First call, just set the last values.
- last_idle_wakeups_time_ = time;
- last_absolute_idle_wakeups_ = absolute_idle_wakeups;
- return 0;
- }
-
- int64 wakeups_delta = absolute_idle_wakeups - last_absolute_idle_wakeups_;
- int64 time_delta = (time - last_idle_wakeups_time_).InMicroseconds();
- if (time_delta == 0) {
- NOTREACHED();
- return 0;
- }
-
- last_idle_wakeups_time_ = time;
- last_absolute_idle_wakeups_ = absolute_idle_wakeups;
-
- // Round to average wakeups per second.
- const int kMicrosecondsPerSecond = 1000 * 1000;
- return (wakeups_delta * kMicrosecondsPerSecond + time_delta/2) / time_delta;
+ return CalculateIdleWakeupsPerSecond(
+ power_info_data.task_platform_idle_wakeups);
}
bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
« no previous file with comments | « base/process/process_metrics_linux.cc ('k') | chrome/browser/task_manager/task_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698