From b43b83beead92ff7cf28a5fe5a2710537268aae1 Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Mon, 26 Nov 2012 17:06:27 -0500 Subject: Read locations of binary files from path instead of config.py. --- run/executable/ftcat.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 run/executable/ftcat.py (limited to 'run/executable/ftcat.py') diff --git a/run/executable/ftcat.py b/run/executable/ftcat.py new file mode 100644 index 0000000..5da8fa7 --- /dev/null +++ b/run/executable/ftcat.py @@ -0,0 +1,33 @@ +import os +import stat + +from executable import Executable + +class FTcat(Executable): + '''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.''' + + # hack to run FTCat at higher priority + chrt_bin = '/usr/bin/chrt' + + super(FTcat, self).__init__(chrt_bin) + self.stdout_file = stdout_file + self.stderr_file = stderr_file + + mode = os.stat(dev)[stat.ST_MODE] + if not mode & stat.S_IFCHR: + raise Exception("%s is not a character device" % dev) + + if events is None: + raise Exception('No events!') + + # hack to run FTCat at higher priority + self.extra_args = ['-f', '40'] + if cpu is not None: + # and bind it to a CPU + self.extra_args.extend(['/usr/bin/taskset', '-c', str(cpu)]) + events_str_arr = map(str, events) + self.extra_args.extend([ft_cat_bin, dev] + events_str_arr) + -- cgit v1.2.2