From 16dfc8df20c6befeed423217a2e0f5ae59b5a04d Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Mon, 18 Mar 2013 13:15:42 -0400 Subject: Use smarter defaults which can handle data from Bjorns scripts. --- run/litmus_util.py | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'run/litmus_util.py') diff --git a/run/litmus_util.py b/run/litmus_util.py index 8a7f87d..b9080c1 100644 --- a/run/litmus_util.py +++ b/run/litmus_util.py @@ -1,43 +1,8 @@ import re import time import subprocess -import os -import stat import config.config as conf -def num_cpus(): - '''Return the number of CPUs in the system.''' - - lnx_re = re.compile(r'^(processor|online)') - cpus = 0 - - with open('/proc/cpuinfo', 'r') as f: - for line in f: - if lnx_re.match(line): - cpus += 1 - return cpus - -def ft_freq(): - umachine = subprocess.check_output(["uname", "-m"]) - - if re.match("armv7", umachine): - # Arm V7s use a millisecond timer - freq = 1000.0 - elif re.match("x86", umachine): - # X86 timer is equal to processor clock - reg = re.compile(r'^cpu MHz\s*:\s*(?P\d+)', re.M) - with open('/proc/cpuinfo', 'r') as f: - data = f.read() - - match = re.search(reg, data) - if not match: - raise Exception("Cannot parse CPU frequency from x86 CPU!") - freq = int(match.group('FREQ')) - else: - # You're on your own - freq = 0 - return freq - def switch_scheduler(switch_to_in): '''Switch the scheduler to whatever is passed in. @@ -60,21 +25,6 @@ def switch_scheduler(switch_to_in): if switch_to != cur_plugin: raise Exception("Could not switch to plugin: %s" % switch_to) -def uname_matches(reg): - data = subprocess.check_output(["uname", "-r"]) - return bool( re.match(reg, data) ) - -def is_executable(fname): - '''Return whether the file passed in is executable''' - mode = os.stat(fname)[stat.ST_MODE] - return mode & stat.S_IXUSR and mode & stat.S_IRUSR - -def is_device(dev): - if not os.path.exists(dev): - return False - mode = os.stat(dev)[stat.ST_MODE] - return not (not mode & stat.S_IFCHR) - def waiting_tasks(): reg = re.compile(r'^ready.*?(?P\d+)$', re.M) with open('/proc/litmus/stats', 'r') as f: -- cgit v1.2.2