summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-08-05 10:26:42 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-08-05 10:26:42 -0300
commitdc84d2e292d9b9b415b9a8bfe9c2d12d9a82038a (patch)
treeead40248a9999f3b061d6e377db3e16072b8ba4c
parentc7f561f5acbabb095c22709a1878e484e1134ae2 (diff)
downloadpython-linux-procfs-dc84d2e292d9b9b415b9a8bfe9c2d12d9a82038a.tar.gz
pidstat: Provide class level documentation
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xprocfs/procfs.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py
index d5717de..3b23a27 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -29,6 +29,31 @@ def process_cmdline(pid_info):
return pid_info["stat"]["comm"]
class pidstat:
+ """Provides a dictionary to access the fields in the per process /proc/PID/stat
+ files.
+
+ One can obtain the available fields asking for the keys of the dictionary, e.g.:
+
+ >>> p = procfs.pidstat(1)
+ >>> print p.keys()
+ ['majflt', 'rss', 'cnswap', 'cstime', 'pid', 'session', 'startstack', 'startcode', 'cmajflt', 'blocked', 'exit_signal', 'minflt', 'nswap', 'environ', 'priority', 'state', 'delayacct_blkio_ticks', 'policy', 'rt_priority', 'ppid', 'nice', 'cutime', 'endcode', 'wchan', 'num_threads', 'sigcatch', 'comm', 'stime', 'sigignore', 'tty_nr', 'kstkeip', 'utime', 'tpgid', 'itrealvalue', 'kstkesp', 'rlim', 'signal', 'pgrp', 'flags', 'starttime', 'cminflt', 'vsize', 'processor']
+
+ And then access the various process properties using it as a dictionary:
+
+ >>> print p['comm']
+ systemd
+ >>> print p['priority']
+ 20
+ >>> print p['state']
+ S
+
+ Please refer to the 'procfs(5)' man page, by using:
+
+ $ man 5 procfs
+
+ To see information for each of the above fields, it is part of the
+ 'man-pages' RPM package.
+ """
# Entries with the same value, the one with a comment after it is the
# more recent, having replaced the other name in v4.1-rc kernel times.