From 649b64013619f67160fd289b208189b88e6196fa Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Sun, 17 Feb 2013 12:02:15 -0800 Subject: Save feather-trace timer frequency, not CPU frequency, with each experiment. --- common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common.py') diff --git a/common.py b/common.py index ad3c418..6d1db97 100644 --- a/common.py +++ b/common.py @@ -33,12 +33,14 @@ def get_executable(prog, hint, optional=False): def get_config_option(option): '''Search for @option in installed kernel config (if present). Raise an IOError if the kernel config isn't found in /boot/.''' - uname = subprocess.check_output(["uname", "-r"])[-1] + uname = subprocess.check_output(["uname", "-r"]).strip() fname = "/boot/config-%s" % uname if os.path.exists(fname): config_regex = "^CONFIG_{}=(?P.*)$".format(option) - match = re.search(config_regex, open(fname, 'r').read()) + with open(fname, 'r') as f: + data = f.read() + match = re.search(config_regex, data, re.M) if not match: return None else: -- cgit v1.2.2