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

Side by Side Diff: base/process/process_metrics_freebsd.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.h ('k') | base/process/process_metrics_linux.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 <sys/sysctl.h> 8 #include <sys/sysctl.h>
9 #include <sys/user.h> 9 #include <sys/user.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return 0; 51 return 0;
52 52
53 return info.ki_rssize * getpagesize(); 53 return info.ki_rssize * getpagesize();
54 } 54 }
55 55
56 size_t ProcessMetrics::GetPeakWorkingSetSize() const { 56 size_t ProcessMetrics::GetPeakWorkingSetSize() const {
57 return 0; 57 return 0;
58 } 58 }
59 59
60 bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes, 60 bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
61 size_t* shared_bytes) { 61 size_t* shared_bytes) const {
62 WorkingSetKBytes ws_usage; 62 WorkingSetKBytes ws_usage;
63 if (!GetWorkingSetKBytes(&ws_usage)) 63 if (!GetWorkingSetKBytes(&ws_usage))
64 return false; 64 return false;
65 65
66 if (private_bytes) 66 if (private_bytes)
67 *private_bytes = ws_usage.priv << 10; 67 *private_bytes = ws_usage.priv << 10;
68 68
69 if (shared_bytes) 69 if (shared_bytes)
70 *shared_bytes = ws_usage.shared * 1024; 70 *shared_bytes = ws_usage.shared * 1024;
71 71
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 NULL, 0) < 0) { 116 NULL, 0) < 0) {
117 return 0; 117 return 0;
118 } 118 }
119 119
120 pagesize = getpagesize(); 120 pagesize = getpagesize();
121 121
122 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); 122 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
123 } 123 }
124 124
125 } // namespace base 125 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_metrics_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698