OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <stddef.h> |
7 #include <sys/sysctl.h> | 8 #include <sys/sysctl.h> |
8 #include <sys/user.h> | 9 #include <sys/user.h> |
9 #include <unistd.h> | 10 #include <unistd.h> |
10 | 11 |
| 12 #include "base/macros.h" |
11 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
12 | 14 |
13 namespace base { | 15 namespace base { |
14 | 16 |
15 ProcessMetrics::ProcessMetrics(ProcessHandle process) | 17 ProcessMetrics::ProcessMetrics(ProcessHandle process) |
16 : process_(process), | 18 : process_(process), |
17 last_system_time_(0), | 19 last_system_time_(0), |
18 last_cpu_(0) { | 20 last_cpu_(0) { |
19 processor_count_ = base::SysInfo::NumberOfProcessors(); | 21 processor_count_ = base::SysInfo::NumberOfProcessors(); |
20 } | 22 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 NULL, 0) < 0) { | 115 NULL, 0) < 0) { |
114 return 0; | 116 return 0; |
115 } | 117 } |
116 | 118 |
117 pagesize = getpagesize(); | 119 pagesize = getpagesize(); |
118 | 120 |
119 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); | 121 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); |
120 } | 122 } |
121 | 123 |
122 } // namespace base | 124 } // namespace base |
OLD | NEW |