diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-11-20 14:38:25 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-11-20 14:38:25 -0500 |
| commit | 1abea5f67c2c70053af0a59db715a210df2e0bef (patch) | |
| tree | 7dd73d76ee6abe82db43b8e014a63798a5dbd076 /experiment/litmus_util.py | |
| parent | 53cfcf10531256d0e4411a7e0bda431ec27f28e7 (diff) | |
Removed dependency on overhead-analysis repo.
Diffstat (limited to 'experiment/litmus_util.py')
| -rw-r--r-- | experiment/litmus_util.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/experiment/litmus_util.py b/experiment/litmus_util.py index cde0bca..42d3e5f 100644 --- a/experiment/litmus_util.py +++ b/experiment/litmus_util.py | |||
| @@ -17,6 +17,19 @@ def num_cpus(): | |||
| 17 | cpus += 1 | 17 | cpus += 1 |
| 18 | return cpus | 18 | return cpus |
| 19 | 19 | ||
| 20 | def cpu_freq(): | ||
| 21 | """ | ||
| 22 | The frequency (in MHz) of the CPU. | ||
| 23 | """ | ||
| 24 | reg = re.compile(r'^cpu MHz\s*:\s*(\d+)', re.M) | ||
| 25 | with open('/proc/cpuinfo', 'r') as f: | ||
| 26 | data = f.read() | ||
| 27 | |||
| 28 | match = re.search(reg, data) | ||
| 29 | if not match: | ||
| 30 | raise Exception("Cannot parse CPU frequency!") | ||
| 31 | return int(match.group(1)) | ||
| 32 | |||
| 20 | def switch_scheduler(switch_to_in): | 33 | def switch_scheduler(switch_to_in): |
| 21 | """Switch the scheduler to whatever is passed in. | 34 | """Switch the scheduler to whatever is passed in. |
| 22 | 35 | ||
