aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@sprg.uniroma2.it>2010-04-09 00:30:04 -0400
committerAndrea Bastoni <bastoni@sprg.uniroma2.it>2010-04-09 00:30:04 -0400
commitcf47870875e03488442ed39d96acfddfa2993f02 (patch)
tree02c1957b94dafc20cd19c3d2ed1d3c82a3111c43
parent36b6614fa9ea3c2656aedb385c5c4154917aa618 (diff)
parent5a908690888395010b8a6615bc6ee3185920f2dc (diff)
Merge branch 'master' of cvs.cs.unc.edu:/cvs/proj/litmus/repo/simple-gnuplot-wrapper
Conflicts: gnuplot.py - Merge to add my "non clean" (ehm.. crappy) support to errorbars in plot_pm.py
-rwxr-xr-xgnuplot.py48
-rwxr-xr-xplot.py31
-rwxr-xr-xplot_pm2.py407
-rw-r--r--stats.py29
-rw-r--r--util.py40
5 files changed, 524 insertions, 31 deletions
diff --git a/gnuplot.py b/gnuplot.py
index 4a34d1f..2604cb0 100755
--- a/gnuplot.py
+++ b/gnuplot.py
@@ -16,12 +16,39 @@ class CommandBuffer(object):
16 def __str__(self): 16 def __str__(self):
17 return '\n'.join([str(x) for x in self.cmds]) 17 return '\n'.join([str(x) for x in self.cmds])
18 18
19class FileGraph(object):
20 def __init__(self, fname, xcol=1, ycol=2, error=None,
21 title=None,
22 style=None):
23 self.fname = fname
24 self.xcol = xcol
25 self.ycol = ycol
26 self.error = error
27 self.title = title
28 self.style = style
29
30 def __str__(self):
31 return self.get_command()
32
33 def get_command(self, default_style=None):
34 if self.error:
35 using_txt = "%s:%s:%s" % (self.xcol, self.ycol, self.error)
36 style = self.style if self.style else "errorbars"
37 else:
38 using_txt = "%s:%s" % (self.xcol, self.ycol)
39 style = self.style if self.style else default_style
40 style_txt = " with %s" % style if style else ""
41 title_txt = " title '%s'" % self.title if self.title else ""
42 return "'%s' using %s%s%s" % \
43 (self.fname, using_txt, title_txt, style_txt)
44
19def gnuplot_cmd(graphs, title=None, ylabel=None, xlabel=None, 45def gnuplot_cmd(graphs, title=None, ylabel=None, xlabel=None,
20 format='show', term_opts=None, 46 format='show', term_opts=None,
21 style='linespoints', xrange=None, 47 style='linespoints', xrange=None,
22 yrange=None, 48 yrange=None,
23 xticks=None, yticks=None, 49 xticks=None, yticks=None,
24 key='below', 50 key='below',
51 logscale=None,
25 fname=None): 52 fname=None):
26 g = CommandBuffer() 53 g = CommandBuffer()
27 if format == 'png': 54 if format == 'png':
@@ -57,18 +84,31 @@ def gnuplot_cmd(graphs, title=None, ylabel=None, xlabel=None,
57 g("set xtics %s, %s" % xticks) 84 g("set xtics %s, %s" % xticks)
58 if yticks: 85 if yticks:
59 g("set ytics %s, %s" % yticks) 86 g("set ytics %s, %s" % yticks)
87 if logscale:
88 if type(logscale) == tuple:
89 for x in logscale:
90 g("set logscale %s" % x)
91 else:
92 g("set logscale %s" % logscale)
60 g('set key %s' % key) 93 g('set key %s' % key)
61 plot = [] 94 plot = []
62 for gr in graphs: 95 for gr in graphs:
63 if len(gr) == 4: 96 if type(gr) == str:
97 # literal plot command
98 plot.append(str(gr))
99 elif type(gr) == FileGraph:
100 # formatter object
101 plot.append(gr.get_command(style))
102 elif len(gr) == 4:
64 par = (gr[0], gr[1], gr[2], gr[3], style) 103 par = (gr[0], gr[1], gr[2], gr[3], style)
65 plot += ["'%s' using %s:%s title '%s' with %s" % par] 104 plot += ["'%s' using %s:%s title '%s' with %s" % par]
66 elif len(gr) == 6: 105 elif len(gr) == 6:
67 par = (gr[0], gr[1], gr[2], gr[3], gr[4], style, gr[5]) 106 par = (gr[0], gr[1], gr[2], gr[3], gr[4], style, gr[5])
68 plot += ["'%s' using %s:%s:%s:%s with %s title '%s'" % par] 107 plot += ["'%s' using %s:%s:%s:%s with %s title '%s'" % par]
69 else: 108 elif len(gr) == 5:
70 par = gr 109 plot += ["'%s' using %s:%s title '%s' with %s" % gr]
71 plot += ["'%s' using %s:%s title '%s' with %s" % par] 110 elif len(gr) == 3:
111 plot += ["%s title '%s' with %s" % gr]
72 if plot: 112 if plot:
73 g('plot ' + ', '.join(plot)) 113 g('plot ' + ', '.join(plot))
74 if format != 'show' and fname: 114 if format != 'show' and fname:
diff --git a/plot.py b/plot.py
index 426b77c..6acd1ea 100755
--- a/plot.py
+++ b/plot.py
@@ -11,6 +11,7 @@ options = [
11 choices=FORMATS, help='output format'), 11 choices=FORMATS, help='output format'),
12 o(None, '--paper', action='store_true', dest='paper'), 12 o(None, '--paper', action='store_true', dest='paper'),
13 o(None, '--wide', action='store_true', dest='wide'), 13 o(None, '--wide', action='store_true', dest='wide'),
14 o(None, '--column', action='store_true', dest='column'),
14 o(None, '--split', action='store_true', dest='split'), 15 o(None, '--split', action='store_true', dest='split'),
15 ] 16 ]
16 17
@@ -26,6 +27,7 @@ defaults = {
26 'paper' : False, 27 'paper' : False,
27 'split' : False, 28 'split' : False,
28 'wide' : False, 29 'wide' : False,
30 'column' : False,
29 } 31 }
30 32
31def decode(name): 33def decode(name):
@@ -117,6 +119,27 @@ class SchedPlotter(defapp.App):
117 term_opts=tops, 119 term_opts=tops,
118 **xtra) 120 **xtra)
119 121
122# width = 3.4in
123# height = 2.0in
124
125 def plot_column(self, graphs, title, name, conf, **xtra):
126 scale = 1.0
127 tops = 'color solid font "Helvetica,8" linewidth 1.0 ' \
128 'rounded size %.1fin,%.1fin' % (scale * 7.0, scale * 2.0)
129 gnuplot(graphs, title=title,
130 xlabel=self.options.xlabel,
131 ylabel=self.options.ylabel +
132 (' [soft]' if 'soft' in conf else ' [hard]'),
133 xrange=self.options.xrange,
134 yrange=self.options.yrange,
135 xticks=self.options.xticks,
136 yticks=self.options.yticks,
137 format=self.options.format,
138 fname=name,
139 key='right bottom' if '250' in conf else 'right top',
140 term_opts=tops)
141
142
120 def plot_paper(self, graphs, title, name, conf, **xtra): 143 def plot_paper(self, graphs, title, name, conf, **xtra):
121 tops = 'color solid font "Helvetica,10" linewidth 1.0 rounded size 16cm,8.5cm' 144 tops = 'color solid font "Helvetica,10" linewidth 1.0 rounded size 16cm,8.5cm'
122 gnuplot(graphs, title=title, 145 gnuplot(graphs, title=title,
@@ -283,9 +306,9 @@ class SchedPlotter(defapp.App):
283 (tmpfile, 1, 9, 'P-EDF'), 306 (tmpfile, 1, 9, 'P-EDF'),
284 ] 307 ]
285 308
286 self.options.xrange = (-5, 1005) 309 self.options.xrange = (-5, 5005)
287 self.options.xticks = (0, 50) 310 self.options.xticks = (0, 250)
288 self.options.xlabel = "preemption/migration overhead (in us)" 311 self.options.xlabel = "cache-related preemption/migration delay (in us)"
289 for (tag, gs) in [('cumulative', graphs), ('weighted', graphs_w)]: 312 for (tag, gs) in [('cumulative', graphs), ('weighted', graphs_w)]:
290 xname = name + '_' + tag 313 xname = name + '_' + tag
291 self.options.ylabel = tag + ' schedulability' 314 self.options.ylabel = tag + ' schedulability'
@@ -293,6 +316,8 @@ class SchedPlotter(defapp.App):
293 self.plot_paper(gs, title, xname, conf) 316 self.plot_paper(gs, title, xname, conf)
294 elif self.options.wide and self.options.format == 'pdf': 317 elif self.options.wide and self.options.format == 'pdf':
295 self.plot_wide(gs, title, xname, conf) 318 self.plot_wide(gs, title, xname, conf)
319 elif self.options.column and self.options.format == 'pdf':
320 self.plot_column(gs, title, xname, conf)
296 else: 321 else:
297 self.plot(gs, title, xname, conf) 322 self.plot(gs, title, xname, conf)
298 323
diff --git a/plot_pm2.py b/plot_pm2.py
index d53a6da..c2fcbf3 100755
--- a/plot_pm2.py
+++ b/plot_pm2.py
@@ -1,17 +1,50 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2import defapp
3from os.path import splitext, basename 2from os.path import splitext, basename
4from optparse import make_option as o 3from optparse import make_option as o
5from tempfile import NamedTemporaryFile as Tmp 4from tempfile import NamedTemporaryFile as Tmp
6 5
7import csv 6from collections import defaultdict
7from itertools import izip
8
9import numpy as np
10from util import *
11
12import stats
13import defapp
8 14
9from plot import decode 15from plot import decode
10from gnuplot import gnuplot, FORMATS 16from gnuplot import gnuplot, FileGraph, FORMATS
17
18
19
20def ludwig_l2(x, y):
21 # x left column, y right column, or # y left column, x, right column
22 return (x % 8 < 4 and x + 4 == y) or \
23 (y % 8 < 4 and x - 4 == y)
24
25def ludwig_l3(x, y):
26 # same socket
27 # not a a shared L2
28 # not identical
29 return (y % 4) == (x % 4) and \
30 not ludwig_l2(x, y) and \
31 x != y
11 32
12 33
13MACHINE_TOPOLOGY = { 34MACHINE_TOPOLOGY = {
14 'jupiter-cs' : (4, [('preempt', lambda x, y: x == y), ('mem', lambda x, y: x != y)])