diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-10-21 16:29:27 -0400 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-10-21 16:29:27 -0400 |
commit | 7ef8b40b3bc07acfeec7e7ccdbe648e67a309cab (patch) | |
tree | 0873d064e964127cb9d2bbc0c505a1caa4a45289 /util/stats/display.py | |
parent | 9a881c5a8266fd36f5b3e8f5295d0416101244ed (diff) | |
parent | e00237e49e3cb171a1235f5de43587e8eb31ec2c (diff) | |
download | gem5-7ef8b40b3bc07acfeec7e7ccdbe648e67a309cab.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/m5
into zizzer.eecs.umich.edu:/.automount/ziff/z/binkertn/research/m5/work
--HG--
extra : convert_revision : 8ef6ed2d770d45ac11d44a449e2c4f74ef656d87
Diffstat (limited to 'util/stats/display.py')
-rw-r--r-- | util/stats/display.py | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/util/stats/display.py b/util/stats/display.py index 629684ca4..fbcff5c70 100644 --- a/util/stats/display.py +++ b/util/stats/display.py @@ -26,7 +26,7 @@ class Value: def __init__(self, value, precision, percent = False): - self.value = value + self.value = float(value) self.precision = precision self.percent = percent def __str__(self): @@ -90,61 +90,60 @@ class Print: class VectorDisplay: def display(self): + if not self.value: + return + p = Print() p.flags = self.flags p.precision = self.precision - if isinstance(self.value, (list, tuple)): - if not len(self.value): - return - - mytotal = reduce(lambda x,y: float(x) + float(y), self.value) - mycdf = 0.0 + if not isinstance(self.value, (list, tuple)): + p.name = self.name + p.desc = self.desc + p.value = self.value + p.display() + return - value = self.value + mytotal = reduce(lambda x,y: float(x) + float(y), self.value) + mycdf = 0.0 - if display_all: - subnames = [ '[%d]' % i for i in range(len(value)) ] - else: - subnames = [''] * len(value) - - if self.__dict__.has_key('subnames'): - for i,each in enumerate(self.subnames): - if len(each) > 0: - subnames[i] = '.%s' % each - - subdescs = [self.desc]*len(value) - if self.__dict__.has_key('subdescs'): - for i in xrange(min(len(value), len(self.subdescs))): - subdescs[i] = self.subdescs[i] - - for val,sname,sdesc in map(None, value, subnames, subdescs): - if mytotal > 0.0: - mypdf = float(val) / float(mytotal) - mycdf += mypdf - if (self.flags & flags_pdf): - p.pdf = mypdf - p.cdf = mycdf - - if len(sname) == 0: - continue - - p.name = self.name + sname - p.desc = sdesc - p.value = val - p.display() - - if (self.flags & flags_total): - if (p.__dict__.has_key('pdf')): del p.__dict__['pdf'] - if (p.__dict__.has_key('cdf')): del p.__dict__['cdf'] - p.name = self.name + '.total' - p.desc = self.desc - p.value = mytotal - p.display() + value = self.value + if display_all: + subnames = [ '[%d]' % i for i in range(len(value)) ] else: - p.name = self.name - p.desc = self.desc - p.value = self.value + subnames = [''] * len(value) + + if self.__dict__.has_key('subnames'): + for i,each in enumerate(self.subnames): + if len(each) > 0: + subnames[i] = '.%s' % each + + subdescs = [self.desc]*len(value) + if self.__dict__.has_key('subdescs'): + for i in xrange(min(len(value), len(self.subdescs))): + subdescs[i] = self.subdescs[i] + + for val,sname,sdesc in map(None, value, subnames, subdescs): + if mytotal > 0.0: + mypdf = float(val) / float(mytotal) + mycdf += mypdf + if (self.flags & flags_pdf): + p.pdf = mypdf + p.cdf = mycdf + + if len(sname) == 0: + continue + + p.name = self.name + sname + p.desc = sdesc + p.value = val p.display() + if (self.flags & flags_total): + if (p.__dict__.has_key('pdf')): del p.__dict__['pdf'] + if (p.__dict__.has_key('cdf')): del p.__dict__['cdf'] + p.name = self.name + '.total' + p.desc = self.desc + p.value = mytotal + p.display() |