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