diff options
Diffstat (limited to 'util/stats/stats.py')
-rwxr-xr-x | util/stats/stats.py | 262 |
1 files changed, 200 insertions, 62 deletions
diff --git a/util/stats/stats.py b/util/stats/stats.py index 1d521fd9d..68ba2b8ea 100755 --- a/util/stats/stats.py +++ b/util/stats/stats.py @@ -39,26 +39,51 @@ def unique(list): map(set.__setitem__, list, []) return set.keys() -def graphdata(runs, tag, label, value): +def graphdata(runs, options, tag, label, value): import info - configs = ['std', 'csa', 'ht1', 'ht4', 'htx', 'ocm', 'occ', 'ocp' ] - benchmarks = [ 'm', 's' ] - dmas = [ 'x', 'd', 'b' ] - caches = [ '1', '2', '3', '4', '5' ] - systems = [ 'M' ] - checkpoints = [ '1' ] + configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ] + #benchmarks = [ 'm', 's', 'nb1', 'nb2', 'nt1', 'nt2', 'w1', 'w2', 'w3', 'w4', 'ns', 'nm', 'nw1', 'nw2', 'nw3' ] + #benchmarks = [ 'm', 's', 'nb1', 'nb2', 'nt1', 'w1', 'w2', 'w3', 'ns', 'nm', 'w1s' ] + benchmarks = [ 'm', 's', 'nb1', 'nb2', 'w1', 'w2', 'w3', 'w4', 'ns', 'nm', 'nw1', 'snt' ] + #dmas = [ 'x', 'd', 'b' ] + 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: - for sys in systems: - for cpt in checkpoints: - names.append([bench, dma, cache, sys, cpt]) + names.append([bench, dma, cache]) - for bench,dma,cache,sys,cpt in names: - base = '%s.%s.%s.%s.%s' % (bench, dma, cache, sys, cpt) - fname = '/n/ziff/z/binkertn/graph/data.ibm/%s.%s.dat' % (tag, base) + for bench,dma,cache in names: + 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' @@ -68,8 +93,7 @@ def graphdata(runs, tag, label, value): for speed,freq in zip(['s', 'q'],['4GHz','10GHz']): print >>f, '"%s"' % freq, for conf in configs: - name = '%s.%s.%s.%s.%s.%s.%s' % (conf, bench, dma, speed, - cache, sys, cpt) + name = '%s.%s.%s.%s.%s' % (conf, bench, dma, cache, speed) run = info.source.allRunNames[name] info.display_run = run.run; val = float(value) @@ -134,8 +158,6 @@ def commands(options, command, args): info.source.connect() info.source.update_dict(globals()) - system = info.source.__dict__[options.system] - if type(options.get) is str: info.source.get = options.get @@ -177,13 +199,66 @@ def commands(options, command, args): stats = info.source.getStat(args[0]) for stat in stats: - if graph: - graphdata(runs, stat.name, stat.name, stat) + if options.graph: + graphdata(runs, options, stat.name, stat.name, stat) else: + if options.binned: + print 'kernel ticks' + stat.bins = 'kernel' + printdata(runs, stat) + + print 'idle ticks' + stat.bins = 'idle' + printdata(runs, stat) + + print 'user ticks' + stat.bins = 'user' + printdata(runs, stat) + + print 'interrupt ticks' + stat.bins = 'user' + printdata(runs, stat) + + print 'total ticks' + + stat.bins = None print stat.name printdata(runs, stat) return + if command == 'formula': + if len(args) != 1: + raise CommandException + + stats = eval(args[0]) + for stat in stats: + if options.graph: + graphdata(runs, options, stat.name, stat.name, stat) + else: + if options.binned: + print 'kernel ticks' + stat.bins = 'kernel' + printdata(runs, stat) + + print 'idle ticks' + stat.bins = 'idle' + printdata(runs, stat) + + print 'user ticks' + stat.bins = 'user' + printdata(runs, stat) + + print 'interrupt ticks' + stat.bins = 'user' + printdata(runs, stat) + + print 'total ticks' + + stat.bins = None + print args[0] + printdata(runs, stat) + return + if command == 'bins': if len(args) == 0: info.source.listBins() @@ -214,6 +289,8 @@ def commands(options, command, args): if len(args): raise CommandException + system = info.source.__dict__[options.system] + if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) @@ -222,15 +299,15 @@ def commands(options, command, args): user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' - if graph: - graphdata(runs, 'usertime', 'User Fraction', + if options.graph: + graphdata(runs, options, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': - if binned: + if options.binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) @@ -250,37 +327,37 @@ def commands(options, command, args): return if command == 'packets': - packets = system.tsunami.nsgige.rxPackets - if graph: - graphdata(runs, 'packets', 'Packets', packets) + packets = system.tsunami.etherdev.rxPackets + if options.graph: + graphdata(runs, options, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': - ppt = system.tsunami.nsgige.rxPackets / sim_ticks + ppt = system.tsunami.etherdev.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': - pps = system.tsunami.nsgige.rxPackets / sim_seconds - if graph: - graphdata(runs, 'pps', 'Packets/s', pps) + pps = system.tsunami.etherdev.rxPackets / sim_seconds + if options.graph: + graphdata(runs, options, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': - bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes + bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes bpt = bytes / sim_ticks * 8 - if graph: - graphdata(runs, 'bpt', 'bps / Hz', bpt) + if options.graph: + graphdata(runs, options, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': - bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes + bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes print 'kernel stats' bytes.bins = 'kernel' @@ -297,9 +374,9 @@ def commands(options, command, args): return if command == 'bytes': - stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes + stat = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes - if binned: + if options.binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) @@ -319,34 +396,34 @@ def commands(options, command, args): return if command == 'rxbps': - gbps = system.tsunami.nsgige.rxBandwidth / 1e9 - if graph: - graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) + gbps = system.tsunami.etherdev.rxBandwidth / 1e9 + if options.graph: + graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': - gbps = system.tsunami.nsgige.txBandwidth / 1e9 - if graph: - graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) + gbps = system.tsunami.etherdev.txBandwidth / 1e9 + if options.graph: + graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': - rxbps = system.tsunami.nsgige.rxBandwidth - txbps = system.tsunami.nsgige.txBandwidth + rxbps = system.tsunami.etherdev.rxBandwidth + txbps = system.tsunami.etherdev.txBandwidth gbps = (rxbps + txbps) / 1e9 - if graph: - graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) + if options.graph: + graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': - stat = system.L3.overall_mshr_misses - if binned: + stat = system.L2.overall_mshr_misses + if options.binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) @@ -362,18 +439,18 @@ def commands(options, command, args): print '%s total stats' % stat.name stat.bins = None - if graph: - graphdata(runs, 'misses', 'Overall MSHR Misses', stat) + if options.graph: + graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': - misses = system.L3.overall_mshr_misses - rxbytes = system.tsunami.nsgige.rxBytes - txbytes = system.tsunami.nsgige.txBytes + misses = system.L2.overall_mshr_misses + rxbytes = system.tsunami.etherdev.rxBytes + txbytes = system.tsunami.etherdev.txBytes - if binned: + if options.binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) @@ -393,12 +470,43 @@ def commands(options, command, args): mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None - if graph: - graphdata(runs, 'mpkb', 'Misses / KB', mpkb) + if options.graph: + graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return + if command == 'ipkb': + interrupts = system.full_cpu.kern.faults[4] + rxbytes = system.tsunami.etherdev.rxBytes + txbytes = system.tsunami.etherdev.txBytes + + if options.binned: + print 'ipkb kernel stats' + interrupts.bins = 'kernel' + ipkb = interrupts / ((rxbytes + txbytes) / 1024) + printdata(runs, ipkb) + + print 'ipkb idle stats' + interrupts.bins = 'idle' + ipkb = interrupts / ((rxbytes + txbytes) / 1024) + printdata(runs, ipkb) + + print 'ipkb user stats' + interrupts.bins = 'user' + ipkb = interrupts / ((rxbytes + txbytes) / 1024) + printdata(runs, ipkb) + + print 'ipkb total stats' + + ipkb = interrupts / ((rxbytes + txbytes) / 1024) + interrupts.bins = None + if options.graph: + graphdata(runs, options, 'ipkb', 'Interrupts / KB', ipkb) + else: + printdata(runs, ipkb) + return + if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return @@ -411,21 +519,49 @@ def commands(options, command, args): printdata(runs, system.full_cpu.FETCH__count) return + if command == 'bpp': + ed = system.tsunami.etherdev + bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets) + if options.graph: + graphdata(runs, options, 'bpp', 'Bytes / Packet', bpp) + else: + printdata(runs, bpp) + return + if command == 'rxbpp': - bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets - printdata(run, 8 * bpp) + bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets + if options.graph: + graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp) + else: + printdata(runs, bpp) return if command == 'txbpp': - bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets - printdata(run, 8 * bpp) + bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets + if options.graph: + graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp) + else: + printdata(runs, bpp) return - raise CommandException + if command == 'rtp': + rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets + if options.graph: + graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp) + else: + printdata(runs, rtp) + return + if command == 'rtb': + rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes + if options.graph: + graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb) + else: + printdata(runs, rtb) + return + + raise CommandException -graph = False -binned = False class Options: pass @@ -440,6 +576,8 @@ if __name__ == '__main__': options.runs = None options.system = 'client' options.get = None + options.binned = False + options.graph = False opts, args = getopts(sys.argv[1:], '-BEFGd:g:h:pr:s:u:') for o,a in opts: |