diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-25 16:28:50 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-25 16:28:50 +0000 |
commit | 37ef15c5b8ce5cf2c8bd48d296796a4c385b26b9 (patch) | |
tree | fc2d61de6f2ae47b4cc912d8b5ea424e9974cd12 /base | |
parent | ad77826579e734e7b392528c76d3a860b2129b67 (diff) | |
download | chromium_src-37ef15c5b8ce5cf2c8bd48d296796a4c385b26b9.zip chromium_src-37ef15c5b8ce5cf2c8bd48d296796a4c385b26b9.tar.gz chromium_src-37ef15c5b8ce5cf2c8bd48d296796a4c385b26b9.tar.bz2 |
Mac: Fix %cpu in task manager.
I changed %cpu from int to double but left the +0.5 for rounding in. Duh.
BUG=32464
TEST=Task Manager %cpu should match Activity Monitor's %cpu. In particular, inactive processes should have 0.0% cpu instead of 0.5%.
Review URL: http://codereview.chromium.org/548135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process_util_mac.mm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm index 509828b..9c0a2a4 100644 --- a/base/process_util_mac.mm +++ b/base/process_util_mac.mm @@ -255,8 +255,8 @@ double ProcessMetrics::GetCPUUsage() { kern_return_t kr; - // TODO(thakis): Libtop doesn't use thread info. How can they get away - // without it? + // Libtop explicitly loops over the threads (libtop_pinfo_update_cpu_usage() + // in libtop.c), but this is more concise and gives the same results: task_thread_times_info thread_info_data; mach_msg_type_number_t thread_info_count = TASK_THREAD_TIMES_INFO_COUNT; kr = task_info(task, @@ -307,8 +307,7 @@ double ProcessMetrics::GetCPUUsage() { return 0; // We add time_delta / 2 so the result is rounded. - double cpu = static_cast<double>( - (system_time_delta * 100.0 + time_delta / 2.0) / time_delta); + double cpu = static_cast<double>((system_time_delta * 100.0) / time_delta); last_system_time_ = task_time; last_time_ = time; |