aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--common.py25
-rw-r--r--config/config.example.py58
-rw-r--r--config/config.py45
-rw-r--r--parse/ft.py2
-rw-r--r--parse/sched.py14
-rw-r--r--run/__init__.py (renamed from experiment/__init__.py)0
-rw-r--r--run/executable/__init__.py (renamed from experiment/executable/__init__.py)0
-rw-r--r--run/executable/executable.py (renamed from experiment/executable/executable.py)0
-rw-r--r--run/executable/ftcat.py (renamed from experiment/executable/ftcat.py)0
-rw-r--r--run/experiment.py (renamed from experiment/experiment.py)0
-rw-r--r--run/litmus_util.py (renamed from experiment/litmus_util.py)0
-rw-r--r--run/proc_entry.py (renamed from experiment/proc_entry.py)0
-rw-r--r--run/tracer.py (renamed from experiment/tracer.py)18
14 files changed, 86 insertions, 77 deletions
diff --git a/.gitignore b/.gitignore
index 5d257d4..dfe8620 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
1config/config.py
2*~ 1*~
3\#*# 2\#*#
4*.pyc 3*.pyc
diff --git a/common.py b/common.py
index 984f584..0990cfe 100644
--- a/common.py
+++ b/common.py
@@ -2,6 +2,29 @@ import sys
2from collections import defaultdict 2from collections import defaultdict
3from textwrap import dedent 3from textwrap import dedent
4 4
5def get_executable(prog, hint, optional=False):
6 import os
7 def is_exe(fpath):
8 return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
9
10 fpath, fname = os.path.split(prog)
11 if fpath:
12 if is_exe(prog):
13 return prog
14 else:
15 for path in os.environ["PATH"].split(os.pathsep):
16 exe_file = os.path.join(path, prog)
17 if is_exe(exe_file):
18 return exe_file
19
20 if not optional:
21 sys.stderr.write("Cannot find executable '%s' in PATH. This is a part "
22 "of '%s' which should be added to PATH to run." %
23 (prog, hint))
24 sys.exit(1)
25 else:
26 return None
27
5def recordtype(typename, field_names, default=0): 28def recordtype(typename, field_names, default=0):
6 ''' Mutable namedtuple. Recipe from George Sakkis of MIT.''' 29 ''' Mutable namedtuple. Recipe from George Sakkis of MIT.'''
7 field_names = tuple(map(str, field_names)) 30 field_names = tuple(map(str, field_names))
@@ -87,5 +110,3 @@ def load_params(fname):
87 raise IOError("Invalid param file: %s\n%s" % (fname, e)) 110 raise IOError("Invalid param file: %s\n%s" % (fname, e))
88 111
89 return params 112 return params
90
91
diff --git a/config/config.example.py b/config/config.example.py
deleted file mode 100644
index 9f24097..0000000
--- a/config/config.example.py
+++ /dev/null
@@ -1,58 +0,0 @@
1from __future__ import print_function
2import os
3import sys
4import itertools
5
6'''
7These are paths to repository directories.
8
9'''
10REPOS = {'liblitmus' : '/home/hermanjl/git/liblitmus',
11 'sched_trace' : '/home/hermanjl/git/sched_trace',
12 'ft_tools' : '/home/hermanjl/git/feather-trace-tools',
13 'trace-cmd' : '/home/hermanjl/git/trace-cmd'}
14
15BINS = {'rtspin' : '{}/rtspin'.format(REPOS['liblitmus']),
16 'release' : '{}/release_ts'.format(REPOS['liblitmus']),
17 'ftcat' : '{}/ftcat'.format(REPOS['ft_tools']),
18 'ftsplit' : '{}/ft2csv'.format(REPOS['ft_tools']),
19 'ftsort' : '{}/ftsort'.format(REPOS['ft_tools']),
20 'st_trace' : '{}/st_trace'.format(REPOS['ft_tools']),
21 'trace-cmd' : '{}/trace-cmd'.format(REPOS['trace-cmd']),
22 'st_show' : '{}/st_show'.format(REPOS['sched_trace'])}
23
24DEFAULTS = {'params_file' : 'params.py',
25 'sched_file' : 'sched.py',
26 'exps_file' : 'exps.py',
27 'duration' : 10,
28 'spin' : 'rtspin',
29 'cycles' : 2000}
30
31FILES = {'ft_data' : 'ft.bin',
32 'linux_data' : 'trace.dat',
33 'sched_data' : 'st-{}.bin',
34 'log_data' : 'trace.slog',}
35
36PARAMS = {'sched' : 'scheduler',
37 'dur' : 'duration',
38 'kernel': 'uname',
39 'cycles' : 'cpu-frequency'}
40
41SCHED_EVENTS = range(501, 513)
42BASE_EVENTS = ['SCHED', 'RELEASE', 'SCHED2', 'TICK', 'CXS']
43ALL_EVENTS = ["%s_%s" % (e, t) for (e,t) in
44 itertools.product(BASE_EVENTS, ["START","END"])]
45ALL_EVENTS += ['RELEASE_LATENCY']
46BASE_EVENTS += ['RELEASE_LATENCY']
47
48valid = True
49for repo, loc in REPOS.items():
50 if not os.path.isdir(loc):
51 valid = False
52 print("Cannot access repo '%s' at '%s'" % (repo, loc), file=sys.stderr)
53for prog, loc in BINS.items():
54 if not os.path.isfile(loc):
55 valid = False
56 print("Cannot access program '%s' at '%s'" % (prog, loc), file=sys.stderr)
57if not valid:
58 print("Errors in config file", file=sys.stderr)
diff --git a/config/config.py b/config/config.py
new file mode 100644
index 0000000..3282705
--- /dev/null
+++ b/config/config.py
@@ -0,0 +1,45 @@
1from __future__ import print_function
2import itertools
3from common import get_executable
4
5'''Paths to binaries.'''
6BINS = {'rtspin' : get_executable('rtspin', 'liblitmus'),
7 'release' : get_executable('release_ts', 'liblitmus'),
8 'ftcat' : get_executable('ftcat', 'feather-trace-tools'),
9 'ftsplit' : get_executable('ft2csv', 'feather-trace-tools'),
10 'ftsort' : get_executable('ftsort', 'feather-trace-tools'),
11 'st_trace' : get_executable('st_trace', 'feather-trace-tools'),
12 'trace-cmd' : get_executable('trace-cmd', 'rt-kernelshark'),
13 # Optional, as sched_trace is not a publically supported repository
14 'st_show' : get_executable('st_show', 'sched_trace', True)}
15
16'''Names of output files.'''
17FILES = {'ft_data' : 'ft.bin',
18 'linux_data' : 'trace.dat',
19 'sched_data' : 'st-{}.bin',
20 'log_data' : 'trace.slog',}
21
22'''Default parameter names in params.py.'''
23PARAMS = {'sched' : 'scheduler',
24 'dur' : 'duration',
25 'kernel' : 'uname',
26 'cycles' : 'cpu-frequency'}
27
28'''Default values for program parameters.'''
29DEFAULTS = {'params_file' : 'params.py',
30 'sched_file' : 'sched.py',
31 'exps_file' : 'exps.py',
32 'duration' : 10,
33 'spin' : 'rtspin',
34 'cycles' : 2000}
35
36'''Default sched_trace events (this is all of them).'''
37SCHED_EVENTS = range(501, 513)
38
39'''Overhead events.'''
40OVH_BASE_EVENTS = ['SCHED', 'RELEASE', 'SCHED2', 'TICK', 'CXS']
41OVH_ALL_EVENTS = ["%s_%s" % (e, t) for (e,t) in
42 itertools.product(OVH_BASE_EVENTS, ["START","END"])]
43OVH_ALL_EVENTS += ['RELEASE_LATENCY']
44# This event doesn't have a START and END
45OVH_BASE_EVENTS += ['RELEASE_LATENCY']
diff --git a/parse/ft.py b/parse/ft.py
index fea246a..a6596b7 100644
--- a/parse/ft.py
+++ b/parse/ft.py
@@ -71,7 +71,7 @@ def extract_ft_data(result, data_dir, work_dir, cycles):
71 with open("%s/%s" % (work_dir, FT_ERR_NAME), 'w') as err_file: 71 with open("%s/%s" % (work_dir, FT_ERR_NAME), 'w') as err_file:
72 sorted_bin = sort_ft(bin_file, err_file, work_dir) 72 sorted_bin = sort_ft(bin_file, err_file, work_dir)
73 73
74 for event in conf.BASE_EVENTS: 74 for event in conf.OVH_BASE_EVENTS:
75 parse_overhead(result, sorted_bin, event, cycles, 75 parse_overhead(result, sorted_bin, event, cycles,
76 work_dir, err_file) 76 work_dir, err_file)
77 77
diff --git a/parse/sched.py b/parse/sched.py
index ffc6224..512ac73 100644
--- a/parse/sched.py
+++ b/parse/sched.py
@@ -32,8 +32,8 @@ class TimeTracker:
32 self.job = record.job 32 self.job = record.job
33 33
34# Data stored for each task 34# Data stored for each task
35TaskParams = namedtuple('TaskParams', ['wcet', 'period', 'cpu']) 35TaskParams = namedtuple('TaskParams', ['wcet', 'period', 'cpu'])
36TaskData = recordtype('TaskData', ['params', 'jobs', 'blocks', 'misses']) 36TaskData = recordtype('TaskData', ['params', 'jobs', 'blocks', 'misses'])
37 37
38# Map of event ids to corresponding class, binary format, and processing methods 38# Map of event ids to corresponding class, binary format, and processing methods
39RecordInfo = namedtuple('RecordInfo', ['clazz', 'fmt', 'method']) 39RecordInfo = namedtuple('RecordInfo', ['clazz', 'fmt', 'method'])
@@ -151,10 +151,12 @@ def extract_sched_data(result, data_dir, work_dir):
151 return 151 return
152 152
153 # Save an in-english version of the data for debugging 153 # Save an in-english version of the data for debugging
154 cmd_arr = [conf.BINS['st_show']] 154 # This is optional and will only be done if 'st_show' is in PATH
155 cmd_arr.extend(bins) 155 if conf.BINS['st_show']:
156 with open(output_file, "w") as f: 156 cmd_arr = [conf.BINS['st_show']]
157 subprocess.call(cmd_arr, cwd=data_dir, stdout=f) 157 cmd_arr.extend(bins)
158 with open(output_file, "w") as f:
159 subprocess.call(cmd_arr, cwd=data_dir, stdout=f)
158 160
159 task_dict = defaultdict(lambda : 161 task_dict = defaultdict(lambda :