From cb8db5d30ee769304c2c2b00f2a7d9bcb3c4098f Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Mon, 26 Nov 2012 16:02:48 -0500 Subject: Removed 2-step parse for scheduling statistics. --- experiment/executable/executable.py | 10 +++++----- experiment/executable/ftcat.py | 4 ++-- experiment/experiment.py | 10 +++++----- experiment/litmus_util.py | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'experiment') diff --git a/experiment/executable/executable.py b/experiment/executable/executable.py index b964699..628f711 100644 --- a/experiment/executable/executable.py +++ b/experiment/executable/executable.py @@ -4,7 +4,7 @@ import signal from ..litmus_util import is_executable class Executable(object): - """Parent object that represents an executable for use in task-sets.""" + '''Parent object that represents an executable for use in task-sets.''' def __init__(self, exec_file, extra_args=None, stdout_file = None, stderr_file = None): self.exec_file = exec_file @@ -47,7 +47,7 @@ class Executable(object): return " ".join(self.__get_full_command()) def execute(self): - """Execute the binary.""" + '''Execute the binary.''' full_command = self.__get_full_command() self.sp = subprocess.Popen(full_command, stdout=self.stdout_file, stderr=self.stderr_file, cwd=self.cwd) @@ -59,15 +59,15 @@ class Executable(object): self.sp.send_signal(signal.SIGINT) def terminate(self): - """Send the terminate signal to the binary.""" + '''Send the terminate signal to the binary.''' self.sp.terminate() def wait(self): - """Wait until the executable is finished, checking return code. + '''Wait until the executable is finished, checking return code. If the exit status is non-zero, raise an exception. - """ + ''' self.sp.wait() if self.sp.returncode != 0: diff --git a/experiment/executable/ftcat.py b/experiment/executable/ftcat.py index 9966312..5da8fa7 100644 --- a/experiment/executable/ftcat.py +++ b/experiment/executable/ftcat.py @@ -4,10 +4,10 @@ import stat from executable import Executable class FTcat(Executable): - """Used to wrap the ftcat binary in the Experiment object.""" + '''Used to wrap the ftcat binary in the Experiment object.''' def __init__(self, ft_cat_bin, stdout_file, stderr_file, dev, events, cpu=None): - """Extends the Executable initializer method with ftcat attributes.""" + '''Extends the Executable initializer method with ftcat attributes.''' # hack to run FTCat at higher priority chrt_bin = '/usr/bin/chrt' diff --git a/experiment/experiment.py b/experiment/experiment.py index deb4ff2..4bd47c6 100644 --- a/experiment/experiment.py +++ b/experiment/experiment.py @@ -5,19 +5,19 @@ from operator import methodcaller from tracer import SchedTracer, LogTracer, PerfTracer, LinuxTracer, OverheadTracer class ExperimentException(Exception): - """Used to indicate when there are problems with an experiment.""" + '''Used to indicate when there are problems with an experiment.''' def __init__(self, name): self.name = name class ExperimentDone(ExperimentException): - """Raised when an experiment looks like it's been run already.""" + '''Raised when an experiment looks like it's been run already.''' def __str__(self): return "Experiment finished already: %d" % self.name class ExperimentInterrupted(ExperimentException): - """Raised when an experiment appears to be interrupted (partial results).""" + '''Raised when an experiment appears to be interrupted (partial results).''' def __str__(self): return "Experiment was interrupted in progress: %d" % self.name @@ -28,11 +28,11 @@ class ExperimentFailed(ExperimentException): class Experiment(object): - """Execute one task-set and save the results. Experiments have unique IDs.""" + '''Execute one task-set and save the results. Experiments have unique IDs.''' INTERRUPTED_DIR = ".interrupted" def __init__(self, name, scheduler, working_dir, finished_dir, proc_entries, executables): - """Run an experiment, optionally wrapped in tracing.""" + '''Run an experiment, optionally wrapped in tracing.''' self.name = name self.scheduler = scheduler diff --git a/experiment/litmus_util.py b/experiment/litmus_util.py index 42d3e5f..fb2b341 100644 --- a/experiment/litmus_util.py +++ b/experiment/litmus_util.py @@ -6,7 +6,7 @@ import stat import config.config as conf def num_cpus(): - """Return the number of CPUs in the system.""" + '''Return the number of CPUs in the system.''' lnx_re = re.compile(r'^(processor|online)') cpus = 0 @@ -18,9 +18,9 @@ def num_cpus(): return cpus def cpu_freq(): - """ + ''' The frequency (in MHz) of the CPU. - """ + ''' reg = re.compile(r'^cpu MHz\s*:\s*(\d+)', re.M) with open('/proc/cpuinfo', 'r') as f: data = f.read() @@ -31,12 +31,12 @@ def cpu_freq(): return int(match.group(1)) def switch_scheduler(switch_to_in): - """Switch the scheduler to whatever is passed in. + '''Switch the scheduler to whatever is passed in. This methods sleeps for two seconds to give Linux the chance to execute schedule switching code. Raises an exception if the switch does not work. - """ + ''' switch_to = str(switch_to_in).strip() @@ -57,7 +57,7 @@ def uname_matches(reg): return bool( re.match(reg, data) ) def is_executable(fname): - """Return whether the file passed in is executable""" + '''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 -- cgit v1.2.2