diff options
Diffstat (limited to 'experiment/tracer.py')
-rw-r--r-- | experiment/tracer.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/experiment/tracer.py b/experiment/tracer.py index d7743ad..ad4ebfe 100644 --- a/experiment/tracer.py +++ b/experiment/tracer.py | |||
@@ -1,8 +1,10 @@ | |||
1 | import litmus_util | 1 | import litmus_util |
2 | import os | 2 | import os |
3 | import config.config as conf | ||
4 | |||
3 | from operator import methodcaller | 5 | from operator import methodcaller |
4 | from executable.ftcat import FTcat,Executable | 6 | from executable.ftcat import FTcat,Executable |
5 | from config.config import FILES,BINS | 7 | |
6 | 8 | ||
7 | class Tracer(object): | 9 | class Tracer(object): |
8 | def __init__(self, name, output_dir): | 10 | def __init__(self, name, output_dir): |
@@ -27,11 +29,11 @@ class LinuxTracer(Tracer): | |||
27 | 29 | ||
28 | extra_args = ["record", "-e", "sched:sched_switch", | 30 | extra_args = ["record", "-e", "sched:sched_switch", |
29 | "-e", "litmus:*", | 31 | "-e", "litmus:*", |
30 | "-o", "%s/%s" % (output_dir, FILES['linux_data'])] | 32 | "-o", "%s/%s" % (output_dir, conf.FILES['linux_data'])] |
31 | stdout = open('%s/trace-cmd-stdout.txt' % self.output_dir, 'w') | 33 | stdout = open('%s/trace-cmd-stdout.txt' % self.output_dir, 'w') |
32 | stderr = open('%s/trace-cmd-stderr.txt' % self.output_dir, 'w') | 34 | stderr = open('%s/trace-cmd-stderr.txt' % self.output_dir, 'w') |
33 | 35 | ||
34 | execute = Executable(BINS['trace-cmd'], extra_args, stdout, stderr) | 36 | execute = Executable(conf.BINS['trace-cmd'], extra_args, stdout, stderr) |
35 | self.bins.append(execute) | 37 | self.bins.append(execute) |
36 | 38 | ||
37 | @staticmethod | 39 | @staticmethod |
@@ -49,7 +51,7 @@ class LogTracer(Tracer): | |||
49 | def __init__(self, output_dir): | 51 | def __init__(self, output_dir): |
50 | super(LogTracer, self).__init__("Logger", output_dir) | 52 | super(LogTracer, self).__init__("Logger", output_dir) |
51 | 53 | ||
52 | out_file = open("%s/%s" % (self.output_dir, FILES['log_data']), 'w') | 54 | out_file = open("%s/%s" % (self.output_dir, conf.FILES['log_data']), 'w') |
53 | 55 | ||
54 | cat = (Executable("/bin/cat", [LogTracer.DEVICE_STR])) | 56 | cat = (Executable("/bin/cat", [LogTracer.DEVICE_STR])) |
55 | cat.stdout_file = out_file | 57 | cat.stdout_file = out_file |
@@ -62,7 +64,6 @@ class LogTracer(Tracer): | |||
62 | 64 | ||
63 | 65 | ||
64 | class SchedTracer(Tracer): | 66 | class SchedTracer(Tracer): |
65 | EVENTS = range(501, 510) # not including 511 | ||
66 | DEVICE_STR = '/dev/litmus/sched_trace' | 67 | DEVICE_STR = '/dev/litmus/sched_trace' |
67 | 68 | ||
68 | def __init__(self, output_dir): | 69 | def __init__(self, output_dir): |
@@ -74,7 +75,7 @@ class SchedTracer(Tracer): | |||
74 | stdout_f = open('%s/st-%d.bin' % (self.output_dir, cpu), 'w') | 75 | stdout_f = open('%s/st-%d.bin' % (self.output_dir, cpu), 'w') |
75 | stderr_f = open('%s/st-%d-stderr.txt' % (self.output_dir, cpu), 'w') | 76 | stderr_f = open('%s/st-%d-stderr.txt' % (self.output_dir, cpu), 'w') |
76 | dev = '{0}{1}'.format(SchedTracer.DEVICE_STR, cpu) | 77 | dev = '{0}{1}'.format(SchedTracer.DEVICE_STR, cpu) |
77 | ftc = FTcat(BINS['ftcat'], stdout_f, stderr_f, dev, SchedTracer.EVENTS, cpu=cpu) | 78 | ftc = FTcat(conf.BINS['ftcat'], stdout_f, stderr_f, dev, conf.SCHED_EVENTS, cpu=cpu) |
78 | 79 | ||
79 | self.bins.append(ftc) | 80 | self.bins.append(ftc) |
80 | 81 | ||
@@ -85,22 +86,14 @@ class SchedTracer(Tracer): | |||
85 | 86 | ||
86 | class OverheadTracer(Tracer): | 87 | class OverheadTracer(Tracer): |
87 | DEVICE_STR = '/dev/litmus/ft_trace0' | 88 | DEVICE_STR = '/dev/litmus/ft_trace0' |
88 | EVENTS = [# 'SCHED_START', 'SCHED_END', 'SCHED2_START', 'SCHED2_END', | ||
89 | 'RELEASE_START', 'RELEASE_END', | ||
90 | 'LVLA_RELEASE_START', 'LVLA_RELEASE_END', | ||
91 | 'LVLA_SCHED_START', 'LVLA_SCHED_END', | ||
92 | 'LVLB_RELEASE_START', 'LVLB_RELEASE_END', | ||
93 | 'LVLB_SCHED_START', 'LVLB_SCHED_END', | ||
94 | 'LVLC_RELEASE_START', 'LVLC_RELEASE_END', | ||
95 | 'LVLC_SCHED_START', 'LVLC_SCHED_END'] | ||
96 | 89 | ||
97 | def __init__(self, output_dir): | 90 | def __init__(self, output_dir): |
98 | super(OverheadTracer, self).__init__("Overhead Trace", output_dir) | 91 | super(OverheadTracer, self).__init__("Overhead Trace", output_dir) |
99 | 92 | ||
100 | stdout_f = open('{0}/{1}'.format(self.output_dir, FILES['ft_data']), 'w') | 93 | stdout_f = open('{0}/{1}'.format(self.output_dir, conf.FILES['ft_data']), 'w') |
101 | stderr_f = open('{0}/{1}.stderr.txt'.format(self.output_dir, FILES['ft_data']), 'w') | 94 | stderr_f = open('{0}/{1}.stderr.txt'.format(self.output_dir, conf.FILES['ft_data']), 'w') |
102 | ftc = FTcat(BINS['ftcat'], stdout_f, stderr_f, | 95 | ftc = FTcat(conf.BINS['ftcat'], stdout_f, stderr_f, |
103 | OverheadTracer.DEVICE_STR, OverheadTracer.EVENTS) | 96 | OverheadTracer.DEVICE_STR, conf.ALL_EVENTS) |
104 | 97 | ||
105 | self.bins.append(ftc) | 98 | self.bins.append(ftc) |
106 | 99 | ||