summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphaël Beamonte <raphael.beamonte@gmail.com>2012-10-23 11:45:03 -0400
committerClark Williams <williams@redhat.com>2012-10-23 12:03:11 -0500
commit565f66981b31f3f82d0c08a08b6f316de34d03fa (patch)
tree222c0fcbeb29b932ce19dfcd6b4465b676a1b33e
parent5609dade84b7c3a50fb60845d3999747904afc76 (diff)
downloadrteval-565f66981b31f3f82d0c08a08b6f316de34d03fa.tar.gz
rteval-565f66981b31f3f82d0c08a08b6f316de34d03fa.tar.xz
rteval-565f66981b31f3f82d0c08a08b6f316de34d03fa.zip
Rewrite of the get_kthreads method to make it cross-distribution
Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
-rw-r--r--rteval/rteval.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/rteval/rteval.py b/rteval/rteval.py
index 5ecc20f..a432233 100644
--- a/rteval/rteval.py
+++ b/rteval/rteval.py
@@ -248,16 +248,15 @@ class RtEval(object):
def get_kthreads(self):
policies = {'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown' }
ret_kthreads = {}
- if not os.path.exists('/etc/rc.d/init.d/rtctl'):
- return ret_kthreads
self.debug("getting kthread status")
- cmd = '/sbin/service rtctl status'
+ cmd = '/bin/ps -eocommand,pid,policy,rtprio,comm'
self.debug("cmd: %s" % cmd)
c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
for p in c.stdout:
v = p.strip().split()
+ kcmd = v.pop(0)
try:
- if int(v[0]) > 0:
+ if int(v[0]) > 0 and kcmd.startswith('[') and kcmd.endswith(']'):
ret_kthreads[v[0]] = {'policy' : policies[v[1]],
'priority' : v[2], 'name' : v[3] }
except ValueError: