aboutsummaryrefslogtreecommitdiffstats
path: root/run/litmus_util.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-02-17 15:02:15 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-02-17 15:02:15 -0500
commit649b64013619f67160fd289b208189b88e6196fa (patch)
tree4198c160a8ff83f0976e8e125c0d796db19985fb /run/litmus_util.py
parentea121dd26076998ffdc89792f62da5d585a1f35c (diff)
Save feather-trace timer frequency, not CPU frequency, with each experiment.
Diffstat (limited to 'run/litmus_util.py')
-rw-r--r--run/litmus_util.py32
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
4import os 4import os
5import stat 5import stat
6import config.config as conf 6import config.config as conf
7from common import get_config_option
7 8
8def num_cpus(): 9def 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
20def cpu_freq(): 21def 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
33def switch_scheduler(switch_to_in): 41def switch_scheduler(switch_to_in):
34 '''Switch the scheduler to whatever is passed in. 42 '''Switch the scheduler to whatever is passed in.