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 | |
parent | 53cfcf10531256d0e4411a7e0bda431ec27f28e7 (diff) |
Removed dependency on overhead-analysis repo.
Diffstat (limited to 'experiment')
-rw-r--r-- | experiment/experiment.py | 3 | ||||
-rw-r--r-- | experiment/litmus_util.py | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/experiment/experiment.py b/experiment/experiment.py index 8c88799..deb4ff2 100644 --- a/experiment/experiment.py +++ b/experiment/experiment.py | |||
@@ -178,7 +178,8 @@ class Experiment(object): | |||
178 | self.log("Writing %d proc entries" % len(self.proc_entries)) | 178 | self.log("Writing %d proc entries" % len(self.proc_entries)) |
179 | map(methodcaller('write_proc'), self.proc_entries) | 179 | map(methodcaller('write_proc'), self.proc_entries) |
180 | 180 | ||
181 | time.sleep(5) | 181 | if len(self.proc_entries): |
182 | time.sleep(2) | ||
182 | 183 | ||
183 | self.log("Switching to %s" % self.scheduler) | 184 | self.log("Switching to %s" % self.scheduler) |
184 | litmus_util.switch_scheduler(self.scheduler) | 185 | litmus_util.switch_scheduler(self.scheduler) |
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 | ||