| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 double ProcessMetrics::GetPlatformIndependentCPUUsage() { | 62 double ProcessMetrics::GetPlatformIndependentCPUUsage() { |
| 63 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
| 64 return GetCPUUsage() * processor_count_; | 64 return GetCPUUsage() * processor_count_; |
| 65 #else | 65 #else |
| 66 return GetCPUUsage(); | 66 return GetCPUUsage(); |
| 67 #endif | 67 #endif |
| 68 } | 68 } |
| 69 | 69 |
| 70 #if defined(OS_MACOSX) || defined(OS_LINUX) | 70 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_AIX) |
| 71 int ProcessMetrics::CalculateIdleWakeupsPerSecond( | 71 int ProcessMetrics::CalculateIdleWakeupsPerSecond( |
| 72 uint64_t absolute_idle_wakeups) { | 72 uint64_t absolute_idle_wakeups) { |
| 73 TimeTicks time = TimeTicks::Now(); | 73 TimeTicks time = TimeTicks::Now(); |
| 74 | 74 |
| 75 if (last_absolute_idle_wakeups_ == 0) { | 75 if (last_absolute_idle_wakeups_ == 0) { |
| 76 // First call, just set the last values. | 76 // First call, just set the last values. |
| 77 last_idle_wakeups_time_ = time; | 77 last_idle_wakeups_time_ = time; |
| 78 last_absolute_idle_wakeups_ = absolute_idle_wakeups; | 78 last_absolute_idle_wakeups_ = absolute_idle_wakeups; |
| 79 return 0; | 79 return 0; |
| 80 } | 80 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; | 95 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; |
| 96 } | 96 } |
| 97 #else | 97 #else |
| 98 int ProcessMetrics::GetIdleWakeupsPerSecond() { | 98 int ProcessMetrics::GetIdleWakeupsPerSecond() { |
| 99 NOTIMPLEMENTED(); // http://crbug.com/120488 | 99 NOTIMPLEMENTED(); // http://crbug.com/120488 |
| 100 return 0; | 100 return 0; |
| 101 } | 101 } |
| 102 #endif // defined(OS_MACOSX) || defined(OS_LINUX) | 102 #endif // defined(OS_MACOSX) || defined(OS_LINUX) |
| 103 | 103 |
| 104 } // namespace base | 104 } // namespace base |
| OLD | NEW |