summaryrefslogtreecommitdiff
path: root/psutil/_pslinux.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2018-12-13 15:54:37 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2018-12-13 15:54:37 +0100
commit2cdf81db322822ba8fb23ed67523aacb6539da95 (patch)
treeee946d6f3200eafd2dafdee78e68c899426ebf8e /psutil/_pslinux.py
parent8351fa4ff642d997cd478a7d216b661e62a5f696 (diff)
downloadpsutil-2cdf81db322822ba8fb23ed67523aacb6539da95.tar.gz
#1373: different approach to oneshot() cache (pass Process instances around - which is faster)
Diffstat (limited to 'psutil/_pslinux.py')
-rw-r--r--psutil/_pslinux.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 880be2c8..5c8cc20c 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1528,7 +1528,7 @@ def wrap_exceptions(fun):
class Process(object):
"""Linux process implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_procfs_path"]
+ __slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
def __init__(self, pid):
self.pid = pid
@@ -1585,14 +1585,14 @@ class Process(object):
return f.read().strip()
def oneshot_enter(self):
- self._parse_stat_file.cache_activate()
- self._read_status_file.cache_activate()
- self._read_smaps_file.cache_activate()
+ self._parse_stat_file.cache_activate(self)
+ self._read_status_file.cache_activate(self)
+ self._read_smaps_file.cache_activate(self)
def oneshot_exit(self):
- self._parse_stat_file.cache_deactivate()
- self._read_status_file.cache_deactivate()
- self._read_smaps_file.cache_deactivate()
+ self._parse_stat_file.cache_deactivate(self)
+ self._read_status_file.cache_deactivate(self)
+ self._read_smaps_file.cache_deactivate(self)
@wrap_exceptions
def name(self):