diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-08-12 13:35:36 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-08-12 13:35:36 -0300 |
commit | d50f5ea2eb745b2d50f31cd103a790a98e20001b (patch) | |
tree | d666033e459799d381fccab6c31fe083aff457e8 | |
parent | 747432b3eac0cb0158a35705beee557c84172a5d (diff) | |
download | python-linux-procfs-d50f5ea2eb745b2d50f31cd103a790a98e20001b.tar.gz |
pidstats: Add per process flags
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | procfs/procfs.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py index 70a7031..33b1a40 100755 --- a/procfs/procfs.py +++ b/procfs/procfs.py @@ -13,6 +13,36 @@ def process_cmdline(pid_info): return pid_info["stat"]["comm"] class pidstats: + + PF_ALIGNWARN = 0x00000001 + PF_STARTING = 0x00000002 + PF_EXITING = 0x00000004 + PF_EXITPIDONE = 0x00000008 + PF_VCPU = 0x00000010 + PF_FORKNOEXEC = 0x00000040 + PF_SUPERPRIV = 0x00000100 + PF_DUMPCORE = 0x00000200 + PF_SIGNALED = 0x00000400 + PF_MEMALLOC = 0x00000800 + PF_FLUSHER = 0x00001000 + PF_USED_MATH = 0x00002000 + PF_NOFREEZE = 0x00008000 + PF_FROZEN = 0x00010000 + PF_FSTRANS = 0x00020000 + PF_KSWAPD = 0x00040000 + PF_SWAPOFF = 0x00080000 + PF_LESS_THROTTLE = 0x00100000 + PF_KTHREAD = 0x00200000 + PF_RANDOMIZE = 0x00400000 + PF_SWAPWRITE = 0x00800000 + PF_SPREAD_PAGE = 0x01000000 + PF_SPREAD_SLAB = 0x02000000 + PF_THREAD_BOUND = 0x04000000 + PF_MEMPOLICY = 0x10000000 + PF_MUTEX_TESTER = 0x20000000 + PF_FREEZER_SKIP = 0x40000000 + PF_FREEZER_NOSIG = 0x80000000 + proc_stat_fields = [ "pid", "comm", "state", "ppid", "pgrp", "session", "tty_nr", "tpgid", "flags", "minflt", "cminflt", "majflt", "cmajflt", "utime", "stime", "cutime", @@ -170,6 +200,10 @@ class pidstats: priorities = priorities.strip(',') return priorities + def is_bound_to_cpu(self, pid): + return int(self.processes[pid]["stat"]["flags"]) & \ + self.PF_THREAD_BOUND and True or False + class interrupts: def __init__(self): self.interrupts = {} |