| 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 13 matching lines...) Expand all Loading... |
| 24 GetSystemMemoryInfo(&system_metrics.memory_info_); | 24 GetSystemMemoryInfo(&system_metrics.memory_info_); |
| 25 GetSystemDiskInfo(&system_metrics.disk_info_); | 25 GetSystemDiskInfo(&system_metrics.disk_info_); |
| 26 #endif | 26 #endif |
| 27 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 28 GetSwapInfo(&system_metrics.swap_info_); | 28 GetSwapInfo(&system_metrics.swap_info_); |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 return system_metrics; | 31 return system_metrics; |
| 32 } | 32 } |
| 33 | 33 |
| 34 scoped_ptr<Value> SystemMetrics::ToValue() const { | 34 std::unique_ptr<Value> SystemMetrics::ToValue() const { |
| 35 scoped_ptr<DictionaryValue> res(new DictionaryValue()); | 35 std::unique_ptr<DictionaryValue> res(new DictionaryValue()); |
| 36 | 36 |
| 37 res->SetInteger("committed_memory", static_cast<int>(committed_memory_)); | 37 res->SetInteger("committed_memory", static_cast<int>(committed_memory_)); |
| 38 #if defined(OS_LINUX) || defined(OS_ANDROID) | 38 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |