output.py (1915:53799fe15b83) output.py (1929:fb189519cb06)
1# Copyright (c) 2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 12 unchanged lines hidden (view full) ---

21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Nathan Binkert
28
1# Copyright (c) 2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 12 unchanged lines hidden (view full) ---

21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Nathan Binkert
28
29class dbinfo(object):
30 def get(self, job, stat):
31 import info
32
33 run = info.source.allRunNames.get(job.name, None)
34 if run is None:
35 print 'run "%s" not found' % job
36 return None
37
38 stat.system = info.source[job.system]
39 info.display_run = run.run;
40 val = float(stat)
41 if val == 1e300*1e300:
42 return None
43 return val
44
45class StatOutput(object):
29class StatOutput(object):
46 def __init__(self, name, jobfile, stat=None, info=dbinfo(), binstats=None):
30 def __init__(self, name, jobfile, info, stat=None, binstats=None):
47 self.name = name
48 self.jobfile = jobfile
49 self.stat = stat
50 self.binstats = None
51 self.label = self.name
52 self.invert = False
53 self.info = info
54

--- 81 unchanged lines hidden (view full) ---

136 print >>html, '<html>'
137 print >>html, '<title>Graphs for %s</title>' % self.name
138 print >>html, '<body>'
139
140 for options in self.jobfile.options(groups):
141 data = zeros((len(groupopts), len(baropts)), Float)
142 data = [ [ None ] * len(baropts) for i in xrange(len(groupopts)) ]
143 enabled = False
31 self.name = name
32 self.jobfile = jobfile
33 self.stat = stat
34 self.binstats = None
35 self.label = self.name
36 self.invert = False
37 self.info = info
38

--- 81 unchanged lines hidden (view full) ---

120 print >>html, '<html>'
121 print >>html, '<title>Graphs for %s</title>' % self.name
122 print >>html, '<body>'
123
124 for options in self.jobfile.options(groups):
125 data = zeros((len(groupopts), len(baropts)), Float)
126 data = [ [ None ] * len(baropts) for i in xrange(len(groupopts)) ]
127 enabled = False
144 stacked = None
128 stacked = 0
145 for g,gopt in enumerate(groupopts):
146 for b,bopt in enumerate(baropts):
147 job = self.jobfile.job(options + [ gopt, bopt ])
148 if not job:
149 continue
150
151 val = self.info.get(job, self.stat)
129 for g,gopt in enumerate(groupopts):
130 for b,bopt in enumerate(baropts):
131 job = self.jobfile.job(options + [ gopt, bopt ])
132 if not job:
133 continue
134
135 val = self.info.get(job, self.stat)
152 if val is None:
153 val = 0.0
154 curstacked = isinstance(val, (list, tuple))
155 if stacked is None:
156 stacked = curstacked
157 else:
158 if stacked != curstacked:
159 raise ValueError, "some stats stacked, some not"
136 if isinstance(val, (list, tuple)):
137 if len(val) == 1:
138 val = val[0]
139 else:
140 stacked = len(val)
160
161 data[g][b] = val
162
141
142 data[g][b] = val
143
144 if stacked == 0:
145 for i in xrange(len(groupopts)):
146 for j in xrange(len(baropts)):
147 if data[i][j] is None:
148 data[i][j] = 0.0
149 else:
150 for i in xrange(len(groupopts)):
151 for j in xrange(len(baropts)):
152 val = data[i][j]
153 if val is None:
154 data[i][j] = [] * stacked
155 elif len(val) != stacked:
156 raise ValueError, "some stats stacked, some not"
157
163 data = array(data)
164 if data.sum() == 0:
165 continue
166
167 bar_descs = [ opt.desc for opt in baropts ]
168 group_descs = [ opt.desc for opt in groupopts ]
169 if stacked:
158 data = array(data)
159 if data.sum() == 0:
160 continue
161
162 bar_descs = [ opt.desc for opt in baropts ]
163 group_descs = [ opt.desc for opt in groupopts ]
164 if stacked:
170 legend = self.info.rcategories
165 try:
166 legend = self.info.rcategories
167 except:
168 legend = [ str(i) for i in xrange(stacked) ]
171 else:
172 legend = bar_descs
173
174 chart = BarChart(data=data, xlabel='Benchmark', ylabel=self.label,
175 legend=legend, xticks=group_descs)
176 chart.graph()
177
178 names = [ opt.name for opt in options ]

--- 12 unchanged lines hidden ---
169 else:
170 legend = bar_descs
171
172 chart = BarChart(data=data, xlabel='Benchmark', ylabel=self.label,
173 legend=legend, xticks=group_descs)
174 chart.graph()
175
176 names = [ opt.name for opt in options ]

--- 12 unchanged lines hidden ---