1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#!/usr/bin/env python
import defapp
from os.path import splitext, basename
from optparse import make_option as o
from gnuplot import gnuplot, FORMATS
PLUGINS = ['GSN-EDF', 'G-EDF', 'GQ-EDF', 'GHQ-EDF']
MASTER = ['NO_CPU', '3']
EVENTS = ['SCHED', 'SCHED2', 'TICK', 'CXS', 'RELEASE', 'SEND_RESCHED']
DATA = ['avg', 'wc']
options = [
o('-f', '--format', action='store', dest='format', type='choice',
choices=FORMATS, help='output format'),
o(None, '--paper', action='store_true', dest='paper'),
o('-e', '--events', action='append', dest='events', type='choice',
choices=EVENTS),
o('-m', '--master', action='append', dest='master', type='choice',
choices=MASTER),
o('-p', '--plugins', action='append', dest='plugins', type='choice',
choices=PLUGINS),
o('-d', '--data', action='append', dest='data', type='choice',
choices=DATA),
o(None, '--prefix', action='store', dest='prefix'),
]
defaults = {
'format' : 'show',
'xrange' : (45, 455),
'yrange' : (0, 400),
'xticks' : (50, 50),
'yticks' : (0, 10),
'title' : None,
'xlabel' : 'number of tasks',
'ylabel' : 'overhead (us)',
'paper' : False,
'events' : [],
'plugins' : [],
'master' : [],
'data' : [],
'prefix' : '',
}
ev_name = {
'RELEASE' : 'release overhead',
'TICK' : 'tick overhead',
'SCHED' : 'scheduling overhead',
'SCHED2' : 'timer re-arming overhead',
'SEND_RESCHED' : 'IPI latency',
'CXS' : 'context-switching overhead',
}
plugin_name = {
'GSN-EDF NO_CPU' : 'CEm',
'GSN-EDF 3' : 'CE1',
'G-EDF NO_CPU' : 'FEm',
'G-EDF 3' : 'FE1',
'GHQ-EDF NO_CPU' : 'HEm',
'GQ-EDF NO_CPU' : 'CQm',
'GQ-EDF 3' : 'CQ1',
}
def graph(plugin, master, event, wc):
name = "%s %s" % (plugin, master)
return ['%s.R-%s.%s.csv' % (plugin, master, event), 1, 3 if wc else 2,
'%s %s %s' % (plugin_name[name], ev_name[event],
'(worst-case)' if wc else '(average)')]
class OheadPlotter(defapp.App):
def __init__(self):
defapp.App.__init__(self, options, defaults, no_std_opts=True)
if not self.options.events:
self.options.events = EVENTS
if not self.options.plugins:
self.options.plugins = PLUGINS
if not self.options.master:
self.options.master = MASTER
if not self.options.data:
self.options.data = DATA
def plot(self, graphs, title, name, **xtra):
if self.options.paper:
tops = 'color solid font "Helvetica,12" linewidth 1.0 rounded size 16cm,8.5cm'
gnuplot(graphs, title=title,
xlabel=self.options.xlabel,
ylabel=self.options.ylabel,
xrange=self.options.xrange,
# yrange=self.options.yrange,
xticks=self.options.xticks,
# yticks=self.options.yticks,
format=self.options.format,
fname=name,
key='off',
style='lines lw 7',
term_opts=tops)
else:
gnuplot(graphs, title=title,
xlabel=self.options.xlabel,
ylabel=self.options.ylabel,
# xrange=self.options.xrange,
# yrange=self.options.yrange,
xticks=self.options.xticks,
# yticks=self.options.yticks,
format=self.options.format,
fname=name, **xtra)
def do_by_event(self, _):
for d in self.options.data:
wc = d == 'wc'
for e in self.options.events:
gs = []
for p in self.options.plugins:
for m in self.options.master:
if (p != 'GHQ-EDF' or m == 'NO_CPU') and \
(p != 'GQ-EDF' or e != 'SEND_RESCHED'):
gs += [graph(p, m, e, wc)]
fname = '%s%s_%s' % (self.options.prefix, e, d)
title = '%s %s' % ('worst-case' if wc else 'average-case' , ev_name[e])
self.plot(gs, title=title, name=fname)
def do_by_plugin(self, _):
for p in self.options.plugins:
gs = []
for d in self.options.data:
wc = d == 'wc'
for e in self.options.events:
for m in self.options.master:
if (p != 'GHQ-EDF' or m == 'NO_CPU') and \
(p != 'GQ-EDF' or e != 'SEND_RESCHED'):
gs += [graph(p, m, e, wc)]
self.plot(gs, title='%s %s' % (p, 'WC' if wc else 'AVG'), name='')
if __name__ == "__main__":
OheadPlotter().launch()
|