| 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 15 matching lines...) Expand all Loading... |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 return system_metrics; | 28 return system_metrics; |
| 29 } | 29 } |
| 30 | 30 |
| 31 scoped_ptr<Value> SystemMetrics::ToValue() const { | 31 scoped_ptr<Value> SystemMetrics::ToValue() const { |
| 32 scoped_ptr<DictionaryValue> res(new DictionaryValue()); | 32 scoped_ptr<DictionaryValue> res(new DictionaryValue()); |
| 33 | 33 |
| 34 res->SetInteger("committed_memory", static_cast<int>(committed_memory_)); | 34 res->SetInteger("committed_memory", static_cast<int>(committed_memory_)); |
| 35 #if defined(OS_LINUX) || defined(OS_ANDROID) | 35 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 36 res->Set("meminfo", memory_info_.ToValue().release()); | 36 res->Set("meminfo", memory_info_.ToValue()); |
| 37 res->Set("diskinfo", disk_info_.ToValue().release()); | 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().release()); | 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) | 47 #if defined(OS_WIN) |
| 48 return GetCPUUsage() * processor_count_; | 48 return GetCPUUsage() * processor_count_; |
| 49 #else | 49 #else |
| 50 return GetCPUUsage(); | 50 return GetCPUUsage(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; | 78 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; |
| 79 } | 79 } |
| 80 #else | 80 #else |
| 81 int ProcessMetrics::GetIdleWakeupsPerSecond() { | 81 int ProcessMetrics::GetIdleWakeupsPerSecond() { |
| 82 NOTIMPLEMENTED(); // http://crbug.com/120488 | 82 NOTIMPLEMENTED(); // http://crbug.com/120488 |
| 83 return 0; | 83 return 0; |
| 84 } | 84 } |
| 85 #endif // defined(OS_MACOSX) || defined(OS_LINUX) | 85 #endif // defined(OS_MACOSX) || defined(OS_LINUX) |
| 86 | 86 |
| 87 } // namespace base | 87 } // namespace base |
| OLD | NEW |