diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-02-17 15:02:15 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-02-17 15:02:15 -0500 |
| commit | 649b64013619f67160fd289b208189b88e6196fa (patch) | |
| tree | 4198c160a8ff83f0976e8e125c0d796db19985fb /run | |
| parent | ea121dd26076998ffdc89792f62da5d585a1f35c (diff) | |
Save feather-trace timer frequency, not CPU frequency, with each experiment.
Diffstat (limited to 'run')
| -rw-r--r-- | run/litmus_util.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/run/litmus_util.py b/run/litmus_util.py index 340113d..ec1700e 100644 --- a/run/litmus_util.py +++ b/run/litmus_util.py | |||
| @@ -4,6 +4,7 @@ import subprocess | |||
| 4 | import os | 4 | import os |
| 5 | import stat | 5 | import stat |
| 6 | import config.config as conf | 6 | import config.config as conf |
| 7 | from common import get_config_option | ||
| 7 | 8 | ||
| 8 | def num_cpus(): | 9 | def num_cpus(): |
| 9 | '''Return the number of CPUs in the system.''' | 10 | '''Return the number of CPUs in the system.''' |
| @@ -17,18 +18,25 @@ def num_cpus(): | |||
| 17 | cpus += 1 | 18 | cpus += 1 |
| 18 | return cpus | 19 | return cpus |
| 19 | 20 | ||
| 20 | def cpu_freq(): | 21 | def ft_freq(): |
| 21 | ''' | 22 | '''The frequency (in MHz) of the clock used by feather trace.''' |
| 22 | The frequency (in MHz) of the CPU. | 23 | if get_config_option('CPU_V7') == 'y': |
| 23 | ''' | 24 | # Arm V7s use a millisecond timer |
| 24 | reg = re.compile(r'^cpu MHz\s*:\s*(\d+)', re.M) | 25 | freq = 1000.0 |
| 25 | with open('/proc/cpuinfo', 'r') as f: | 26 | elif get_config_option('X86') == 'y': |
| 26 | data = f.read() | 27 | # X86 timer is equal to processor clock |
| 27 | 28 | reg = re.compile(r'^cpu MHz\s*:\s*(?P<FREQ>\d+)', re.M) | |
| 28 | match = re.search(reg, data) | 29 | with open('/proc/cpuinfo', 'r') as f: |
| 29 | if not match: | 30 | data = f.read() |
| 30 | raise Exception("Cannot parse CPU frequency!") | 31 | |
| 31 | return int(match.group(1)) | 32 | match = re.search(reg, data) |
| 33 | if not match: | ||
| 34 | raise Exception("Cannot parse CPU frequency from x86 CPU!") | ||
| 35 | freq = int(match.group('FREQ')) | ||
| 36 | else: | ||
| 37 | # You're on your own | ||
| 38 | freq = 0 | ||
| 39 | return freq | ||
| 32 | 40 | ||
| 33 | def switch_scheduler(switch_to_in): | 41 | def switch_scheduler(switch_to_in): |
| 34 | '''Switch the scheduler to whatever is passed in. | 42 | '''Switch the scheduler to whatever is passed in. |
