summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-17 14:35:18 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-17 14:35:18 +0100
commite70a9e354c6397cb05a27a3a46034afce335d78b (patch)
tree7187bda5f6b3197110cafd14f147fc515c0ee6c0
parent0529f175eb1e573b063959d2baad734d64eb6d45 (diff)
downloadpsutil-e70a9e354c6397cb05a27a3a46034afce335d78b.tar.gz
add comment about USS mem on linux
-rw-r--r--HISTORY.rst4
-rw-r--r--psutil/_pslinux.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 0e4e2d8c..12a8732a 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -13,10 +13,10 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
(patch by Eric Rahm)
- #755: Process.memory_percent() "memtype" parameter.
- #758: tests now live in psutil namespace.
-- #760: expose OS constants (LINUX, OSX, etc.)
+- #760: expose OS constants (psutil.LINUX, psutil.OSX, etc.)
- #756: [Linux] disk_io_counters() return 2 new fields: read_merged_count and
write_merged_count.
-- #762: new sripts/procsmem.py script.
+- #762: new scripts/procsmem.py script.
**Bug fixes**
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 492f61ee..5dd57207 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1029,6 +1029,14 @@ class Process(object):
_private_re=re.compile(b"Private.*:\s+(\d+)"),
_pss_re=re.compile(b"Pss.*:\s+(\d+)"),
_swap_re=re.compile(b"Swap.*:\s+(\d+)")):
+ # You might be tempted to calculate USS by subtracting
+ # the "shared" value from the "resident" value in
+ # /proc/<pid>/statm. But at least on Linux, statm's "shared"
+ # value actually counts pages backed by files, which has
+ # little to do with whether the pages are actually shared.
+ # /proc/self/smaps on the other hand appears to give us the
+ # correct information.
+
# Note: using 3 regexes is faster than reading the file
# line by line.
# XXX: on Python 3 the 2 regexes are 30% slower than on