From cd56e4e08e86b5ee82b1e395356a0bccb53de74d Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Tue, 18 Jan 2005 17:55:35 -0500 Subject: Ability to check formulas --HG-- extra : convert_revision : 68a2a19cceb4a8cf8a2798ee5c019d25c0fca3cc --- util/stats/stats.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'util/stats/stats.py') diff --git a/util/stats/stats.py b/util/stats/stats.py index 62819c397..892ad143e 100755 --- a/util/stats/stats.py +++ b/util/stats/stats.py @@ -2,6 +2,7 @@ from __future__ import division import re, sys, math + def usage(): print '''\ Usage: %s [-E] [-F] [-d ] [-g ] [-h ] [-p] @@ -257,18 +258,18 @@ def commands(options, command, args): 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 %6s" % \ + ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV") + print "%-20s %12s %12s %4s %5s %5s %5s %6s" % \ + ("--------------------", "------------", + "------------", "----", "-----", "-----", "-----", "------") #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 + info.globalTicks = runTicks avg = float(stat) stdev = 0 numoutsideavg = 0 @@ -277,7 +278,8 @@ def commands(options, command, args): #loop through all the various ticks for each run for tick in runTicks: - stat.ticks = str(tick) + #stat.ticks = str(tick) + info.globalTicks = [ tick ] val = float(stat) if (val < (avg * .9)) or (val > (avg * 1.1)): numoutsideavg += 1 @@ -285,17 +287,18 @@ def commands(options, command, args): stdev = math.sqrt(stdev / len(runTicks)) for tick in runTicks: - stat.ticks = str(tick) + info.globalTicks = [ tick ] val = float(stat) 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" % \ + print "%-20s %12s %12s %4s %5s %5s %5s %6s" % \ (run.name, "%.1f" % avg, "%.1f" % stdev, "%d" % numoutsideavg, "%d" % numoutside1std, - "%d" % numoutside2std, "%d" % len(runTicks)) + "%d" % numoutside2std, "%d" % len(runTicks), + "%.1f" % (stdev/avg*100)) return @@ -320,7 +323,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' -- cgit v1.2.3 From 886f905785561372413ea95dc551a0f269e28bac Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Wed, 19 Jan 2005 18:40:02 -0500 Subject: added total bytes/bandwidth/packets formulas to nics cleaned up stability code and wrote some better help for stats.py fixed sample bug in info.py dev/ns_gige.cc: dev/ns_gige.hh: dev/sinic.cc: dev/sinic.hh: add total bandwidth/packets/bytes stats util/stats/info.py: fixed samples bug util/stats/stats.py: cleaned up stability code and wrote a bit better help --HG-- extra : convert_revision : cae06f4fac744d7a51ee0909f21f03509151ea8f --- util/stats/stats.py | 88 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 24 deletions(-) (limited to 'util/stats/stats.py') diff --git a/util/stats/stats.py b/util/stats/stats.py index 892ad143e..c9b7ab2ac 100755 --- a/util/stats/stats.py +++ b/util/stats/stats.py @@ -6,7 +6,19 @@ import re, sys, math def usage(): print '''\ Usage: %s [-E] [-F] [-d ] [-g ] [-h ] [-p] - [-s ] [-r ] [-u ] [command args] + [-s ] [-r ] [-T ] [-u ] + [command args] + + commands extra parameters description + ----------- ------------------ --------------------------------------- + bins [regex] List bins (only matching regex) + 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 Calculated statistical info about stats + stat Show stat data (only matching regex) + stats [regex] List all stats (only matching regex) ''' % sys.argv[0] sys.exit(1) @@ -251,18 +263,26 @@ 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 "%-20s %12s %12s %4s %5s %5s %5s %6s" % \ + 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 %6s" % \ + print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ ("--------------------", "------------", - "------------", "----", "-----", "-----", "-----", "------") + "------------", "----", "-----", "-----", "-----", "----------") #loop through all the selected runs for run in runs: info.display_run = run.run; @@ -270,38 +290,58 @@ def commands(options, command, args): #throw away the first one, it's 0 runTicks.pop(0) info.globalTicks = runTicks - avg = float(stat) + 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) - info.globalTicks = [ 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: - info.globalTicks = [ 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 "%-20s %12s %12s %4s %5s %5s %5s %6s" % \ - (run.name, "%.1f" % avg, "%.1f" % stdev, - "%d" % numoutsideavg, "%d" % numoutside1std, - "%d" % numoutside2std, "%d" % len(runTicks), - "%.1f" % (stdev/avg*100)) + 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() -- cgit v1.2.3