diff options
author | Kevin Lim <ktlim@umich.edu> | 2005-02-04 18:25:49 -0500 |
---|---|---|
committer | Kevin Lim <ktlim@umich.edu> | 2005-02-04 18:25:49 -0500 |
commit | 1e7a744c09d0bde70e0f83179fdf4d6059585e4b (patch) | |
tree | 9bbc7713c4bb79abb3f76b07547d8822f0557caa /util | |
parent | c389c2e327cc3ee1c988855b05505660c6670172 (diff) | |
parent | b78d7c2f16dac11ed468de45a088a362605c6493 (diff) | |
download | gem5-1e7a744c09d0bde70e0f83179fdf4d6059585e4b.tar.xz |
Hand merge
--HG--
extra : convert_revision : 86c7399b79c17558041a73056745227f70fe8b3b
Diffstat (limited to 'util')
-rw-r--r-- | util/stats/info.py | 28 | ||||
-rwxr-xr-x | util/stats/stats.py | 95 | ||||
-rwxr-xr-x | util/tracediff | 4 |
3 files changed, 95 insertions, 32 deletions
diff --git a/util/stats/info.py b/util/stats/info.py index d11619765..01d7bdb0f 100644 --- a/util/stats/info.py +++ b/util/stats/info.py @@ -3,6 +3,8 @@ import operator, re, types source = None display_run = 0 +global globalTicks +globalTicks = None def issequence(t): return isinstance(t, types.TupleType) or isinstance(t, types.ListType) @@ -130,6 +132,7 @@ def cmp(a, b): return 1 class Statistic(object): + def __init__(self, data): self.__dict__.update(data.__dict__) if not self.__dict__.has_key('value'): @@ -138,9 +141,25 @@ class Statistic(object): self.__dict__['bins'] = None if not self.__dict__.has_key('ticks'): self.__dict__['ticks'] = None + if 'vc' not in self.__dict__: + self.vc = {} def __getattribute__(self, attr): + if attr == 'ticks': + if self.__dict__['ticks'] != globalTicks: + self.__dict__['value'] = None + self.__dict__['ticks'] = globalTicks + return self.__dict__['ticks'] if attr == 'value': + if self.__dict__['ticks'] != globalTicks: + if self.__dict__['ticks'] != None and \ + len(self.__dict__['ticks']) == 1: + self.vc[self.__dict__['ticks'][0]] = self.__dict__['value'] + self.__dict__['ticks'] = globalTicks + if len(globalTicks) == 1 and self.vc.has_key(globalTicks[0]): + self.__dict__['value'] = self.vc[globalTicks[0]] + else: + self.__dict__['value'] = None if self.__dict__['value'] == None: self.__dict__['value'] = self.getValue() return self.__dict__['value'] @@ -152,11 +171,12 @@ class Statistic(object): if attr == 'bins': if value is not None: value = source.getBin(value) - elif attr == 'ticks' and type(value) is str: - value = [ int(x) for x in value.split() ] + #elif attr == 'ticks' and type(value) is str: + # value = [ int(x) for x in value.split() ] self.__dict__[attr] = value self.__dict__['value'] = None + self.vc = {} else: super(Statistic, self).__setattr__(attr, value) @@ -287,7 +307,7 @@ class Scalar(Statistic,FormulaStat): class Vector(Statistic,FormulaStat): def getValue(self): - return source.data(self, self.bins); + return source.data(self, self.bins, self.ticks); def display(self): import display @@ -304,7 +324,7 @@ class Vector(Statistic,FormulaStat): def __eq__(self, other): if issequence(self.value) != issequence(other.value): - return false + return False if issequence(self.value): if len(self.value) != len(other.value): diff --git a/util/stats/stats.py b/util/stats/stats.py index 62819c397..c9b7ab2ac 100755 --- a/util/stats/stats.py +++ b/util/stats/stats.py @@ -2,10 +2,23 @@ from __future__ import division import re, sys, math + def usage(): print '''\ Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p] - [-s <system>] [-r <runs> ] [-u <username>] <command> [command args] + [-s <system>] [-r <runs> ] [-T <samples>] [-u <username>] + <command> [command args] + + commands extra parameters description + ----------- ------------------ --------------------------------------- + bins [regex] List bins (only matching regex) + formula <formula> Evaluated formula specified + formulas [regex] List formulas (only matching regex) + runs none List all runs in database + samples none List samples present in database + stability <pairnum> <stats> Calculated statistical info about stats + stat <regex> Show stat data (only matching regex) + stats [regex] List all stats (only matching regex) ''' % sys.argv[0] sys.exit(1) @@ -250,55 +263,85 @@ def commands(options, command, args): return if command == 'stability': - stats = info.source.getStat(args[0]) - info.source.get = "avg" + if len(args) < 2: + raise CommandException + + try: + merge = int(args[0]) + except ValueError: + usage() + stats = info.source.getStat(args[1]) + info.source.get = "sum" + #loop through all the stats selected for stat in stats: print "%s:" % stat.name - print "%-30s %12s %12s %4s %5s %5s %5s" % \ - ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP") - print "%-30s %12s %12s %4s %5s %5s %5s" % \ - ("------------------------------", "------------", - "------------", "----", "-----", "-----", "-----") + print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ + ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV") + print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ + ("--------------------", "------------", + "------------", "----", "-----", "-----", "-----", "----------") #loop through all the selected runs for run in runs: info.display_run = run.run; runTicks = info.source.retTicks([ run ]) #throw away the first one, it's 0 runTicks.pop(0) - stat.ticks = runTicks - avg = float(stat) + info.globalTicks = runTicks + avg = 0 stdev = 0 numoutsideavg = 0 numoutside1std = 0 numoutside2std = 0 - + pairRunTicks = [] + if float(stat) == 1e300*1e300: + continue + for t in range(0, len(runTicks)-(merge-1), merge): + tempPair = [] + for p in range(0,merge): + tempPair.append(runTicks[t+p]) + pairRunTicks.append(tempPair) #loop through all the various ticks for each run - for tick in runTicks: - stat.ticks = str(tick) + for tick in pairRunTicks: + info.globalTicks = tick + avg += float(stat) + avg /= len(pairRunTicks) + for tick in pairRunTicks: + info.globalTicks = tick val = float(stat) - if (val < (avg * .9)) or (val > (avg * 1.1)): - numoutsideavg += 1 stdev += pow((val-avg),2) - - stdev = math.sqrt(stdev / len(runTicks)) - for tick in runTicks: - stat.ticks = str(tick) + stdev = math.sqrt(stdev / len(pairRunTicks)) + for tick in pairRunTicks: + info.globalTicks = tick val = float(stat) + if (val < (avg * .9)) or (val > (avg * 1.1)): + numoutsideavg += 1 if (val < (avg - stdev)) or (val > (avg + stdev)): numoutside1std += 1 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))): numoutside2std += 1 - - print "%-30s %12s %12s %4s %5s %5s %5s" % \ - (run.name, "%.1f" % avg, "%.1f" % stdev, - "%d" % numoutsideavg, "%d" % numoutside1std, - "%d" % numoutside2std, "%d" % len(runTicks)) + if avg > 1000: + print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ + (run.name, "%.1f" % avg, "%.1f" % stdev, + "%d" % numoutsideavg, "%d" % numoutside1std, + "%d" % numoutside2std, "%d" % len(pairRunTicks), + "%.3f" % (stdev/avg*100)) + elif avg > 100: + print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ + (run.name, "%.1f" % avg, "%.1f" % stdev, + "%d" % numoutsideavg, "%d" % numoutside1std, + "%d" % numoutside2std, "%d" % len(pairRunTicks), + "%.5f" % (stdev/avg*100)) + else: + print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ + (run.name, "%.5f" % avg, "%.5f" % stdev, + "%d" % numoutsideavg, "%d" % numoutside1std, + "%d" % numoutside2std, "%d" % len(pairRunTicks), + "%.7f" % (stdev/avg*100)) return - if command == 'stats': if len(args) == 0: info.source.listStats() @@ -320,7 +363,7 @@ def commands(options, command, args): else: if options.ticks: print 'only displaying sample %s' % options.ticks - stat.ticks = options.ticks + info.globalTicks = [ int(x) for x in options.ticks.split() ] if options.binned: print 'kernel ticks' diff --git a/util/tracediff b/util/tracediff index a95ce8b82..402abbe55 100755 --- a/util/tracediff +++ b/util/tracediff @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright (c) 2003-2004 The Regents of The University of Michigan +# Copyright (c) 2003-2005 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ $simargs = '"' . join('" "', @ARGV) . '"'; # Redirect config output to cout so that gets diffed too (in case # that's the source of the problem). -$simargs += " --Universe:config_output_file=cout"; +$simargs .= " --root:config_output_file=cout"; $cmd1 = "$sim1 $simargs --stats:text_file=tracediff-$$-1.stats 2>&1 |"; $cmd2 = "$sim2 $simargs --stats:text_file=tracediff-$$-2.stats 2>&1 |"; |