diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-11-22 21:50:34 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-11-22 21:50:34 -0500 |
commit | c0a4836077425e03cc39dfba88bec7da21af950b (patch) | |
tree | 1e609627fbc2cc30df64a0698fc150a7ad3e3fd3 /util/stats/chart.py | |
parent | 7819ca6b97f96f1f5e5aeb66b33aa9a764e649ae (diff) | |
download | gem5-c0a4836077425e03cc39dfba88bec7da21af950b.tar.xz |
Major improvements in the graph output code. Mostly adding more
options, making existing options more visible and dealing with
holes in data better.
util/stats/barchart.py:
- move the options for BarChart to a base class ChartOptions so
they can be more easily set and copied.
- add an option to set the chart size (so you can adjust the aspect ratio)
- don't do the add_subplot thing, use add_axes directly so we can
affect the size of the figure itself to make room for the legend
- make the initial array bottom floating point so we don't lose precision
- add an option to set the limits on the y axis
- use a figure legend instead of an axes legend so we can put the legend
outside of the actual chart. Also add an option to set the fontsize of
the legend.
- initial hack at outputting csv files
util/stats/db.py:
don't print out an error when the run is missing from the database
just return None, the error will be print elsewhere.
util/stats/output.py:
- make StatOutput derive from ChartOptions so that it's easier to
set default chart options.
- make the various output functions (graph, display, etc.) take the
name of the data as a parameter instead of making it a parameter to
__init__. This allows me to create the StatOutput object with
generic parameters while still being able to specialize the name
after the fact
- add support for graph_group and graph_bars to be applied to multiple
configuration groups. This results in a cross product of the groups
to be generated and used.
- flush the html file output as we go so that we can load the file
while graphs are still being generated.
- make the proxy a parameter to the graph function so the proper system's
data can be graphed
- for any groups or bars that are completely missing, remove them from
the graph. This way, if we decide not to do a set of runs, there won't
be holes in the data.
- output eps and ps by default in addition to the png.
util/stats/profile.py:
- clean up the data structures that are used to store the function
profile information and try our best to avoid keeping extra data
around that isn't used.
- make get() return None if a job is missing so we know it was
missing rather than the all zeroes thing.
- make the function profile categorization stuff total up to 100%
- Fixup the x-axis and y-axis labels.
- fix the dot file output stuff.
util/stats/stats.py:
support the new options stuff for StatOutput
--HG--
extra : convert_revision : fae35df8c57a36257ea93bc3e0a0e617edc46bb7
Diffstat (limited to 'util/stats/chart.py')
-rw-r--r-- | util/stats/chart.py | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/util/stats/chart.py b/util/stats/chart.py new file mode 100644 index 000000000..1e301cb58 --- /dev/null +++ b/util/stats/chart.py @@ -0,0 +1,84 @@ +# Copyright (c) 2005 The Regents of The University of Michigan +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Nathan Binkert +# Lisa Hsu + +class ChartOptions(object): + defaults = { 'chart_size' : (8, 4), + 'figure_size' : [0.1, 0.1, 0.6, 0.85], + 'title' : None, + 'legend' : None, + 'legend_loc' : 'upper right', + 'legend_size' : 6, + 'colormap' : 'jet', + 'xlabel' : None, + 'ylabel' : None, + 'xticks' : None, + 'yticks' : None, + 'ylim' : None, + } + + def __init__(self, options=None, **kwargs): + self.init(options, **kwargs) + + def clear(self): + self.options = {} + + def init(self, options=None, **kwargs): + self.clear() + self.update(options, **kwargs) + + def update(self, options=None, **kwargs): + if options is not None: + if not isinstance(options, ChartOptions): + raise AttributeError, \ + 'attribute options of type %s should be %s' % \ + (type(options), ChartOptions) + self.options.update(options.options) + + for key,value in kwargs.iteritems(): + if key not in ChartOptions.defaults: + raise AttributeError, \ + "%s instance has no attribute '%s'" % (type(self), key) + self.options[key] = value + + def __getattr__(self, attr): + if attr in self.options: + return self.options[attr] + + if attr in ChartOptions.defaults: + return ChartOptions.defaults[attr] + + raise AttributeError, \ + "%s instance has no attribute '%s'" % (type(self), attr) + + def __setattr__(self, attr, value): + if attr in ChartOptions.defaults: + self.options[attr] = value + else: + super(ChartOptions, self).__setattr__(attr, value) + |