diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-11-26 16:02:48 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-11-26 16:02:48 -0500 |
| commit | cb8db5d30ee769304c2c2b00f2a7d9bcb3c4098f (patch) | |
| tree | c5352d84285af565d5246c3eb861ffba709761f1 /experiment/litmus_util.py | |
| parent | 41c867480f1e20bd3b168258ed71450499ea6ccf (diff) | |
Removed 2-step parse for scheduling statistics.
Diffstat (limited to 'experiment/litmus_util.py')
| -rw-r--r-- | experiment/litmus_util.py | 12 |
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 | |||
| 6 | import config.config as conf | 6 | import config.config as conf |
| 7 | 7 | ||
| 8 | def num_cpus(): | 8 | def 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 | ||
| 20 | def cpu_freq(): | 20 | def 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 | ||
| 33 | def switch_scheduler(switch_to_in): | 33 | def 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 | ||
| 59 | def is_executable(fname): | 59 | def 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 | ||
