2004-08-10 03:20:52 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from __future__ import division
|
2005-01-18 19:34:58 +01:00
|
|
|
import re, sys, math
|
2004-08-10 03:20:52 +02:00
|
|
|
|
2005-01-18 23:55:35 +01:00
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
def usage():
|
|
|
|
print '''\
|
|
|
|
Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
|
2005-01-20 00:40:02 +01:00
|
|
|
[-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)
|
2005-03-23 21:55:09 +01:00
|
|
|
|
|
|
|
database <command> Where command is drop, init, or clean
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
''' % sys.argv[0]
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
def getopts(list, flags):
|
|
|
|
import getopt
|
|
|
|
try:
|
|
|
|
opts, args = getopt.getopt(list, flags)
|
|
|
|
except getopt.GetoptError:
|
|
|
|
usage()
|
|
|
|
|
|
|
|
return opts, args
|
|
|
|
|
|
|
|
def printval(name, value, invert = False):
|
|
|
|
if invert and value != 0.0:
|
|
|
|
value = 1 / value
|
|
|
|
|
|
|
|
if value == (1e300*1e300):
|
|
|
|
return
|
|
|
|
|
|
|
|
if printval.mode == 'G':
|
|
|
|
print '%s: %g' % (name, value)
|
|
|
|
elif printval.mode != 'F' and value > 1e6:
|
|
|
|
print '%s: %0.5e' % (name, value)
|
|
|
|
else:
|
|
|
|
print '%s: %f' % (name, value)
|
|
|
|
|
|
|
|
printval.mode = 'G'
|
|
|
|
|
|
|
|
def unique(list):
|
|
|
|
set = {}
|
|
|
|
map(set.__setitem__, list, [])
|
|
|
|
return set.keys()
|
|
|
|
|
2005-01-12 19:44:47 +01:00
|
|
|
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'
|
|
|
|
|
2005-03-24 21:52:30 +01:00
|
|
|
for speed,freq in zip(['s', 'm', 'f', 'q'],['4GHz', '6GHz','8GHz', '10GHz']):
|
2005-01-12 19:44:47 +01:00
|
|
|
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()
|
|
|
|
|
2004-11-18 22:23:29 +01:00
|
|
|
def graphdata(runs, options, tag, label, value):
|
2005-01-12 19:44:47 +01:00
|
|
|
if options.graph68:
|
|
|
|
graphdata68(runs, options, tag, label, value)
|
|
|
|
return
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
import info
|
2004-11-18 22:23:29 +01:00
|
|
|
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' ]
|
2004-11-14 23:22:33 +01:00
|
|
|
caches = [ '2', '4' ]
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
names = []
|
2004-11-18 22:23:29 +01:00
|
|
|
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
for bench in benchmarks:
|
2004-11-18 22:23:29 +01:00
|
|
|
if bench_system[bench] != options.system:
|
|
|
|
continue
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
for dma in dmas:
|
|
|
|
for cache in caches:
|
2004-11-18 22:23:29 +01:00
|
|
|
names.append([bench, dma, cache])
|
2004-08-10 03:20:52 +02:00
|
|
|
|
2004-11-18 22:23:29 +01:00
|
|
|
for bench,dma,cache in names:
|
|
|
|
base = '%s.%s.%s' % (bench, dma, cache)
|
2004-11-15 07:36:27 +01:00
|
|
|
fname = 'data/%s.%s.dat' % (tag, base)
|
2004-08-10 03:20:52 +02:00
|
|
|
f = open(fname, 'w')
|
2005-01-12 19:44:47 +01:00
|
|
|
print >>f, '#set TITLE = '
|
2004-08-10 03:20:52 +02:00
|
|
|
print >>f, '#set ylbl = %s' % label
|
2005-01-12 19:44:47 +01:00
|
|
|
#print >>f, '#set sublabels = %s' % ' '.join(configs)
|
|
|
|
print >>f, '#set sublabels = ste hte htd ocm occ ocs'
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
for speed,freq in zip(['s', 'q'],['4GHz','10GHz']):
|
|
|
|
print >>f, '"%s"' % freq,
|
|
|
|
for conf in configs:
|
2004-11-18 22:23:29 +01:00
|
|
|
name = '%s.%s.%s.%s.%s' % (conf, bench, dma, cache, speed)
|
2004-08-10 03:20:52 +02:00
|
|
|
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 printdata(runs, value, invert = False):
|
|
|
|
import info
|
|
|
|
for run in runs:
|
|
|
|
info.display_run = run.run;
|
|
|
|
val = float(value)
|
|
|
|
printval(run.name, val)
|
|
|
|
|
|
|
|
class CommandException(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def commands(options, command, args):
|
|
|
|
if command == 'database':
|
|
|
|
if len(args) == 0: raise CommandException
|
|
|
|
|
|
|
|
import dbinit
|
|
|
|
mydb = dbinit.MyDB(options)
|
|
|
|
|
|
|
|
if args[0] == 'drop':
|
|
|
|
if len(args) > 2: raise CommandException
|
|
|
|
mydb.admin()
|
|
|
|
mydb.drop()
|
|
|
|
if len(args) == 2 and args[1] == 'init':
|
|
|
|
mydb.create()
|
|
|
|
mydb.connect()
|
|
|
|
mydb.populate()
|
|
|
|
mydb.close()
|
|
|
|
return
|
|
|
|
|
|
|
|
if args[0] == 'init':
|
|
|
|
if len(args) > 1: raise CommandException
|
|
|
|
mydb.admin()
|
|
|
|
mydb.create()
|
|
|
|
mydb.connect()
|
|
|
|
mydb.populate()
|
|
|
|
mydb.close()
|
|
|
|
return
|
|
|
|
|
|
|
|
if args[0] == 'clean':
|
|
|
|
if len(args) > 1: raise CommandException
|
|
|
|
mydb.connect()
|
|
|
|
mydb.clean()
|
|
|
|
return
|
|
|
|
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
import db, info
|
|
|
|
info.source = db.Database()
|
|
|
|
info.source.host = options.host
|
|
|
|
info.source.db = options.db
|
|
|
|
info.source.passwd = options.passwd
|
|
|
|
info.source.user = options.user
|
|
|
|
info.source.connect()
|
|
|
|
info.source.update_dict(globals())
|
|
|
|
|
|
|
|
if type(options.get) is str:
|
|
|
|
info.source.get = options.get
|
|
|
|
|
|
|
|
if options.runs is None:
|
|
|
|
runs = info.source.allRuns
|
|
|
|
else:
|
|
|
|
rx = re.compile(options.runs)
|
|
|
|
runs = []
|
|
|
|
for run in info.source.allRuns:
|
|
|
|
if rx.match(run.name):
|
|
|
|
runs.append(run)
|
|
|
|
|
|
|
|
info.display_run = runs[0].run
|
|
|
|
|
|
|
|
if command == 'runs':
|
|
|
|
user = None
|
|
|
|
opts, args = getopts(args, '-u')
|
|
|
|
if len(args):
|
|
|
|
raise CommandException
|
|
|
|
for o,a in opts:
|
|
|
|
if o == '-u':
|
|
|
|
user = a
|
|
|
|
info.source.listRuns(user)
|
|
|
|
return
|
|
|
|
|
2005-01-14 23:50:36 +01:00
|
|
|
if command == 'stability':
|
2005-01-20 00:40:02 +01:00
|
|
|
if len(args) < 2:
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
try:
|
|
|
|
merge = int(args[0])
|
|
|
|
except ValueError:
|
|
|
|
usage()
|
|
|
|
stats = info.source.getStat(args[1])
|
|
|
|
info.source.get = "sum"
|
|
|
|
|
2005-01-14 23:50:36 +01:00
|
|
|
|
|
|
|
#loop through all the stats selected
|
|
|
|
for stat in stats:
|
|
|
|
|
2005-01-18 19:25:55 +01:00
|
|
|
print "%s:" % stat.name
|
2005-01-20 00:40:02 +01:00
|
|
|
print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
|
2005-01-18 23:55:35 +01:00
|
|
|
("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV")
|
2005-01-20 00:40:02 +01:00
|
|
|
print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
|
2005-01-18 23:55:35 +01:00
|
|
|
("--------------------", "------------",
|
2005-01-20 00:40:02 +01:00
|
|
|
"------------", "----", "-----", "-----", "-----", "----------")
|
2005-01-14 23:50:36 +01:00
|
|
|
#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)
|
2005-01-18 23:55:35 +01:00
|
|
|
info.globalTicks = runTicks
|
2005-01-20 00:40:02 +01:00
|
|
|
avg = 0
|
2005-01-18 19:25:55 +01:00
|
|
|
stdev = 0
|
|
|
|
numoutsideavg = 0
|
2005-01-18 19:34:58 +01:00
|
|
|
numoutside1std = 0
|
|
|
|
numoutside2std = 0
|
2005-01-20 00:40:02 +01:00
|
|
|
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)
|
2005-01-14 23:50:36 +01:00
|
|
|
#loop through all the various ticks for each run
|
2005-01-20 00:40:02 +01:00
|
|
|
for tick in pairRunTicks:
|
|
|
|
info.globalTicks = tick
|
|
|
|
avg += float(stat)
|
|
|
|
avg /= len(pairRunTicks)
|
|
|
|
for tick in pairRunTicks:
|
|
|
|
info.globalTicks = tick
|
2005-01-14 23:50:36 +01:00
|
|
|
val = float(stat)
|
2005-01-18 19:25:55 +01:00
|
|
|
stdev += pow((val-avg),2)
|
2005-01-20 00:40:02 +01:00
|
|
|
stdev = math.sqrt(stdev / len(pairRunTicks))
|
|
|
|
for tick in pairRunTicks:
|
|
|
|
info.globalTicks = tick
|
2005-01-18 19:25:55 +01:00
|
|
|
val = float(stat)
|
2005-01-20 00:40:02 +01:00
|
|
|
if (val < (avg * .9)) or (val > (avg * 1.1)):
|
|
|
|
numoutsideavg += 1
|
2005-01-18 19:25:55 +01:00
|
|
|
if (val < (avg - stdev)) or (val > (avg + stdev)):
|
2005-01-18 19:34:58 +01:00
|
|
|
numoutside1std += 1
|
|
|
|
if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))):
|
|
|
|
numoutside2std += 1
|
2005-01-20 00:40:02 +01:00
|
|
|
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))
|
2005-01-14 23:50:36 +01:00
|
|
|
return
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
if command == 'stats':
|
|
|
|
if len(args) == 0:
|
|
|
|
info.source.listStats()
|
|
|
|
elif len(args) == 1:
|
|
|
|
info.source.listStats(args[0])
|
|
|
|
else:
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'stat':
|
|
|
|
if len(args) != 1:
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
stats = info.source.getStat(args[0])
|
|
|
|
for stat in stats:
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, stat.name, stat.name, stat)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
2005-01-14 05:59:39 +01:00
|
|
|
if options.ticks:
|
|
|
|
print 'only displaying sample %s' % options.ticks
|
2005-01-18 23:55:35 +01:00
|
|
|
info.globalTicks = [ int(x) for x in options.ticks.split() ]
|
2005-01-14 05:59:39 +01:00
|
|
|
|
2004-11-15 07:36:27 +01:00
|
|
|
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'
|
2005-01-14 05:59:39 +01:00
|
|
|
stat.bins = 'interrupt'
|
2004-11-15 07:36:27 +01:00
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print 'total ticks'
|
|
|
|
|
|
|
|
stat.bins = None
|
2004-08-10 03:20:52 +02:00
|
|
|
print stat.name
|
|
|
|
printdata(runs, stat)
|
|
|
|
return
|
|
|
|
|
2004-11-18 22:23:29 +01:00
|
|
|
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'
|
2005-01-14 05:59:39 +01:00
|
|
|
stat.bins = 'interrupt'
|
2004-11-18 22:23:29 +01:00
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print 'total ticks'
|
|
|
|
|
|
|
|
stat.bins = None
|
|
|
|
print args[0]
|
|
|
|
printdata(runs, stat)
|
|
|
|
return
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
if command == 'bins':
|
|
|
|
if len(args) == 0:
|
|
|
|
info.source.listBins()
|
|
|
|
elif len(args) == 1:
|
|
|
|
info.source.listBins(args[0])
|
|
|
|
else:
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'formulas':
|
|
|
|
if len(args) == 0:
|
|
|
|
info.source.listFormulas()
|
|
|
|
elif len(args) == 1:
|
|
|
|
info.source.listFormulas(args[0])
|
|
|
|
else:
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'samples':
|
|
|
|
if len(args):
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
info.source.listTicks(runs)
|
|
|
|
return
|
|
|
|
|
|
|
|
if len(args):
|
|
|
|
raise CommandException
|
|
|
|
|
2004-11-17 06:03:59 +01:00
|
|
|
system = info.source.__dict__[options.system]
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
if command == 'usertime':
|
|
|
|
import copy
|
2005-03-24 21:52:30 +01:00
|
|
|
kernel = copy.copy(system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
kernel.bins = 'kernel'
|
|
|
|
|
2005-03-24 21:52:30 +01:00
|
|
|
user = copy.copy(system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
user.bins = 'user'
|
|
|
|
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'usertime', 'User Fraction',
|
2005-03-24 21:52:30 +01:00
|
|
|
user / system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
2005-03-24 21:52:30 +01:00
|
|
|
printdata(runs, user / system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'ticks':
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.binned:
|
2004-08-10 03:20:52 +02:00
|
|
|
print 'kernel ticks'
|
2005-03-24 21:52:30 +01:00
|
|
|
system.full0.numCycles.bins = 'kernel'
|
|
|
|
printdata(runs, system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
print 'idle ticks'
|
2005-03-24 21:52:30 +01:00
|
|
|
system.full0.numCycles.bins = 'idle'
|
|
|
|
printdata(runs, system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
print 'user ticks'
|
2005-03-24 21:52:30 +01:00
|
|
|
system.full0.numCycles.bins = 'user'
|
|
|
|
printdata(runs, system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
print 'total ticks'
|
|
|
|
|
2005-03-24 21:52:30 +01:00
|
|
|
system.full0.numCycles.bins = None
|
|
|
|
printdata(runs, system.full0.numCycles)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'packets':
|
2005-03-24 21:52:30 +01:00
|
|
|
packets = system.tsunami.etherdev0.rxPackets
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'packets', 'Packets', packets)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, packets)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'ppt' or command == 'tpp':
|
2005-03-24 21:52:30 +01:00
|
|
|
ppt = system.tsunami.etherdev0.rxPackets / sim_ticks
|
2004-08-10 03:20:52 +02:00
|
|
|
printdata(runs, ppt, command == 'tpp')
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'pps':
|
2005-03-24 21:52:30 +01:00
|
|
|
pps = system.tsunami.etherdev0.rxPackets / sim_seconds
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'pps', 'Packets/s', pps)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, pps)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'bpt' or command == 'tpb':
|
2005-03-24 21:52:30 +01:00
|
|
|
bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
|
2004-08-10 03:20:52 +02:00
|
|
|
bpt = bytes / sim_ticks * 8
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'bpt', 'bps / Hz', bpt)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, bpt, command == 'tpb')
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'bptb' or command == 'tpbb':
|
2005-03-24 21:52:30 +01:00
|
|
|
bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
print 'kernel stats'
|
|
|
|
bytes.bins = 'kernel'
|
|
|
|
printdata(runs, bytes / ticks)
|
|
|
|
|
|
|
|
print 'idle stats'
|
|
|
|
bytes.bins = 'idle'
|
|
|
|
printdata(runs, bytes / ticks)
|
|
|
|
|
|
|
|
print 'user stats'
|
|
|
|
bytes.bins = 'user'
|
|
|
|
printdata(runs, bytes / ticks)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'bytes':
|
2005-03-24 21:52:30 +01:00
|
|
|
stat = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
|
2004-08-10 03:20:52 +02:00
|
|
|
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.binned:
|
2004-08-10 03:20:52 +02:00
|
|
|
print '%s kernel stats' % stat.name
|
|
|
|
stat.bins = 'kernel'
|
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print '%s idle stats' % stat.name
|
|
|
|
stat.bins = 'idle'
|
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print '%s user stats' % stat.name
|
|
|
|
stat.bins = 'user'
|
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print '%s total stats' % stat.name
|
|
|
|
stat.bins = None
|
|
|
|
|
|
|
|
printdata(runs, stat)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'rxbps':
|
2005-03-24 21:52:30 +01:00
|
|
|
gbps = system.tsunami.etherdev0.rxBandwidth / 1e9
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, gbps)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'txbps':
|
2005-03-24 21:52:30 +01:00
|
|
|
gbps = system.tsunami.etherdev0.txBandwidth / 1e9
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, gbps)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'bps':
|
2005-03-24 21:52:30 +01:00
|
|
|
rxbps = system.tsunami.etherdev0.rxBandwidth
|
|
|
|
txbps = system.tsunami.etherdev0.txBandwidth
|
2004-08-10 03:20:52 +02:00
|
|
|
gbps = (rxbps + txbps) / 1e9
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, gbps)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'misses':
|
2005-03-24 21:52:30 +01:00
|
|
|
stat = system.l2.overall_mshr_misses
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.binned:
|
2004-08-10 03:20:52 +02:00
|
|
|
print '%s kernel stats' % stat.name
|
|
|
|
stat.bins = 'kernel'
|
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print '%s idle stats' % stat.name
|
|
|
|
stat.bins = 'idle'
|
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print '%s user stats' % stat.name
|
|
|
|
stat.bins = 'user'
|
|
|
|
printdata(runs, stat)
|
|
|
|
|
|
|
|
print '%s total stats' % stat.name
|
|
|
|
|
|
|
|
stat.bins = None
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, stat)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'mpkb':
|
2005-03-24 21:52:30 +01:00
|
|
|
misses = system.l2.overall_mshr_misses
|
|
|
|
rxbytes = system.tsunami.etherdev0.rxBytes
|
|
|
|
txbytes = system.tsunami.etherdev0.txBytes
|
2004-08-10 03:20:52 +02:00
|
|
|
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.binned:
|
2004-08-10 03:20:52 +02:00
|
|
|
print 'mpkb kernel stats'
|
|
|
|
misses.bins = 'kernel'
|
|
|
|
mpkb = misses / ((rxbytes + txbytes) / 1024)
|
|
|
|
printdata(runs, mpkb)
|
|
|
|
|
|
|
|
print 'mpkb idle stats'
|
|
|
|
misses.bins = 'idle'
|
|
|
|
mpkb = misses / ((rxbytes + txbytes) / 1024)
|
|
|
|
printdata(runs, mpkb)
|
|
|
|
|
|
|
|
print 'mpkb user stats'
|
|
|
|
misses.bins = 'user'
|
|
|
|
mpkb = misses / ((rxbytes + txbytes) / 1024)
|
|
|
|
printdata(runs, mpkb)
|
|
|
|
|
|
|
|
print 'mpkb total stats'
|
|
|
|
|
|
|
|
mpkb = misses / ((rxbytes + txbytes) / 1024)
|
|
|
|
misses.bins = None
|
2004-09-10 20:34:23 +02:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb)
|
2004-08-10 03:20:52 +02:00
|
|
|
else:
|
|
|
|
printdata(runs, mpkb)
|
|
|
|
return
|
|
|
|
|
2004-11-18 22:23:29 +01:00
|
|
|
if command == 'ipkb':
|
2005-03-24 21:52:30 +01:00
|
|
|
interrupts = system.full0.kern.faults[4]
|
|
|
|
rxbytes = system.tsunami.etherdev0.rxBytes
|
|
|
|
txbytes = system.tsunami.etherdev0.txBytes
|
2004-11-18 22:23:29 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
if command == 'execute':
|
2005-03-24 21:52:30 +01:00
|
|
|
printdata(runs, system.full0.ISSUE__count)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'commit':
|
2005-03-24 21:52:30 +01:00
|
|
|
printdata(runs, system.full0.COM__count)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'fetch':
|
2005-03-24 21:52:30 +01:00
|
|
|
printdata(runs, system.full0.FETCH__count)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
2004-11-14 23:22:33 +01:00
|
|
|
if command == 'bpp':
|
2005-03-24 21:52:30 +01:00
|
|
|
ed = system.tsunami.etherdev0
|
2004-11-14 23:22:33 +01:00
|
|
|
bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets)
|
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'bpp', 'Bytes / Packet', bpp)
|
2004-11-14 23:22:33 +01:00
|
|
|
else:
|
|
|
|
printdata(runs, bpp)
|
|
|
|
return
|
|
|
|
|
2004-08-10 03:20:52 +02:00
|
|
|
if command == 'rxbpp':
|
2005-03-24 21:52:30 +01:00
|
|
|
bpp = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.rxPackets
|
2004-11-14 23:22:33 +01:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp)
|
2004-11-14 23:22:33 +01:00
|
|
|
else:
|
|
|
|
printdata(runs, bpp)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'txbpp':
|
2005-03-24 21:52:30 +01:00
|
|
|
bpp = system.tsunami.etherdev0.txBytes / system.tsunami.etherdev0.txPackets
|
2004-11-14 23:22:33 +01:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp)
|
2004-11-14 23:22:33 +01:00
|
|
|
else:
|
|
|
|
printdata(runs, bpp)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'rtp':
|
2005-03-24 21:52:30 +01:00
|
|
|
rtp = system.tsunami.etherdev0.rxPackets / system.tsunami.etherdev0.txPackets
|
2004-11-14 23:22:33 +01:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp)
|
2004-11-14 23:22:33 +01:00
|
|
|
else:
|
|
|
|
printdata(runs, rtp)
|
|
|
|
return
|
|
|
|
|
|
|
|
if command == 'rtb':
|
2005-03-24 21:52:30 +01:00
|
|
|
rtb = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.txBytes
|
2004-11-14 23:22:33 +01:00
|
|
|
if options.graph:
|
2004-11-18 22:23:29 +01:00
|
|
|
graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb)
|
2004-11-14 23:22:33 +01:00
|
|
|
else:
|
|
|
|
printdata(runs, rtb)
|
2004-08-10 03:20:52 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
raise CommandException
|
|
|
|
|
|
|
|
|
|
|
|
class Options: pass
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import getpass
|
|
|
|
|
|
|
|
options = Options()
|
|
|
|
options.host = 'zizzer.pool'
|
|
|
|
options.db = None
|
|
|
|
options.passwd = ''
|
|
|
|
options.user = getpass.getuser()
|
|
|
|
options.runs = None
|
|
|
|
options.system = 'client'
|
|
|
|
options.get = None
|
2004-09-10 20:34:23 +02:00
|
|
|
options.binned = False
|
|
|
|
options.graph = False
|
2005-01-12 19:44:47 +01:00
|
|
|
options.graph68 = False
|
2005-01-14 05:59:39 +01:00
|
|
|
options.ticks = False
|
2004-08-10 03:20:52 +02:00
|
|
|
|
2005-01-14 06:05:49 +01:00
|
|
|
opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:T:')
|
2004-08-10 03:20:52 +02:00
|
|
|
for o,a in opts:
|
2005-01-12 19:44:47 +01:00
|
|
|
if o == '-6':
|
|
|
|
options.graph68 = True
|
2004-08-10 03:20:52 +02:00
|
|
|
if o == '-B':
|
|
|
|
options.binned = True
|
|
|
|
if o == '-E':
|
|
|
|
printval.mode = 'E'
|
|
|
|
if o == '-F':
|
|
|
|
printval.mode = 'F'
|
|
|
|
if o == '-G':
|
|
|
|
options.graph = True;
|
|
|
|
if o == '-d':
|
|
|
|
options.db = a
|
|
|
|
if o == '-g':
|
|
|
|
options.get = a
|
|
|
|
if o == '-h':
|
|
|
|
options.host = a
|
|
|
|
if o == '-p':
|
|
|
|
options.passwd = getpass.getpass()
|
|
|
|
if o == '-r':
|
|
|
|
options.runs = a
|
|
|
|
if o == '-u':
|
|
|
|
options.user = a
|
|
|
|
if o == '-s':
|
|
|
|
options.system = a
|
2005-01-14 05:59:39 +01:00
|
|
|
if o == '-T':
|
|
|
|
options.ticks = a
|
2004-08-10 03:20:52 +02:00
|
|
|
|
|
|
|
if len(args) == 0:
|
|
|
|
usage()
|
|
|
|
|
|
|
|
command = args[0]
|
|
|
|
args = args[1:]
|
|
|
|
|
|
|
|
try:
|
|
|
|
commands(options, command, args)
|
|
|
|
except CommandException:
|
|
|
|
usage()
|