summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 00:12:58 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 00:12:58 +0000
commit54fd1d3ac91d117719f157fad3ead41518865f52 (patch)
treebe3ec12e4da55384888a13707d8eee0f05e60a07 /base
parent1f758608ae7c38a580d574ec7e5061eb0bfa7ee2 (diff)
downloadchromium_src-54fd1d3ac91d117719f157fad3ead41518865f52.zip
chromium_src-54fd1d3ac91d117719f157fad3ead41518865f52.tar.gz
chromium_src-54fd1d3ac91d117719f157fad3ead41518865f52.tar.bz2
Linux: about:memory
(based on http://code.google.com/p/chromium/issues/detail?id=16251) Add about:memory support to Linux. Rather than try and copy the Windows output, we use a couple of metrics which make more sense on Linux: USS and PSS. http://codereview.chromium.org/177024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process_util.h9
-rw-r--r--base/process_util_linux.cc9
2 files changed, 13 insertions, 5 deletions
diff --git a/base/process_util.h b/base/process_util.h
index f002f85..91cca61 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -286,12 +286,20 @@ class NamedProcessIterator {
};
// Working Set (resident) memory usage broken down by
+//
+// On Windows:
// priv (private): These pages (kbytes) cannot be shared with any other process.
// shareable: These pages (kbytes) can be shared with other processes under
// the right circumstances.
// shared : These pages (kbytes) are currently shared with at least one
// other process.
+//
+// On Linux:
+// priv: Pages mapped only by this process
+// shared: PSS or 0 if the kernel doesn't support this
+// shareable: 0
struct WorkingSetKBytes {
+ WorkingSetKBytes() : priv(0), shareable(0), shared(0) {}
size_t priv;
size_t shareable;
size_t shared;
@@ -304,6 +312,7 @@ struct WorkingSetKBytes {
// image: These pages are mapped into the view of an image section (backed by
// file system)
struct CommittedKBytes {
+ CommittedKBytes() : priv(0), mapped(0), image(0) {}
size_t priv;
size_t mapped;
size_t image;
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index a05e9bb..53e7d02 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -292,11 +292,10 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const {
ws_usage->priv = private_kb;
// Sharable is not calculated, as it does not provide interesting data.
ws_usage->shareable = 0;
- if (have_pss) {
- ws_usage->shared = pss_kb - private_kb;
- } else {
- ws_usage->shared = shared_kb;
- }
+
+ ws_usage->shared = 0;
+ if (have_pss)
+ ws_usage->shared = pss_kb;
return true;
}