Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: base/process/process_metrics_openbsd.cc

Issue 2740423002: mac: Fix calulation for number of resident pages in a process. (Closed)
Patch Set: comments from mark. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/process/process_metrics_mac.cc ('k') | base/process/process_metrics_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <sys/param.h> 9 #include <sys/param.h>
10 #include <sys/sysctl.h> 10 #include <sys/sysctl.h>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return -1; 57 return -1;
58 58
59 return info.p_vm_rssize * getpagesize(); 59 return info.p_vm_rssize * getpagesize();
60 } 60 }
61 61
62 size_t ProcessMetrics::GetPeakWorkingSetSize() const { 62 size_t ProcessMetrics::GetPeakWorkingSetSize() const {
63 return 0; 63 return 0;
64 } 64 }
65 65
66 bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes, 66 bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
67 size_t* shared_bytes) { 67 size_t* shared_bytes) const {
68 WorkingSetKBytes ws_usage; 68 WorkingSetKBytes ws_usage;
69 69
70 if (!GetWorkingSetKBytes(&ws_usage)) 70 if (!GetWorkingSetKBytes(&ws_usage))
71 return false; 71 return false;
72 72
73 if (private_bytes) 73 if (private_bytes)
74 *private_bytes = ws_usage.priv << 10; 74 *private_bytes = ws_usage.priv << 10;
75 75
76 if (shared_bytes) 76 if (shared_bytes)
77 *shared_bytes = ws_usage.shared * 1024; 77 *shared_bytes = ws_usage.shared * 1024;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 mem_total = vmtotal.t_vm; 157 mem_total = vmtotal.t_vm;
158 mem_free = vmtotal.t_free; 158 mem_free = vmtotal.t_free;
159 mem_inactive = vmtotal.t_vm - vmtotal.t_avm; 159 mem_inactive = vmtotal.t_vm - vmtotal.t_avm;
160 160
161 pagesize = getpagesize(); 161 pagesize = getpagesize();
162 162
163 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); 163 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
164 } 164 }
165 165
166 } // namespace base 166 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics_mac.cc ('k') | base/process/process_metrics_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698