| Index: base/process_util_mac.mm
|
| diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
|
| index 509828b6b25b790fd2a8b69943fd937f8efaa8e2..9c0a2a4973f1c7aac93c36f9836a3e5c6f798919 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;
|
|
|