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

Unified Diff: base/process/process_metrics.cc

Issue 2667023004: Add comments explaining Task Manager idle wakeups computation. (Closed)
Patch Set: Restore code, add a comment. Created 3 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 | « no previous file | base/process/process_metrics_mac.cc » ('j') | base/process/process_metrics_mac.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics.cc
diff --git a/base/process/process_metrics.cc b/base/process/process_metrics.cc
index cc6532c8dca15c233044c24c4f5e0e3557ef99db..a38930a208857b6c914f51f84170b1eae7f6c5ea 100644
--- a/base/process/process_metrics.cc
+++ b/base/process/process_metrics.cc
@@ -84,8 +84,9 @@ int ProcessMetrics::CalculateIdleWakeupsPerSecond(
last_idle_wakeups_time_ = time;
last_absolute_idle_wakeups_ = absolute_idle_wakeups;
- // Round to average wakeups per second.
int64_t wakeups_delta_for_ms = wakeups_delta * Time::kMicrosecondsPerSecond;
+ // Round the result up by adding 1/2 (the second term resolves to 1/2 without
+ // dropping down into floating point).
brucedawson 2017/02/02 19:52:03 It's funny how the set of idioms that are obvious
return (wakeups_delta_for_ms + time_delta / 2) / time_delta;
}
#else
« no previous file with comments | « no previous file | base/process/process_metrics_mac.cc » ('j') | base/process/process_metrics_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698