aboutsummaryrefslogtreecommitdiffstats
path: root/run/executable/ftcat.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-11-26 17:06:27 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2012-11-26 17:06:27 -0500
commitb43b83beead92ff7cf28a5fe5a2710537268aae1 (patch)
treed9c29b14cd18a9df520f36d7e85eb460c30fa7a9 /run/executable/ftcat.py
parentcb8db5d30ee769304c2c2b00f2a7d9bcb3c4098f (diff)
Read locations of binary files from path instead of config.py.
Diffstat (limited to 'run/executable/ftcat.py')
-rw-r--r--run/executable/ftcat.py33
1 files changed, 33 insertions, 0 deletions
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 @@
1import os
2import stat
3
4from executable import Executable
5
6class FTcat(Executable):
7 '''Used to wrap the ftcat binary in the Experiment object.'''
8
9 def __init__(self, ft_cat_bin, stdout_file, stderr_file, dev, events, cpu=None):
10 '''Extends the Executable initializer method with ftcat attributes.'''
11
12 # hack to run FTCat at higher priority
13 chrt_bin = '/usr/bin/chrt'
14
15 super(FTcat, self).__init__(chrt_bin)
16 self.stdout_file = stdout_file
17 self.stderr_file = stderr_file
18
19 mode = os.stat(dev)[stat.ST_MODE]
20 if not mode & stat.S_IFCHR:
21 raise Exception("%s is not a character device" % dev)
22
23 if events is None:
24 raise Exception('No events!')
25
26 # hack to run FTCat at higher priority
27 self.extra_args = ['-f', '40']
28 if cpu is not None:
29 # and bind it to a CPU
30 self.extra_args.extend(['/usr/bin/taskset', '-c', str(cpu)])
31 events_str_arr = map(str, events)
32 self.extra_args.extend([ft_cat_bin, dev] + events_str_arr)
33