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

Unified Diff: base/process/process_metrics_win.cc

Issue 1160533002: Change outputting ints in win/linux GetCpuUsage to doubles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « base/process/process_metrics_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics_win.cc
diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc
index 1dd97e629cf4e74e93fb50f51a288c10bcccbd6c..6c424e3cacf2446980d21c0c0693f83cba2fdebe 100644
--- a/base/process/process_metrics_win.cc
+++ b/base/process/process_metrics_win.cc
@@ -225,14 +225,11 @@ double ProcessMetrics::GetCPUUsage() {
if (time_delta == 0)
return 0;
- // We add time_delta / 2 so the result is rounded.
- int cpu = static_cast<int>((system_time_delta * 100 + time_delta / 2) /
- time_delta);
last_system_time_ = system_time;
last_cpu_time_ = time;
- return cpu;
+ return static_cast<double>(system_time_delta * 100.0) / time_delta;
}
bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
« no previous file with comments | « base/process/process_metrics_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698