Deleted Added
sdiff udiff text old ( 2185:1ae0d79e352c ) new ( 2343:a2b4a6ccee56 )
full compact
1# Copyright (c) 2005-2006 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

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

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
29from chart import ChartOptions
30
31class StatOutput(ChartOptions):
32 def __init__(self, jobfile, info, stat=None, binstats=None):
33 super(StatOutput, self).__init__()
34 self.jobfile = jobfile
35 self.stat = stat
36 self.binstats = None
37 self.invert = False
38 self.info = info
39
40 def printdata(self, name, bin = None, printmode = 'G'):
41 import info
42
43 if bin:
44 print '%s %s stats' % (name, bin)
45
46 if self.binstats:
47 for stat in self.binstats:
48 stat.bins = bin
49
50 if printmode == 'G':
51 valformat = '%g'
52 elif printmode != 'F' and value > 1e6:
53 valformat = '%0.5e'
54 else:
55 valformat = '%f'
56
57 for job in self.jobfile.jobs():

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

65 if self.invert:
66 for i,val in enumerate(value):
67 if val != 0.0:
68 value[i] = 1 / val
69
70 valstring = ', '.join([ valformat % val for val in value ])
71 print '%-50s %s' % (job.name + ':', valstring)
72
73 def display(self, name, binned = False, printmode = 'G'):
74 if binned and self.binstats:
75 self.printdata(name, 'kernel', printmode)
76 self.printdata(name, 'idle', printmode)
77 self.printdata(name, 'user', printmode)
78 self.printdata(name, 'interrupt', printmode)
79
80 print '%s total stats' % name
81 self.printdata(name, printmode=printmode)
82
83 def graph(self, name, graphdir, proxy=None):
84 from os.path import expanduser, isdir, join as joinpath
85 from barchart import BarChart
86 from matplotlib.numerix import Float, array, zeros
87 import os, re, urllib
88 from jobfile import crossproduct
89
90 confgroups = self.jobfile.groups()

--- 141 unchanged lines hidden ---