| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process/process_metrics.h" | 5 #include "base/process/process_metrics.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 res->Set("diskinfo", disk_info_.ToValue()); | 37 res->Set("diskinfo", disk_info_.ToValue()); |
| 38 #endif | 38 #endif |
| 39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 40 res->Set("swapinfo", swap_info_.ToValue()); | 40 res->Set("swapinfo", swap_info_.ToValue()); |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 return res.Pass(); | 43 return res.Pass(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 double ProcessMetrics::GetPlatformIndependentCPUUsage() { | 46 double ProcessMetrics::GetPlatformIndependentCPUUsage() { |
| 47 #if defined(OS_WIN) | |
| 48 return GetCPUUsage() * processor_count_; | |
| 49 #else | |
| 50 return GetCPUUsage(); | 47 return GetCPUUsage(); |
| 51 #endif | |
| 52 } | 48 } |
| 53 | 49 |
| 54 #if defined(OS_MACOSX) || defined(OS_LINUX) | 50 #if defined(OS_MACOSX) || defined(OS_LINUX) |
| 55 int ProcessMetrics::CalculateIdleWakeupsPerSecond( | 51 int ProcessMetrics::CalculateIdleWakeupsPerSecond( |
| 56 uint64 absolute_idle_wakeups) { | 52 uint64 absolute_idle_wakeups) { |
| 57 TimeTicks time = TimeTicks::Now(); | 53 TimeTicks time = TimeTicks::Now(); |
| 58 | 54 |
| 59 if (last_absolute_idle_wakeups_ == 0) { | 55 if (last_absolute_idle_wakeups_ == 0) { |
| 60 // First call, just set the last values. | 56 // First call, just set the last values. |
| 61 last_idle_wakeups_time_ = time; | 57 last_idle_wakeups_time_ = time; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 78 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; | 74 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; |
| 79 } | 75 } |
| 80 #else | 76 #else |
| 81 int ProcessMetrics::GetIdleWakeupsPerSecond() { | 77 int ProcessMetrics::GetIdleWakeupsPerSecond() { |
| 82 NOTIMPLEMENTED(); // http://crbug.com/120488 | 78 NOTIMPLEMENTED(); // http://crbug.com/120488 |
| 83 return 0; | 79 return 0; |
| 84 } | 80 } |
| 85 #endif // defined(OS_MACOSX) || defined(OS_LINUX) | 81 #endif // defined(OS_MACOSX) || defined(OS_LINUX) |
| 86 | 82 |
| 87 } // namespace base | 83 } // namespace base |
| OLD | NEW |