diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-04 14:18:54 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-04 14:18:54 +0100 |
commit | 12e8b5bf27c7993d1b232e4f0f876961fd0524d7 (patch) | |
tree | 8c7234bdacfbd7c8cea0c43406af5f5f22e3cfb8 | |
parent | 2143482f36b439de0a483a139b9e444c1c37fb4f (diff) | |
download | psutil-12e8b5bf27c7993d1b232e4f0f876961fd0524d7.tar.gz |
Linux: we weren't returning actual PSS
-rw-r--r-- | psutil/_pslinux.py | 4 | ||||
-rw-r--r-- | test/test_psutil.py | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 2dab99b0..6865efb1 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -961,7 +961,7 @@ class Process(object): @wrap_exceptions def memory_info_ex(self, _private_re=re.compile(b"Private.*:\s+(\d+)"), - _shared_re=re.compile(b"Shared.*:\s+(\d+)")): + _pss_re=re.compile(b"Pss.*:\s+(\d+)")): # ============================================================ # | FIELD | DESCRIPTION | AKA | TOP | # ============================================================ @@ -995,7 +995,7 @@ class Process(object): raise else: uss = sum(map(int, _private_re.findall(smaps_data))) * 1024 - pss = sum(map(int, _shared_re.findall(smaps_data))) * 1024 + pss = sum(map(int, _pss_re.findall(smaps_data))) * 1024 else: # usually means we're on kernel < 2.6.14 or CONFIG_MMU kernel # configuration option is not enabled. diff --git a/test/test_psutil.py b/test/test_psutil.py index 7b095971..158f3458 100644 --- a/test/test_psutil.py +++ b/test/test_psutil.py @@ -1691,8 +1691,10 @@ class TestProcess(unittest.TestCase): self.assertGreater(percent2, percent1) del memarr - # def test_memory_info_ex(self): - # # tested later in fetch all test suite + def test_memory_info_ex(self): + memex = psutil.Process().memory_info_ex() + if LINUX or OSX or WINDOWS: + self.assertGreater(memex.uss, 0) @unittest.skipIf(OPENBSD or NETBSD, "not available on this platform") def test_memory_maps(self): |