aboutsummaryrefslogtreecommitdiffstats
path: root/experiment/litmus_util.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-11-26 16:02:48 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2012-11-26 16:02:48 -0500
commitcb8db5d30ee769304c2c2b00f2a7d9bcb3c4098f (patch)
treec5352d84285af565d5246c3eb861ffba709761f1 /experiment/litmus_util.py
parent41c867480f1e20bd3b168258ed71450499ea6ccf (diff)
Removed 2-step parse for scheduling statistics.
Diffstat (limited to 'experiment/litmus_util.py')
-rw-r--r--experiment/litmus_util.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/experiment/litmus_util.py b/experiment/litmus_util.py
index 42d3e5f..fb2b341 100644
--- a/experiment/litmus_util.py
+++ b/experiment/litmus_util.py
@@ -6,7 +6,7 @@ import stat
6import config.config as conf 6import config.config as conf
7 7
8def num_cpus(): 8def num_cpus():
9 """Return the number of CPUs in the system.""" 9 '''Return the number of CPUs in the system.'''
10 10
11 lnx_re = re.compile(r'^(processor|online)') 11 lnx_re = re.compile(r'^(processor|online)')
12 cpus = 0 12 cpus = 0
@@ -18,9 +18,9 @@ def num_cpus():
18 return cpus 18 return cpus
19 19
20def cpu_freq(): 20def cpu_freq():
21 """ 21 '''
22 The frequency (in MHz) of the CPU. 22 The frequency (in MHz) of the CPU.
23 """ 23 '''
24 reg = re.compile(r'^cpu MHz\s*:\s*(\d+)', re.M) 24 reg = re.compile(r'^cpu MHz\s*:\s*(\d+)', re.M)
25 with open('/proc/cpuinfo', 'r') as f: 25 with open('/proc/cpuinfo', 'r') as f:
26 data = f.read() 26 data = f.read()
@@ -31,12 +31,12 @@ def cpu_freq():
31 return int(match.group(1)) 31 return int(match.group(1))
32 32
33def switch_scheduler(switch_to_in): 33def switch_scheduler(switch_to_in):
34 """Switch the scheduler to whatever is passed in. 34 '''Switch the scheduler to whatever is passed in.
35 35
36 This methods sleeps for two seconds to give Linux the chance to execute 36 This methods sleeps for two seconds to give Linux the chance to execute
37 schedule switching code. Raises an exception if the switch does not work. 37 schedule switching code. Raises an exception if the switch does not work.
38 38
39 """ 39 '''
40 40
41 switch_to = str(switch_to_in).strip() 41 switch_to = str(switch_to_in).strip()
42 42
@@ -57,7 +57,7 @@ def uname_matches(reg):
57 return bool( re.match(reg, data) ) 57 return bool( re.match(reg, data) )
58 58
59def is_executable(fname): 59def is_executable(fname):
60 """Return whether the file passed in is executable""" 60 '''Return whether the file passed in is executable'''
61 mode = os.stat(fname)[stat.ST_MODE] 61 mode = os.stat(fname)[stat.ST_MODE]
62 return mode & stat.S_IXUSR and mode & stat.S_IRUSR 62 return mode & stat.S_IXUSR and mode & stat.S_IRUSR
63 63