stats python fixes for dealing with vectors better. graph tweaking

ipkb stat and formulas from the command line.

util/stats/info.py:
    no need to raise an attribute error if two values aren't found
    in the exact same set of runs.  Would be good to check that each
    run is the same though.
util/stats/stats.py:
    more graph tweaking
    command to execute a formula from the command line.
    add interrupts per kilobyte of data

--HG--
extra : convert_revision : 78d6b14d340d08edcbc69e4c1c5a4c1dd9bb10dd
This commit is contained in:
Nathan Binkert 2004-11-18 16:23:29 -05:00
parent ceec841980
commit ab10712341
2 changed files with 137 additions and 49 deletions

View file

@ -47,28 +47,21 @@ def wrapop(op, lv, rv):
return op(lv, rv) return op(lv, rv)
def same(lv, rv): def same(lrun, rrun):
for lrun,rrun in zip(lv.keys(),rv.keys()): for lx,rx in zip(lrun.keys(),rrun.keys()):
if lrun != rrun: if lx != rx:
print 'lrun != rrun' print 'lx != rx'
print lrun, rrun print lx, rx
print lv.keys() print lrun.keys()
print rv.keys() print rrun.keys()
return False return False
for lx,rx in zip(lv[lrun].keys(),rv[rrun].keys()): for ly,ry in zip(lrun[lx].keys(),rrun[rx].keys()):
if lx != rx: if ly != ry:
print 'lx != rx' print 'ly != ry'
print lx, rx print ly, ry
print lv[lrun].keys() print lrun[lx].keys()
print rv[rrun].keys() print rrun[rx].keys()
return False return False
for ly,ry in zip(lv[lrun][lx].keys(),rv[rrun][rx].keys()):
if ly != ry:
print 'ly != ry'
print ly, ry
print lv[lrun][lx].keys()
print rv[rrun][rx].keys()
return False
return True return True
@ -79,10 +72,15 @@ def binaryop(op, lf, rf):
lv = lf.value lv = lf.value
rv = rf.value rv = rf.value
if not same(lv, rv): theruns = []
raise AttributeError, "run,x,y not identical" for r in lv.keys():
if rv.has_key(r):
if same(lv[r], rv[r]):
theruns.append(r)
else:
raise AttributeError
for run in lv.keys(): for run in theruns:
result[run] = {} result[run] = {}
for x in lv[run].keys(): for x in lv[run].keys():
result[run][x] = {} result[run][x] = {}

View file

@ -39,23 +39,50 @@ def unique(list):
map(set.__setitem__, list, []) map(set.__setitem__, list, [])
return set.keys() return set.keys()
def graphdata(runs, tag, label, value): def graphdata(runs, options, tag, label, value):
import info import info
configs = ['stx', 'ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ] configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
benchmarks = [ 'm', 's' ] #benchmarks = [ 'm', 's', 'nb1', 'nb2', 'nt1', 'nt2', 'w1', 'w2', 'w3', 'w4', 'ns', 'nm', 'nw1', 'nw2', 'nw3' ]
dmas = [ 'x', 'd', 'b' ] #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' ] caches = [ '2', '4' ]
checkpoints = [ '1' ]
names = [] 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: for bench in benchmarks:
if bench_system[bench] != options.system:
continue
for dma in dmas: for dma in dmas:
for cache in caches: for cache in caches:
for cpt in checkpoints: names.append([bench, dma, cache])
names.append([bench, dma, cache, cpt])
for bench,dma,cache,cpt in names: for bench,dma,cache in names:
base = '%s.%s.%s.%s' % (bench, dma, cache, cpt) base = '%s.%s.%s' % (bench, dma, cache)
fname = 'data/%s.%s.dat' % (tag, base) fname = 'data/%s.%s.dat' % (tag, base)
f = open(fname, 'w') f = open(fname, 'w')
print >>f, '#set TITLE = %s' % base print >>f, '#set TITLE = %s' % base
@ -66,8 +93,7 @@ def graphdata(runs, tag, label, value):
for speed,freq in zip(['s', 'q'],['4GHz','10GHz']): for speed,freq in zip(['s', 'q'],['4GHz','10GHz']):
print >>f, '"%s"' % freq, print >>f, '"%s"' % freq,
for conf in configs: for conf in configs:
name = '%s.%s.%s.%s.%s.%s' % (conf, bench, dma, speed, cache, name = '%s.%s.%s.%s.%s' % (conf, bench, dma, cache, speed)
cpt)
run = info.source.allRunNames[name] run = info.source.allRunNames[name]
info.display_run = run.run; info.display_run = run.run;
val = float(value) val = float(value)
@ -174,7 +200,7 @@ def commands(options, command, args):
stats = info.source.getStat(args[0]) stats = info.source.getStat(args[0])
for stat in stats: for stat in stats:
if options.graph: if options.graph:
graphdata(runs, stat.name, stat.name, stat) graphdata(runs, options, stat.name, stat.name, stat)
else: else:
if options.binned: if options.binned:
print 'kernel ticks' print 'kernel ticks'
@ -200,6 +226,39 @@ def commands(options, command, args):
printdata(runs, stat) printdata(runs, stat)
return 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 command == 'bins':
if len(args) == 0: if len(args) == 0:
info.source.listBins() info.source.listBins()
@ -241,7 +300,7 @@ def commands(options, command, args):
user.bins = 'user' user.bins = 'user'
if options.graph: if options.graph:
graphdata(runs, 'usertime', 'User Fraction', graphdata(runs, options, 'usertime', 'User Fraction',
user / system.full_cpu.numCycles) user / system.full_cpu.numCycles)
else: else:
printdata(runs, user / system.full_cpu.numCycles) printdata(runs, user / system.full_cpu.numCycles)
@ -270,7 +329,7 @@ def commands(options, command, args):
if command == 'packets': if command == 'packets':
packets = system.tsunami.etherdev.rxPackets packets = system.tsunami.etherdev.rxPackets
if options.graph: if options.graph:
graphdata(runs, 'packets', 'Packets', packets) graphdata(runs, options, 'packets', 'Packets', packets)
else: else:
printdata(runs, packets) printdata(runs, packets)
return return
@ -283,7 +342,7 @@ def commands(options, command, args):
if command == 'pps': if command == 'pps':
pps = system.tsunami.etherdev.rxPackets / sim_seconds pps = system.tsunami.etherdev.rxPackets / sim_seconds
if options.graph: if options.graph:
graphdata(runs, 'pps', 'Packets/s', pps) graphdata(runs, options, 'pps', 'Packets/s', pps)
else: else:
printdata(runs, pps) printdata(runs, pps)
return return
@ -292,7 +351,7 @@ def commands(options, command, args):
bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes
bpt = bytes / sim_ticks * 8 bpt = bytes / sim_ticks * 8
if options.graph: if options.graph:
graphdata(runs, 'bpt', 'bps / Hz', bpt) graphdata(runs, options, 'bpt', 'bps / Hz', bpt)
else: else:
printdata(runs, bpt, command == 'tpb') printdata(runs, bpt, command == 'tpb')
return return
@ -339,7 +398,7 @@ def commands(options, command, args):
if command == 'rxbps': if command == 'rxbps':
gbps = system.tsunami.etherdev.rxBandwidth / 1e9 gbps = system.tsunami.etherdev.rxBandwidth / 1e9
if options.graph: if options.graph:
graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps)
else: else:
printdata(runs, gbps) printdata(runs, gbps)
return return
@ -347,7 +406,7 @@ def commands(options, command, args):
if command == 'txbps': if command == 'txbps':
gbps = system.tsunami.etherdev.txBandwidth / 1e9 gbps = system.tsunami.etherdev.txBandwidth / 1e9
if options.graph: if options.graph:
graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps)
else: else:
printdata(runs, gbps) printdata(runs, gbps)
return return
@ -357,7 +416,7 @@ def commands(options, command, args):
txbps = system.tsunami.etherdev.txBandwidth txbps = system.tsunami.etherdev.txBandwidth
gbps = (rxbps + txbps) / 1e9 gbps = (rxbps + txbps) / 1e9
if options.graph: if options.graph:
graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps)
else: else:
printdata(runs, gbps) printdata(runs, gbps)
return return
@ -381,7 +440,7 @@ def commands(options, command, args):
stat.bins = None stat.bins = None
if options.graph: if options.graph:
graphdata(runs, 'misses', 'Overall MSHR Misses', stat) graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat)
else: else:
printdata(runs, stat) printdata(runs, stat)
return return
@ -412,11 +471,42 @@ def commands(options, command, args):
mpkb = misses / ((rxbytes + txbytes) / 1024) mpkb = misses / ((rxbytes + txbytes) / 1024)
misses.bins = None misses.bins = None
if options.graph: if options.graph:
graphdata(runs, 'mpkb', 'Misses / KB', mpkb) graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb)
else: else:
printdata(runs, mpkb) printdata(runs, mpkb)
return 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': if command == 'execute':
printdata(runs, system.full_cpu.ISSUE__count) printdata(runs, system.full_cpu.ISSUE__count)
return return
@ -433,7 +523,7 @@ def commands(options, command, args):
ed = system.tsunami.etherdev ed = system.tsunami.etherdev
bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets) bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets)
if options.graph: if options.graph:
graphdata(runs, 'bpp', 'Bytes / Packet', bpp) graphdata(runs, options, 'bpp', 'Bytes / Packet', bpp)
else: else:
printdata(runs, bpp) printdata(runs, bpp)
return return
@ -441,7 +531,7 @@ def commands(options, command, args):
if command == 'rxbpp': if command == 'rxbpp':
bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets
if options.graph: if options.graph:
graphdata(runs, 'rxbpp', 'Receive Bytes / Packet', bpp) graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp)
else: else:
printdata(runs, bpp) printdata(runs, bpp)
return return
@ -449,7 +539,7 @@ def commands(options, command, args):
if command == 'txbpp': if command == 'txbpp':
bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets
if options.graph: if options.graph:
graphdata(runs, 'txbpp', 'Transmit Bytes / Packet', bpp) graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp)
else: else:
printdata(runs, bpp) printdata(runs, bpp)
return return
@ -457,7 +547,7 @@ def commands(options, command, args):
if command == 'rtp': if command == 'rtp':
rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets
if options.graph: if options.graph:
graphdata(runs, 'rtp', 'rxPackets / txPackets', rtp) graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp)
else: else:
printdata(runs, rtp) printdata(runs, rtp)
return return
@ -465,7 +555,7 @@ def commands(options, command, args):
if command == 'rtb': if command == 'rtb':
rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes
if options.graph: if options.graph:
graphdata(runs, 'rtb', 'rxBytes / txBytes', rtb) graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb)
else: else:
printdata(runs, rtb) printdata(runs, rtb)
return return