 Chromium Code Reviews
 Chromium Code Reviews Issue 2667023004:
  Add comments explaining Task Manager idle wakeups computation.  (Closed)
    
  
    Issue 2667023004:
  Add comments explaining Task Manager idle wakeups computation.  (Closed) 
  | 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 |