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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/values.h" | 10 #include "base/values.h" |
9 | 11 |
10 namespace base { | 12 namespace base { |
11 | 13 |
12 SystemMetrics::SystemMetrics() { | 14 SystemMetrics::SystemMetrics() { |
13 committed_memory_ = 0; | 15 committed_memory_ = 0; |
14 } | 16 } |
15 | 17 |
16 SystemMetrics SystemMetrics::Sample() { | 18 SystemMetrics SystemMetrics::Sample() { |
(...skipping 16 matching lines...) Expand all Loading... |
33 | 35 |
34 res->SetInteger("committed_memory", static_cast<int>(committed_memory_)); | 36 res->SetInteger("committed_memory", static_cast<int>(committed_memory_)); |
35 #if defined(OS_LINUX) || defined(OS_ANDROID) | 37 #if defined(OS_LINUX) || defined(OS_ANDROID) |
36 res->Set("meminfo", memory_info_.ToValue()); | 38 res->Set("meminfo", memory_info_.ToValue()); |
37 res->Set("diskinfo", disk_info_.ToValue()); | 39 res->Set("diskinfo", disk_info_.ToValue()); |
38 #endif | 40 #endif |
39 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
40 res->Set("swapinfo", swap_info_.ToValue()); | 42 res->Set("swapinfo", swap_info_.ToValue()); |
41 #endif | 43 #endif |
42 | 44 |
43 return res.Pass(); | 45 return std::move(res); |
44 } | 46 } |
45 | 47 |
46 ProcessMetrics* ProcessMetrics::CreateCurrentProcessMetrics() { | 48 ProcessMetrics* ProcessMetrics::CreateCurrentProcessMetrics() { |
47 #if !defined(OS_MACOSX) || defined(OS_IOS) | 49 #if !defined(OS_MACOSX) || defined(OS_IOS) |
48 return CreateProcessMetrics(base::GetCurrentProcessHandle()); | 50 return CreateProcessMetrics(base::GetCurrentProcessHandle()); |
49 #else | 51 #else |
50 return CreateProcessMetrics(base::GetCurrentProcessHandle(), nullptr); | 52 return CreateProcessMetrics(base::GetCurrentProcessHandle(), nullptr); |
51 #endif // !defined(OS_MACOSX) || defined(OS_IOS) | 53 #endif // !defined(OS_MACOSX) || defined(OS_IOS) |
52 } | 54 } |
53 | 55 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; | 88 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; |
87 } | 89 } |
88 #else | 90 #else |
89 int ProcessMetrics::GetIdleWakeupsPerSecond() { | 91 int ProcessMetrics::GetIdleWakeupsPerSecond() { |
90 NOTIMPLEMENTED(); // http://crbug.com/120488 | 92 NOTIMPLEMENTED(); // http://crbug.com/120488 |
91 return 0; | 93 return 0; |
92 } | 94 } |
93 #endif // defined(OS_MACOSX) || defined(OS_LINUX) | 95 #endif // defined(OS_MACOSX) || defined(OS_LINUX) |
94 | 96 |
95 } // namespace base | 97 } // namespace base |
OLD | NEW |