summaryrefslogtreecommitdiffstats
path: root/base/process_util_linux.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 22:54:48 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 22:54:48 +0000
commit9bb48aa7f2fe15292b7be9b002b70531e0220691 (patch)
tree53060efa2a0ffb25b440ad0a64a4f05d77cf8943 /base/process_util_linux.cc
parent6aa1ecc158be71557b7bbc1204b006c257aea1ae (diff)
downloadchromium_src-9bb48aa7f2fe15292b7be9b002b70531e0220691.zip
chromium_src-9bb48aa7f2fe15292b7be9b002b70531e0220691.tar.gz
chromium_src-9bb48aa7f2fe15292b7be9b002b70531e0220691.tar.bz2
Linux: remove the concept of physical memory from the task manager.
Physical memory isn't a concept on Linux. We have private pages and proportional set size. This patch matches the task manager up with about:memory. 'Private memory' gets you the number of private pages and 'Shared memory' is the PSS (except on systems with old kernels that don't have PSS, where it'll be zero). http://codereview.chromium.org/242096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_linux.cc')
-rw-r--r--base/process_util_linux.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index 9a725c0..390a2b5 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -248,8 +248,9 @@ size_t ProcessMetrics::GetPeakWorkingSetSize() const {
}
size_t ProcessMetrics::GetPrivateBytes() const {
- // http://crbug.com/16251
- return 0;
+ WorkingSetKBytes ws_usage;
+ GetWorkingSetKBytes(&ws_usage);
+ return ws_usage.priv << 10;
}
// Private and Shared working set sizes are obtained from /proc/<pid>/smaps,
@@ -258,7 +259,6 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const {
FilePath stat_file =
FilePath("/proc").Append(IntToString(process_)).Append("smaps");
std::string smaps;
- int shared_kb = 0;
int private_kb = 0;
int pss_kb = 0;
bool have_pss = false;
@@ -279,9 +279,7 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const {
NOTREACHED();
return false;
}
- if (StartsWithASCII(last_key_name, "Shared_", 1)) {
- shared_kb += StringToInt(tokenizer.token());
- } else if (StartsWithASCII(last_key_name, "Private_", 1)) {
+ if (StartsWithASCII(last_key_name, "Private_", 1)) {
private_kb += StringToInt(tokenizer.token());
} else if (StartsWithASCII(last_key_name, "Pss", 1)) {
have_pss = true;