diff options
Diffstat (limited to 'util/stats/stats.py')
-rwxr-xr-x | util/stats/stats.py | 140 |
1 files changed, 133 insertions, 7 deletions
diff --git a/util/stats/stats.py b/util/stats/stats.py index 68ba2b8ea..62819c397 100755 --- a/util/stats/stats.py +++ b/util/stats/stats.py @@ -1,6 +1,6 @@ #!/usr/bin/env python from __future__ import division -import re, sys +import re, sys, math def usage(): print '''\ @@ -39,7 +39,73 @@ def unique(list): map(set.__setitem__, list, []) return set.keys() +def graphdata68(runs, options, tag, label, value): + import info + configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ] + benchmarks = [ 'm', 's', 'snt', 'nb1', 'w1', 'w2', 'w3', 'w4', 'nm', 'ns', 'nw1', 'nw2', 'nw3' ] + dmas = [ 'x' ] + caches = [ '2', '4' ] + + names = [] + + bench_system = { + 'm' : 'client', + 's' : 'client', + 'snt' : 'client', + 'nb1' : 'server', + 'nb2' : 'server', + 'nt1' : 'server', + 'nt2' : 'server', + 'w1' : 'server', + 'w2' : 'server', + 'w3' : 'server', + 'w4' : 'server', + 'w1s' : 'server', + 'w2s' : 'server', + 'w3s' : 'server', + 'ns' : 'natbox', + 'nm' : 'natbox', + 'nw1' : 'natbox', + 'nw2' : 'natbox', + 'nw3' : 'natbox' + } + + for bench in benchmarks: + if bench_system[bench] != options.system: + continue + + for dma in dmas: + for cache in caches: + names.append([bench, dma, cache]) + + for bench,dma,cache in names: + base = '%s.%s.%s' % (bench, dma, cache) + fname = 'data/%s.%s.68.dat' % (tag, base) + f = open(fname, 'w') + print >>f, '#set TITLE = ' + print >>f, '#set ylbl = %s' % label + #print >>f, '#set sublabels = %s' % ' '.join(configs) + print >>f, '#set sublabels = ste hte htd ocm occ ocs' + + for speed,freq in zip(['s', '6', '8', 'q'],['4GHz', '6GHz','8GHz', '10GHz']): + print >>f, '"%s"' % freq, + for conf in configs: + name = '%s.%s.%s.%s.%s' % (conf, bench, dma, cache, speed) + run = info.source.allRunNames[name] + info.display_run = run.run; + val = float(value) + if val == 1e300*1e300: + print >>f, 0.0, + else: + print >>f, "%f" % val, + print >>f + f.close() + def graphdata(runs, options, tag, label, value): + if options.graph68: + graphdata68(runs, options, tag, label, value) + return + import info configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ] #benchmarks = [ 'm', 's', 'nb1', 'nb2', 'nt1', 'nt2', 'w1', 'w2', 'w3', 'w4', 'ns', 'nm', 'nw1', 'nw2', 'nw3' ] @@ -85,10 +151,10 @@ def graphdata(runs, options, tag, label, value): base = '%s.%s.%s' % (bench, dma, cache) fname = 'data/%s.%s.dat' % (tag, base) f = open(fname, 'w') - print >>f, '#set TITLE = %s' % base - print >>f, '#set xlbl = Configuration' + print >>f, '#set TITLE = ' print >>f, '#set ylbl = %s' % label - print >>f, '#set sublabels = %s' % ' '.join(configs) + #print >>f, '#set sublabels = %s' % ' '.join(configs) + print >>f, '#set sublabels = ste hte htd ocm occ ocs' for speed,freq in zip(['s', 'q'],['4GHz','10GHz']): print >>f, '"%s"' % freq, @@ -183,6 +249,56 @@ def commands(options, command, args): info.source.listRuns(user) return + if command == 'stability': + stats = info.source.getStat(args[0]) + info.source.get = "avg" + + #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" % \ + ("------------------------------", "------------", + "------------", "----", "-----", "-----", "-----") + #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) + stdev = 0 + numoutsideavg = 0 + numoutside1std = 0 + numoutside2std = 0 + + #loop through all the various ticks for each run + for tick in runTicks: + stat.ticks = str(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) + 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" % \ + (run.name, "%.1f" % avg, "%.1f" % stdev, + "%d" % numoutsideavg, "%d" % numoutside1std, + "%d" % numoutside2std, "%d" % len(runTicks)) + return + + if command == 'stats': if len(args) == 0: info.source.listStats() @@ -202,6 +318,10 @@ def commands(options, command, args): if options.graph: graphdata(runs, options, stat.name, stat.name, stat) else: + if options.ticks: + print 'only displaying sample %s' % options.ticks + stat.ticks = options.ticks + if options.binned: print 'kernel ticks' stat.bins = 'kernel' @@ -216,7 +336,7 @@ def commands(options, command, args): printdata(runs, stat) print 'interrupt ticks' - stat.bins = 'user' + stat.bins = 'interrupt' printdata(runs, stat) print 'total ticks' @@ -249,7 +369,7 @@ def commands(options, command, args): printdata(runs, stat) print 'interrupt ticks' - stat.bins = 'user' + stat.bins = 'interrupt' printdata(runs, stat) print 'total ticks' @@ -578,9 +698,13 @@ if __name__ == '__main__': options.get = None options.binned = False options.graph = False + options.graph68 = False + options.ticks = False - opts, args = getopts(sys.argv[1:], '-BEFGd:g:h:pr:s:u:') + opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:T:') for o,a in opts: + if o == '-6': + options.graph68 = True if o == '-B': options.binned = True if o == '-E': @@ -603,6 +727,8 @@ if __name__ == '__main__': options.user = a if o == '-s': options.system = a + if o == '-T': + options.ticks = a if len(args) == 0: usage() |