aboutsummaryrefslogtreecommitdiffstats
path: root/run/litmus_util.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-04-23 17:28:12 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2013-04-23 17:28:12 -0400
commit2ceaa6c607ef85bde4f14017634d9d1621efca29 (patch)
treec85e755e59907a48ff762fd56473449f33c23894 /run/litmus_util.py
parenta0e4b9fe9d7fab9a50a626cfeda3c614a9a6af5d (diff)
parent7545402506aa76261e18d85af585ff0ac1cf05c1 (diff)
Merge branch 'master' into wip-color-mc
Conflicts: gen/generator.py parse/sched.py parse_exps.py
Diffstat (limited to 'run/litmus_util.py')
-rw-r--r--run/litmus_util.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/run/litmus_util.py b/run/litmus_util.py
index 70da262..81f690b 100644
--- a/run/litmus_util.py
+++ b/run/litmus_util.py
@@ -20,7 +20,7 @@ def switch_scheduler(switch_to_in):
20 with open('/proc/litmus/active_plugin', 'w') as active_plugin: 20 with open('/proc/litmus/active_plugin', 'w') as active_plugin:
21 subprocess.Popen(["echo", switch_to], stdout=active_plugin) 21 subprocess.Popen(["echo", switch_to], stdout=active_plugin)
22 22
23 # it takes a bit to do the switch, sleep an arbitrary amount of time 23 # It takes a bit to do the switch, sleep an arbitrary amount of time
24 time.sleep(2) 24 time.sleep(2)
25 25
26 cur_plugin = scheduler() 26 cur_plugin = scheduler()
@@ -29,24 +29,21 @@ def switch_scheduler(switch_to_in):
29 (switch_to, cur_plugin)) 29 (switch_to, cur_plugin))
30 30
31def waiting_tasks(): 31def waiting_tasks():
32 reg = re.compile(r'^ready.*?(?P<READY>\d+)$', re.M) 32 reg = re.compile(r'^ready.*?(?P<WAITING>\d+)$', re.M)
33 with open('/proc/litmus/stats', 'r') as f: 33 with open('/proc/litmus/stats', 'r') as f:
34 data = f.read() 34 data = f.read()
35 35
36 # Ignore if no tasks are waiting for release 36 # Ignore if no tasks are waiting for release
37 match = re.search(reg, data) 37 waiting = re.search(reg, data).group("WAITING")
38 ready = match.group("READY")
39 38
40 return 0 if not ready else int(ready) 39 return 0 if not waiting else int(waiting)
41 40
42def all_tasks(): 41def all_tasks():
43 reg = re.compile(r'^real-time.*?(?P<TASKS>\d+)$', re.M) 42 reg = re.compile(r'^real-time.*?(?P<TASKS>\d+)$', re.M)
44 with open('/proc/litmus/stats', 'r') as f: 43 with open('/proc/litmus/stats', 'r') as f:
45 data = f.read() 44 data = f.read()
46 45
47 # Ignore if no tasks are waiting for release 46 ready = re.search(reg, data).group("TASKS")
48 match = re.search(reg, data)
49 ready = match.group("TASKS")
50 47
51 return 0 if not ready else int(ready) 48 return 0 if not ready else int(ready)
52 49