summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-10-08 15:25:28 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-10-08 15:31:10 -0300
commit1a7b891e4c7665185cb2b8da2a688877479e937c (patch)
tree1de94cbd7d993472d75dbc3e505bc74c783d3351
parente60073b8a8f736c935706ee2227ef1fc6945c9d1 (diff)
downloadpython-linux-procfs-1a7b891e4c7665185cb2b8da2a688877479e937c.tar.gz
pidstats: Add documentation for the reload() method
Mention python-perf as an alternative way of noticing thread lifetime events (FORK, EXIT). Requested-by: Guy Streeter <streeter@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xprocfs/procfs.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py
index af51207..3d683c1 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -412,6 +412,20 @@ class pidstats:
return key in self.processes
def reload(self):
+ """
+ This operation will trow away the current dictionary contents, if any, and
+ read all the pid files from /proc/, instantiating a 'process' instance for
+ each of them.
+
+ This is a high overhead operation, and should be avoided if the perf python
+ binding can be used to detect when new threads appear and existing ones
+ terminate.
+
+ In RHEL it is found in the python-perf rpm package.
+
+ More information about the perf facilities can be found in the 'perf_event_open'
+ man page.
+ """
del self.processes
self.processes = {}
pids = os.listdir(self.basedir)