aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common.py17
-rw-r--r--config/config.example.py18
-rw-r--r--experiment/tracer.py29
-rw-r--r--parse/__init__.py0
-rw-r--r--parse/dir_map.py104
-rw-r--r--parse/enum.py7
-rw-r--r--parse/ft.py60
-rw-r--r--parse/point.py135
-rw-r--r--parse/sched.py89
-rw-r--r--parse/tuple_table.py76
-rwxr-xr-x[-rw-r--r--]parse_exps.py85
11 files changed, 600 insertions, 20 deletions
diff --git a/common.py b/common.py
new file mode 100644
index 0000000..a09ef7c
--- /dev/null
+++ b/common.py
@@ -0,0 +1,17 @@
1from collections import defaultdict
2
3def load_params(fname):
4 params = defaultdict(int)
5 with open(fname, 'r') as f:
6 data = f.read()
7 try:
8 parsed = eval(data)
9 # Convert to defaultdict
10 for k in parsed:
11 params[k] = str(parsed[k])
12 except Exception as e:
13 raise IOError("Invalid param file: %s\n%s" % (fname, e))
14
15 return params
16
17
diff --git a/config/config.example.py b/config/config.example.py
index b307687..9675f66 100644
--- a/config/config.example.py
+++ b/config/config.example.py
@@ -1,6 +1,7 @@
1from __future__ import print_function 1from __future__ import print_function
2import os 2import os
3import sys 3import sys
4import itertools
4 5
5""" 6"""
6These are paths to repository directories. 7These are paths to repository directories.
@@ -21,7 +22,8 @@ BINS = {'bespin' : '{}/bespin'.format(REPOS['liblitmus']),
21 'split' : '{}/split'.format(REPOS['analysis']), 22 'split' : '{}/split'.format(REPOS['analysis']),
22 'sort' : '{}/sort-all'.format(REPOS['analysis']), 23 'sort' : '{}/sort-all'.format(REPOS['analysis']),
23 'analyze' : '{}/analyze'.format(REPOS['analysis']), 24 'analyze' : '{}/analyze'.format(REPOS['analysis']),
24 'trace-cmd' : '{}/trace-cmd'.format(REPOS['trace-cmd'])} 25 'trace-cmd' : '{}/trace-cmd'.format(REPOS['trace-cmd']),
26 'st_show' : '{}/st_show'.format(REPOS['sched_trace'])}
25 27
26DEFAULTS = {'params_file' : 'params.py', 28DEFAULTS = {'params_file' : 'params.py',
27 'sched_file' : 'sched.py', 29 'sched_file' : 'sched.py',
@@ -32,11 +34,23 @@ DEFAULTS = {'params_file' : 'params.py',
32FILES = {'ft_data' : 'ft.bin', 34FILES = {'ft_data' : 'ft.bin',
33 'linux_data' : 'trace.dat', 35 'linux_data' : 'trace.dat',
34 'sched_data' : 'st-{}.bin', 36 'sched_data' : 'st-{}.bin',
35 'log_data' : 'trace.slog'} 37 'log_data' : 'trace.slog',}
36 38
37PARAMS = {'sched' : 'scheduler', 39PARAMS = {'sched' : 'scheduler',
38 'dur' : 'duration'} 40 'dur' : 'duration'}
39 41
42SCHED_EVENTS = range(501, 513)
43BASE_EVENTS = ['SCHED', 'RELEASE', 'SCHED2', 'TICK', 'CXS']
44
45# Expand for mixed-crit
46# CRIT_EVENTS = ['LVL{}_SCHED', 'LEVEL{}_RELEASE']
47# CRIT_LEVELS = ['A', 'B', 'C']
48# BASE_EVENTS += [s.format(l) for (l,s) in
49# itertools.product(CRIT_LEVELS, CRIT_EVENTS)]
50
51ALL_EVENTS = ["%s_%s" % (e, t) for (e,t) in
52 itertools.product(BASE_EVENTS, ["START","END"])]
53
40valid = True 54valid = True
41for repo, loc in REPOS.items(): 55for repo, loc in REPOS.items():
42 if not os.path.isdir(loc): 56 if not os.path.isdir(loc):
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 @@
1import litmus_util 1import litmus_util
2import os 2import os
3import config.config as conf
4
3from operator import methodcaller 5from operator import methodcaller
4from executable.ftcat import FTcat,Executable 6from executable.ftcat import FTcat,Executable
5from config.config import FILES,BINS 7
6 8
7class Tracer(object): 9class 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
64class SchedTracer(Tracer): 66class 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
86class OverheadTracer(Tracer): 87class 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
diff --git a/parse/__init__.py b/parse/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/parse/__init__.py
diff --git a/parse/dir_map.py b/parse/dir_map.py
new file mode 100644
index 0000000..6e959f2
--- /dev/null
+++ b/parse/dir_map.py
@@ -0,0 +1,104 @@
1import os
2
3from collections import defaultdict
4from point import Type
5
6class TreeNode(object):
7 def __init__(self, parent = None):
8 self.parent = parent
9 self.children = defaultdict(lambda : TreeNode(self))
10 self.values = []
11
12class DirMap(object):
13 def to_csv(self, vals):
14 val_strs = []
15 for key in sorted(vals.keys()):
16 val_strs += ["%s=%s" % (key, vals[key])]
17 return "%s.csv" % ("_".join(val_strs))
18
19 def __init__(self, out_dir):
20 self.root = TreeNode(None)
21 self.out_dir = out_dir
22 self.values = []
23
24 def debug_update_node(self, path, keys, value):
25 self.__update_node(path, keys, value)
26
27 def __update_node(self, path, keys, value):
28 node = self.root
29
30 path += [ self.to_csv(keys) ]
31 for p in path:
32 node = node.children[p]