| 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 28 matching lines...) Expand all Loading... |
| 39 res->Set("meminfo", memory_info_.ToValue()); | 39 res->Set("meminfo", memory_info_.ToValue()); |
| 40 res->Set("diskinfo", disk_info_.ToValue()); | 40 res->Set("diskinfo", disk_info_.ToValue()); |
| 41 #endif | 41 #endif |
| 42 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
| 43 res->Set("swapinfo", swap_info_.ToValue()); | 43 res->Set("swapinfo", swap_info_.ToValue()); |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 return std::move(res); | 46 return std::move(res); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ProcessMetrics* ProcessMetrics::CreateCurrentProcessMetrics() { | 49 std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateCurrentProcessMetrics() { |
| 50 #if !defined(OS_MACOSX) || defined(OS_IOS) | 50 #if !defined(OS_MACOSX) || defined(OS_IOS) |
| 51 return CreateProcessMetrics(base::GetCurrentProcessHandle()); | 51 return CreateProcessMetrics(base::GetCurrentProcessHandle()); |
| 52 #else | 52 #else |
| 53 return CreateProcessMetrics(base::GetCurrentProcessHandle(), nullptr); | 53 return CreateProcessMetrics(base::GetCurrentProcessHandle(), nullptr); |
| 54 #endif // !defined(OS_MACOSX) || defined(OS_IOS) | 54 #endif // !defined(OS_MACOSX) || defined(OS_IOS) |
| 55 } | 55 } |
| 56 | 56 |
| 57 double ProcessMetrics::GetPlatformIndependentCPUUsage() { | 57 double ProcessMetrics::GetPlatformIndependentCPUUsage() { |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 return GetCPUUsage() * processor_count_; | 59 return GetCPUUsage() * processor_count_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; | 89 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; |
| 90 } | 90 } |
| 91 #else | 91 #else |
| 92 int ProcessMetrics::GetIdleWakeupsPerSecond() { | 92 int ProcessMetrics::GetIdleWakeupsPerSecond() { |
| 93 NOTIMPLEMENTED(); // http://crbug.com/120488 | 93 NOTIMPLEMENTED(); // http://crbug.com/120488 |
| 94 return 0; | 94 return 0; |
| 95 } | 95 } |
| 96 #endif // defined(OS_MACOSX) || defined(OS_LINUX) | 96 #endif // defined(OS_MACOSX) || defined(OS_LINUX) |
| 97 | 97 |
| 98 } // namespace base | 98 } // namespace base |
| OLD | NEW |