summaryrefslogtreecommitdiff
path: root/util/stats/stats.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/stats/stats.py')
-rwxr-xr-xutil/stats/stats.py680
1 files changed, 207 insertions, 473 deletions
diff --git a/util/stats/stats.py b/util/stats/stats.py
index be9767d6e..c53d77d54 100755
--- a/util/stats/stats.py
+++ b/util/stats/stats.py
@@ -29,10 +29,9 @@
from __future__ import division
import re, sys, math
-
def usage():
print '''\
-Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
+Usage: %s [-E] [-F] [ -G <get> ] [-d <db> ] [-g <graphdir> ] [-h <host>] [-p]
[-s <system>] [-r <runs> ] [-T <samples>] [-u <username>]
<command> [command args]
@@ -61,143 +60,6 @@ def getopts(list, flags):
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()
-
-#benchmarks = [ 'm', 's', 'snt', 'nb1', 'w1', 'w2', 'w3', 'w4', 'nm', 'ns', 'nw1', 'nw2', 'nw3' ]
-
-def graphdata(runs, options, tag, label, value):
- import info
-
- 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'
- }
-
- system_configs = {
- 's1' : 'Uni 4GHz',
- 'm1' : 'Uni 6GHz',
- 'f1' : 'Uni 8GHz',
- 'q1' : 'Uni 10GHz',
- 's2' : 'Dual 4GHz',
- 'm2' : 'Dual 6GHz',
- 's4' : 'Quad 4GHz',
- 'm4' : 'Quad 6GHz' }
-
- configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
- benchmarks = [ 'm', 'snt', 'w2', 'nm', 'nw2' ]
- caches = [ '0', '2', '4' ]
-
- names = []
- for bench in benchmarks:
- if bench_system[bench] != options.system:
- continue
-
- for cache in caches:
- names.append([bench, cache])
-
- for bench,cache in names:
- base = '%s.%s' % (bench, cache)
- fname = 'data/uni.%s.%s.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 in ('s1', 'm1', 'f1', 'q1'):
- label = system_configs[speed]
- print >>f, '"%s"' % label,
- for conf in configs:
- name = '%s.%s.%s.%s' % (conf, bench, 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()
-
- configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
- benchmarks = [ 'w2']
- caches = [ '0', '2', '4' ]
-
- names = []
- for bench in benchmarks:
- if bench_system[bench] != options.system:
- continue
-
- for cache in caches:
- names.append([bench, cache])
-
- for bench,cache in names:
- base = '%s.%s' % (bench, cache)
- fname = 'data/mp.%s.%s.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 in ('s2', 'm2', 's4', 'm4'):
- label = system_configs[speed]
- print >>f, '"%s"' % label,
- for conf in configs:
- name = '%s.%s.%s.%s' % (conf, bench, 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 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
@@ -243,7 +105,7 @@ def commands(options, command, args):
info.source.passwd = options.passwd
info.source.user = options.user
info.source.connect()
- info.source.update_dict(globals())
+ #info.source.update_dict(globals())
if type(options.get) is str:
info.source.get = options.get
@@ -270,6 +132,43 @@ def commands(options, command, args):
info.source.listRuns(user)
return
+ 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 == '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 command == 'stability':
if len(args) < 2:
raise CommandException
@@ -281,16 +180,19 @@ def commands(options, command, args):
stats = info.source.getStat(args[1])
info.source.get = "sum"
+ def disp(*args):
+ print "%-20s %12s %12s %4s %5s %5s %5s %10s" % args
+
+ # temporary variable containing a bunch of dashes
+ d = '-' * 100
#loop through all the stats selected
for stat in stats:
-
print "%s:" % stat.name
- 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 %10s" % \
- ("--------------------", "------------",
- "------------", "----", "-----", "-----", "-----", "----------")
+ disp("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV",
+ "SAMP", "CV")
+ disp(d[:20], d[:12], d[:12], d[:4], d[:5], d[:5], d[:5], d[:10])
+
#loop through all the selected runs
for run in runs:
info.display_run = run.run;
@@ -331,130 +233,63 @@ def commands(options, command, args):
if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))):
numoutside2std += 1
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))
+ disp(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))
+ disp(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))
+ disp(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()
- elif len(args) == 1:
- info.source.listStats(args[0])
- else:
- raise CommandException
-
- return
-
- if command == 'stat':
- if len(args) != 1:
+ if command == 'all':
+ if len(args):
raise CommandException
- stats = info.source.getStat(args[0])
- for stat in stats:
- if options.graph:
- graphdata(runs, options, stat.name, stat.name, stat)
- else:
- if options.ticks:
- print 'only displaying sample %s' % options.ticks
- info.globalTicks = [ int(x) for x in options.ticks.split() ]
-
- 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 = 'interrupt'
- printdata(runs, stat)
-
- print 'total ticks'
-
- stat.bins = None
- print stat.name
- printdata(runs, stat)
- return
+ all = [ 'bps', 'rxbps', 'txbps', 'bpt',
+ 'misses', 'mpkb',
+ 'ipkb',
+ 'pps', 'bpp', 'txbpp', 'rxbpp',
+ 'rtp', 'rtb' ]
+ for command in all:
+ commands(options, command, args)
- if command == 'formula':
- if len(args) != 1:
- raise CommandException
+ if options.ticks:
+ if not options.graph:
+ print 'only displaying sample %s' % options.ticks
+ info.globalTicks = [ int(x) for x in options.ticks.split() ]
- 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 = 'interrupt'
- printdata(runs, stat)
-
- print 'total ticks'
-
- stat.bins = None
- print args[0]
- printdata(runs, stat)
- return
+ from output import StatOutput
- if command == 'bins':
- if len(args) == 0:
- info.source.listBins()
- elif len(args) == 1:
- info.source.listBins(args[0])
+ def display():
+ if options.graph:
+ output.graph(options.graphdir)
else:
- raise CommandException
+ output.display(options.binned, options.printmode)
- return
- if command == 'formulas':
- if len(args) == 0:
- info.source.listFormulas()
- elif len(args) == 1:
- info.source.listFormulas(args[0])
- else:
+ if command == 'stat' or command == 'formula':
+ if len(args) != 1:
raise CommandException
- return
+ if command == 'stat':
+ stats = info.source.getStat(args[0])
+ if command == 'formula':
+ stats = eval(args[0])
- if command == 'samples':
- if len(args):
- raise CommandException
+ for stat in stats:
+ output = StatOutput(stat.name, options.jobfile)
+ output.stat = stat
+ output.label = stat.name
+ display()
- info.source.listTicks(runs)
return
if len(args):
@@ -462,273 +297,151 @@ def commands(options, command, args):
system = info.source.__dict__[options.system]
+ from proxy import ProxyGroup
+ sim_ticks = info.source['sim_ticks']
+ sim_seconds = info.source['sim_seconds']
+ proxy = ProxyGroup(system = info.source[options.system])
+ system = proxy.system
+
+ etherdev = system.tsunami.etherdev0
+ bytes = etherdev.rxBytes + etherdev.txBytes
+ kbytes = bytes / 1024
+ packets = etherdev.rxPackets + etherdev.txPackets
+ bps = etherdev.rxBandwidth + etherdev.txBandwidth
+
+ output = StatOutput(command, options.jobfile)
+
if command == 'usertime':
import copy
- kernel = copy.copy(system.full0.numCycles)
- kernel.bins = 'kernel'
-
user = copy.copy(system.full0.numCycles)
user.bins = 'user'
- if options.graph:
- graphdata(runs, options, 'usertime', 'User Fraction',
- user / system.full0.numCycles)
- else:
- printdata(runs, user / system.full0.numCycles)
+ output.stat = user / system.full0.numCycles
+ output.label = 'User Fraction'
+
+ display()
return
if command == 'ticks':
- if options.binned:
- print 'kernel ticks'
- system.full0.numCycles.bins = 'kernel'
- printdata(runs, system.full0.numCycles)
+ output.stat = system.full0.numCycles
+ output.binstats = [ system.full0.numCycles ]
- print 'idle ticks'
- system.full0.numCycles.bins = 'idle'
- printdata(runs, system.full0.numCycles)
-
- print 'user ticks'
- system.full0.numCycles.bins = 'user'
- printdata(runs, system.full0.numCycles)
-
- print 'total ticks'
+ display()
+ return
- system.full0.numCycles.bins = None
- printdata(runs, system.full0.numCycles)
+ if command == 'bytes':
+ output.stat = bytes
+ display()
return
if command == 'packets':
- packets = system.tsunami.etherdev0.rxPackets
- if options.graph:
- graphdata(runs, options, 'packets', 'Packets', packets)
- else:
- printdata(runs, packets)
+ output.stat = packets
+ display()
return
if command == 'ppt' or command == 'tpp':
- ppt = system.tsunami.etherdev0.rxPackets / sim_ticks
- printdata(runs, ppt, command == 'tpp')
+ output.stat = packets / sim_ticks
+ output.invert = command == 'tpp'
+ display()
return
if command == 'pps':
- pps = system.tsunami.etherdev0.rxPackets / sim_seconds
- if options.graph:
- graphdata(runs, options, 'pps', 'Packets/s', pps)
- else:
- printdata(runs, pps)
+ output.stat = packets / sim_seconds
+ output.label = 'Packets/s'
+ display()
return
if command == 'bpt' or command == 'tpb':
- bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
- bpt = bytes / sim_ticks * 8
- if options.graph:
- graphdata(runs, options, 'bpt', 'bps / Hz', bpt)
- else:
- printdata(runs, bpt, command == 'tpb')
+ output.stat = bytes / sim_ticks * 8
+ output.label = 'bps / Hz'
+ output.invert = command == 'tpb'
+ display()
return
- if command == 'bptb' or command == 'tpbb':
- bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
-
- 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)
-
+ if command == 'rxbps':
+ output.stat = etherdev.rxBandwidth / 1e9
+ output.label = 'Bandwidth (Gbps)'
+ display()
return
- if command == 'bytes':
- stat = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
-
- if options.binned:
- 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)
+ if command == 'txbps':
+ output.stat = etherdev.txBandwidth / 1e9
+ output.label = 'Bandwidth (Gbps)'
+ display()
return
- if command == 'rxbps':
- gbps = system.tsunami.etherdev0.rxBandwidth / 1e9
- if options.graph:
- graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps)
- else:
- printdata(runs, gbps)
+ if command == 'bps':
+ output.stat = bps / 1e9
+ output.label = 'Bandwidth (Gbps)'
+ display()
return
- if command == 'txbps':
- gbps = system.tsunami.etherdev0.txBandwidth / 1e9
- if options.graph:
- graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps)
- else:
- printdata(runs, gbps)
+ if command == 'bpp':
+ output.stat = bytes / packets
+ output.label = 'Bytes / Packet'
+ display()
return
- if command == 'bps':
- rxbps = system.tsunami.etherdev0.rxBandwidth
- txbps = system.tsunami.etherdev0.txBandwidth
- gbps = (rxbps + txbps) / 1e9
- if options.graph:
- graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps)
- else:
- printdata(runs, gbps)
+ if command == 'rxbpp':
+ output.stat = etherdev.rxBytes / etherdev.rxPackets
+ output.label = 'Receive Bytes / Packet'
+ display()
return
- if command == 'misses':
- stat = system.l2.overall_mshr_misses
- if options.binned:
- print '%s kernel stats' % stat.name
- stat.bins = 'kernel'
- printdata(runs, stat)
+ if command == 'txbpp':
+ output.stat = etherdev.txBytes / etherdev.txPackets
+ output.label = 'Transmit Bytes / Packet'
+ display()
+ return
- print '%s idle stats' % stat.name
- stat.bins = 'idle'
- printdata(runs, stat)
+ if command == 'rtp':
+ output.stat = etherdev.rxPackets / etherdev.txPackets
+ output.label = 'rxPackets / txPackets'
+ display()
+ return
- print '%s user stats' % stat.name
- stat.bins = 'user'
- printdata(runs, stat)
+ if command == 'rtb':
+ output.stat = etherdev.rxBytes / etherdev.txBytes
+ output.label = 'rxBytes / txBytes'
+ display()
+ return
- print '%s total stats' % stat.name
+ misses = system.l2.overall_mshr_misses
- stat.bins = None
- if options.graph:
- graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat)
- else:
- printdata(runs, stat)
+ if command == 'misses':
+ output.stat = misses
+ output.label = 'Overall MSHR Misses'
+ display()
return
if command == 'mpkb':
- misses = system.l2.overall_mshr_misses
- rxbytes = system.tsunami.etherdev0.rxBytes
- txbytes = system.tsunami.etherdev0.txBytes
-
- if options.binned:
- 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
- if options.graph:
- graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb)
- else:
- printdata(runs, mpkb)
+ output.stat = misses / (bytes / 1024)
+ output.binstats = [ misses ]
+ output.label = 'Misses / KB'
+ display()
return
if command == 'ipkb':
interrupts = system.full0.kern.faults[4]
- rxbytes = system.tsunami.etherdev0.rxBytes
- txbytes = system.tsunami.etherdev0.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)
+ output.stat = interrupts / kbytes
+ output.binstats = [ interrupts ]
+ output.label = 'Interrupts / KB'
+ display()
return
if command == 'execute':
- printdata(runs, system.full0.ISSUE__count)
+ output.stat = system.full0.ISSUE__count
+ display()
return
if command == 'commit':
- printdata(runs, system.full0.COM__count)
+ output.stat = system.full0.COM__count
+ display()
return
if command == 'fetch':
- printdata(runs, system.full0.FETCH__count)
- return
-
- if command == 'bpp':
- ed = system.tsunami.etherdev0
- 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.etherdev0.rxBytes / system.tsunami.etherdev0.rxPackets
- if options.graph:
- graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp)
- else:
- printdata(runs, bpp)
- return
-
- if command == 'txbpp':
- bpp = system.tsunami.etherdev0.txBytes / system.tsunami.etherdev0.txPackets
- if options.graph:
- graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp)
- else:
- printdata(runs, bpp)
- return
-
- if command == 'rtp':
- rtp = system.tsunami.etherdev0.rxPackets / system.tsunami.etherdev0.txPackets
- if options.graph:
- graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp)
- else:
- printdata(runs, rtp)
- return
-
- if command == 'rtb':
- rtb = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.txBytes
- if options.graph:
- graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb)
- else:
- printdata(runs, rtb)
+ output.stat = system.full0.FETCH__count
+ display()
return
raise CommandException
@@ -738,9 +451,10 @@ class Options: pass
if __name__ == '__main__':
import getpass
+ from jobfile import JobFile
options = Options()
- options.host = 'zizzer.pool'
+ options.host = None
options.db = None
options.passwd = ''
options.user = getpass.getuser()
@@ -750,23 +464,31 @@ if __name__ == '__main__':
options.binned = False
options.graph = False
options.ticks = False
+ options.printmode = 'G'
+ options.jobfile = None
+ options.all = False
- opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:T:')
+ opts, args = getopts(sys.argv[1:], '-BEFG:ad:g:h:j:pr:s:u:T:')
for o,a in opts:
if o == '-B':
options.binned = True
if o == '-E':
- printval.mode = 'E'
+ options.printmode = 'E'
if o == '-F':
- printval.mode = 'F'
+ options.printmode = 'F'
if o == '-G':
- options.graph = True;
+ options.get = a
+ if o == '-a':
+ options.all = True
if o == '-d':
options.db = a
if o == '-g':
- options.get = a
+ options.graph = True;
+ options.graphdir = a
if o == '-h':
options.host = a
+ if o == '-j':
+ options.jobfile = JobFile(a)
if o == '-p':
options.passwd = getpass.getpass()
if o == '-r':
@@ -778,6 +500,18 @@ if __name__ == '__main__':
if o == '-T':
options.ticks = a
+ if options.jobfile:
+ if not options.host:
+ options.host = options.jobfile.dbhost
+ if not options.db:
+ options.db = options.jobfile.statdb
+
+ if not options.host:
+ sys.exit('Database server must be provided from a jobfile or -h')
+
+ if not options.db:
+ sys.exit('Database name must be provided from a jobfile or -d')
+
if len(args) == 0:
usage()