Deleted Added
sdiff udiff text old ( 1758:74acd5b23964 ) new ( 1772:a3a83e812a5e )
full compact
1#!/usr/bin/env python
2
3# Copyright (c) 2003-2004 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer;
10# redistributions in binary form must reproduce the above copyright
11# notice, this list of conditions and the following disclaimer in the
12# documentation and/or other materials provided with the distribution;
13# neither the name of the copyright holders nor the names of its
14# contributors may be used to endorse or promote products derived from
15# this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29#Permission is granted to use, copy, create derivative works and
30#redistribute this software and such derivative works for any purpose,
31#so long as the copyright notice above, this grant of permission, and
32#the disclaimer below appear in all copies made; and so long as the
33#name of The University of Michigan is not used in any advertising or
34#publicity pertaining to the use or distribution of this software
35#without specific, written prior authorization.
36#
37#THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE
38#UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY PURPOSE, AND WITHOUT
39#WARRANTY BY THE UNIVERSITY OF MICHIGAN OF ANY KIND, EITHER EXPRESS OR
40#IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
41#MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE REGENTS OF
42#THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE FOR ANY DAMAGES,
43#INCLUDING DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
44#DAMAGES, WITH RESPECT TO ANY CLAIM ARISING OUT OF OR IN CONNECTION
45#WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS BEEN OR IS HEREAFTER
46#ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
47
48from __future__ import division
49import re, sys, math
50
51
52def usage():
53 print '''\
54Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
55 [-s <system>] [-r <runs> ] [-T <samples>] [-u <username>]
56 <command> [command args]
57
58 commands extra parameters description
59 ----------- ------------------ ---------------------------------------
60 bins [regex] List bins (only matching regex)
61 formula <formula> Evaluated formula specified
62 formulas [regex] List formulas (only matching regex)
63 runs none List all runs in database
64 samples none List samples present in database
65 stability <pairnum> <stats> Calculated statistical info about stats
66 stat <regex> Show stat data (only matching regex)
67 stats [regex] List all stats (only matching regex)
68
69 database <command> Where command is drop, init, or clean
70
71''' % sys.argv[0]
72 sys.exit(1)
73
74def getopts(list, flags):
75 import getopt
76 try:
77 opts, args = getopt.getopt(list, flags)
78 except getopt.GetoptError:
79 usage()
80
81 return opts, args
82
83def printval(name, value, invert = False):
84 if invert and value != 0.0:
85 value = 1 / value
86
87 if value == (1e300*1e300):
88 return
89
90 if printval.mode == 'G':
91 print '%s: %g' % (name, value)
92 elif printval.mode != 'F' and value > 1e6:
93 print '%s: %0.5e' % (name, value)
94 else:
95 print '%s: %f' % (name, value)
96
97printval.mode = 'G'
98
99def unique(list):
100 set = {}
101 map(set.__setitem__, list, [])
102 return set.keys()
103
104#benchmarks = [ 'm', 's', 'snt', 'nb1', 'w1', 'w2', 'w3', 'w4', 'nm', 'ns', 'nw1', 'nw2', 'nw3' ]
105
106def graphdata(runs, options, tag, label, value):
107 import info
108
109 bench_system = {
110 'm' : 'client',
111 's' : 'client',
112 'snt' : 'client',
113 'nb1' : 'server',
114 'nb2' : 'server',
115 'nt1' : 'server',
116 'nt2' : 'server',
117 'w1' : 'server',
118 'w2' : 'server',
119 'w3' : 'server',
120 'w4' : 'server',
121 'w1s' : 'server',
122 'w2s' : 'server',
123 'w3s' : 'server',
124 'ns' : 'natbox',
125 'nm' : 'natbox',
126 'nw1' : 'natbox',
127 'nw2' : 'natbox',
128 'nw3' : 'natbox'
129 }
130
131 system_configs = {
132 's1' : 'Uni 4GHz',
133 'm1' : 'Uni 6GHz',
134 'f1' : 'Uni 8GHz',
135 'q1' : 'Uni 10GHz',
136 's2' : 'Dual 4GHz',
137 'm2' : 'Dual 6GHz',
138 's4' : 'Quad 4GHz',
139 'm4' : 'Quad 6GHz' }
140
141 configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
142 benchmarks = [ 'm', 'snt', 'w2', 'nm', 'nw2' ]
143 caches = [ '0', '2', '4' ]
144
145 names = []
146 for bench in benchmarks:
147 if bench_system[bench] != options.system:
148 continue
149
150 for cache in caches:
151 names.append([bench, cache])
152
153 for bench,cache in names:
154 base = '%s.%s' % (bench, cache)
155 fname = 'data/uni.%s.%s.dat' % (tag, base)
156 f = open(fname, 'w')
157 print >>f, '#set TITLE = '
158 print >>f, '#set ylbl = %s' % label
159 #print >>f, '#set sublabels = %s' % ' '.join(configs)
160 print >>f, '#set sublabels = ste hte htd ocm occ ocs'
161
162 for speed in ('s1', 'm1', 'f1', 'q1'):
163 label = system_configs[speed]
164 print >>f, '"%s"' % label,
165 for conf in configs:
166 name = '%s.%s.%s.%s' % (conf, bench, cache, speed)
167 run = info.source.allRunNames[name]
168 info.display_run = run.run;
169 val = float(value)
170 if val == 1e300*1e300:
171 print >>f, 0.0,
172 else:
173 print >>f, "%f" % val,
174 print >>f
175 f.close()
176
177 configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
178 benchmarks = [ 'w2']
179 caches = [ '0', '2', '4' ]
180
181 names = []
182 for bench in benchmarks:
183 if bench_system[bench] != options.system:
184 continue
185
186 for cache in caches:
187 names.append([bench, cache])
188
189 for bench,cache in names:
190 base = '%s.%s' % (bench, cache)
191 fname = 'data/mp.%s.%s.dat' % (tag, base)
192 f = open(fname, 'w')
193 print >>f, '#set TITLE = '
194 print >>f, '#set ylbl = %s' % label
195 #print >>f, '#set sublabels = %s' % ' '.join(configs)
196 print >>f, '#set sublabels = ste hte htd ocm occ ocs'
197
198 for speed in ('s2', 'm2', 's4', 'm4'):
199 label = system_configs[speed]
200 print >>f, '"%s"' % label,
201 for conf in configs:
202 name = '%s.%s.%s.%s' % (conf, bench, cache, speed)
203 run = info.source.allRunNames[name]
204 info.display_run = run.run;
205 val = float(value)
206 if val == 1e300*1e300:
207 print >>f, 0.0,
208 else:
209 print >>f, "%f" % val,
210 print >>f
211 f.close()
212
213def printdata(runs, value, invert = False):
214 import info
215 for run in runs:
216 info.display_run = run.run;
217 val = float(value)
218 printval(run.name, val)
219
220class CommandException(Exception):
221 pass
222
223def commands(options, command, args):
224 if command == 'database':
225 if len(args) == 0: raise CommandException
226
227 import dbinit
228 mydb = dbinit.MyDB(options)
229
230 if args[0] == 'drop':
231 if len(args) > 2: raise CommandException
232 mydb.admin()
233 mydb.drop()
234 if len(args) == 2 and args[1] == 'init':
235 mydb.create()
236 mydb.connect()
237 mydb.populate()
238 mydb.close()
239 return
240
241 if args[0] == 'init':
242 if len(args) > 1: raise CommandException
243 mydb.admin()
244 mydb.create()
245 mydb.connect()
246 mydb.populate()
247 mydb.close()
248 return
249
250 if args[0] == 'clean':
251 if len(args) > 1: raise CommandException
252 mydb.connect()
253 mydb.clean()
254 return
255
256 raise CommandException
257
258 import db, info
259 info.source = db.Database()
260 info.source.host = options.host
261 info.source.db = options.db
262 info.source.passwd = options.passwd
263 info.source.user = options.user
264 info.source.connect()
265 info.source.update_dict(globals())
266
267 if type(options.get) is str:
268 info.source.get = options.get
269
270 if options.runs is None:
271 runs = info.source.allRuns
272 else:
273 rx = re.compile(options.runs)
274 runs = []
275 for run in info.source.allRuns:
276 if rx.match(run.name):
277 runs.append(run)
278
279 info.display_run = runs[0].run
280
281 if command == 'runs':
282 user = None
283 opts, args = getopts(args, '-u')
284 if len(args):
285 raise CommandException
286 for o,a in opts:
287 if o == '-u':
288 user = a
289 info.source.listRuns(user)
290 return
291
292 if command == 'stability':
293 if len(args) < 2:
294 raise CommandException
295
296 try:
297 merge = int(args[0])
298 except ValueError:
299 usage()
300 stats = info.source.getStat(args[1])
301 info.source.get = "sum"
302
303
304 #loop through all the stats selected
305 for stat in stats:
306
307 print "%s:" % stat.name
308 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
309 ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV")
310 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
311 ("--------------------", "------------",
312 "------------", "----", "-----", "-----", "-----", "----------")
313 #loop through all the selected runs
314 for run in runs:
315 info.display_run = run.run;
316 runTicks = info.source.retTicks([ run ])
317 #throw away the first one, it's 0
318 runTicks.pop(0)
319 info.globalTicks = runTicks
320 avg = 0
321 stdev = 0
322 numoutsideavg = 0
323 numoutside1std = 0
324 numoutside2std = 0
325 pairRunTicks = []
326 if float(stat) == 1e300*1e300:
327 continue
328 for t in range(0, len(runTicks)-(merge-1), merge):
329 tempPair = []
330 for p in range(0,merge):
331 tempPair.append(runTicks[t+p])
332 pairRunTicks.append(tempPair)
333 #loop through all the various ticks for each run
334 for tick in pairRunTicks:
335 info.globalTicks = tick
336 avg += float(stat)
337 avg /= len(pairRunTicks)
338 for tick in pairRunTicks:
339 info.globalTicks = tick
340 val = float(stat)
341 stdev += pow((val-avg),2)
342 stdev = math.sqrt(stdev / len(pairRunTicks))
343 for tick in pairRunTicks:
344 info.globalTicks = tick
345 val = float(stat)
346 if (val < (avg * .9)) or (val > (avg * 1.1)):
347 numoutsideavg += 1
348 if (val < (avg - stdev)) or (val > (avg + stdev)):
349 numoutside1std += 1
350 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))):
351 numoutside2std += 1
352 if avg > 1000:
353 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
354 (run.name, "%.1f" % avg, "%.1f" % stdev,
355 "%d" % numoutsideavg, "%d" % numoutside1std,
356 "%d" % numoutside2std, "%d" % len(pairRunTicks),
357 "%.3f" % (stdev/avg*100))
358 elif avg > 100:
359 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
360 (run.name, "%.1f" % avg, "%.1f" % stdev,
361 "%d" % numoutsideavg, "%d" % numoutside1std,
362 "%d" % numoutside2std, "%d" % len(pairRunTicks),
363 "%.5f" % (stdev/avg*100))
364 else:
365 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \
366 (run.name, "%.5f" % avg, "%.5f" % stdev,
367 "%d" % numoutsideavg, "%d" % numoutside1std,
368 "%d" % numoutside2std, "%d" % len(pairRunTicks),
369 "%.7f" % (stdev/avg*100))
370 return
371
372 if command == 'stats':
373 if len(args) == 0:
374 info.source.listStats()
375 elif len(args) == 1:
376 info.source.listStats(args[0])
377 else:
378 raise CommandException
379
380 return
381
382 if command == 'stat':
383 if len(args) != 1:
384 raise CommandException
385
386 stats = info.source.getStat(args[0])
387 for stat in stats:
388 if options.graph:
389 graphdata(runs, options, stat.name, stat.name, stat)
390 else:
391 if options.ticks:
392 print 'only displaying sample %s' % options.ticks
393 info.globalTicks = [ int(x) for x in options.ticks.split() ]
394
395 if options.binned:
396 print 'kernel ticks'
397 stat.bins = 'kernel'
398 printdata(runs, stat)
399
400 print 'idle ticks'
401 stat.bins = 'idle'
402 printdata(runs, stat)
403
404 print 'user ticks'
405 stat.bins = 'user'
406 printdata(runs, stat)
407
408 print 'interrupt ticks'
409 stat.bins = 'interrupt'
410 printdata(runs, stat)
411
412 print 'total ticks'
413
414 stat.bins = None
415 print stat.name
416 printdata(runs, stat)
417 return
418
419 if command == 'formula':
420 if len(args) != 1:
421 raise CommandException
422
423 stats = eval(args[0])
424 for stat in stats:
425 if options.graph:
426 graphdata(runs, options, stat.name, stat.name, stat)
427 else:
428 if options.binned:
429 print 'kernel ticks'
430 stat.bins = 'kernel'
431 printdata(runs, stat)
432
433 print 'idle ticks'
434 stat.bins = 'idle'
435 printdata(runs, stat)
436
437 print 'user ticks'
438 stat.bins = 'user'
439 printdata(runs, stat)
440
441 print 'interrupt ticks'
442 stat.bins = 'interrupt'
443 printdata(runs, stat)
444
445 print 'total ticks'
446
447 stat.bins = None
448 print args[0]
449 printdata(runs, stat)
450 return
451
452 if command == 'bins':
453 if len(args) == 0:
454 info.source.listBins()
455 elif len(args) == 1:
456 info.source.listBins(args[0])
457 else:
458 raise CommandException
459
460 return
461
462 if command == 'formulas':
463 if len(args) == 0:
464 info.source.listFormulas()
465 elif len(args) == 1:
466 info.source.listFormulas(args[0])
467 else:
468 raise CommandException
469
470 return
471
472 if command == 'samples':
473 if len(args):
474 raise CommandException
475
476 info.source.listTicks(runs)
477 return
478
479 if len(args):
480 raise CommandException
481
482 system = info.source.__dict__[options.system]
483
484 if command == 'usertime':
485 import copy
486 kernel = copy.copy(system.full0.numCycles)
487 kernel.bins = 'kernel'
488
489 user = copy.copy(system.full0.numCycles)
490 user.bins = 'user'
491
492 if options.graph:
493 graphdata(runs, options, 'usertime', 'User Fraction',
494 user / system.full0.numCycles)
495 else:
496 printdata(runs, user / system.full0.numCycles)
497 return
498
499 if command == 'ticks':
500 if options.binned:
501 print 'kernel ticks'
502 system.full0.numCycles.bins = 'kernel'
503 printdata(runs, system.full0.numCycles)
504
505 print 'idle ticks'
506 system.full0.numCycles.bins = 'idle'
507 printdata(runs, system.full0.numCycles)
508
509 print 'user ticks'
510 system.full0.numCycles.bins = 'user'
511 printdata(runs, system.full0.numCycles)
512
513 print 'total ticks'
514
515 system.full0.numCycles.bins = None
516 printdata(runs, system.full0.numCycles)
517 return
518
519 if command == 'packets':
520 packets = system.tsunami.etherdev0.rxPackets
521 if options.graph:
522 graphdata(runs, options, 'packets', 'Packets', packets)
523 else:
524 printdata(runs, packets)
525 return
526
527 if command == 'ppt' or command == 'tpp':
528 ppt = system.tsunami.etherdev0.rxPackets / sim_ticks
529 printdata(runs, ppt, command == 'tpp')
530 return
531
532 if command == 'pps':
533 pps = system.tsunami.etherdev0.rxPackets / sim_seconds
534 if options.graph:
535 graphdata(runs, options, 'pps', 'Packets/s', pps)
536 else:
537 printdata(runs, pps)
538 return
539
540 if command == 'bpt' or command == 'tpb':
541 bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
542 bpt = bytes / sim_ticks * 8
543 if options.graph:
544 graphdata(runs, options, 'bpt', 'bps / Hz', bpt)
545 else:
546 printdata(runs, bpt, command == 'tpb')
547 return
548
549 if command == 'bptb' or command == 'tpbb':
550 bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
551
552 print 'kernel stats'
553 bytes.bins = 'kernel'
554 printdata(runs, bytes / ticks)
555
556 print 'idle stats'
557 bytes.bins = 'idle'
558 printdata(runs, bytes / ticks)
559
560 print 'user stats'
561 bytes.bins = 'user'
562 printdata(runs, bytes / ticks)
563
564 return
565
566 if command == 'bytes':
567 stat = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes
568
569 if options.binned:
570 print '%s kernel stats' % stat.name
571 stat.bins = 'kernel'
572 printdata(runs, stat)
573
574 print '%s idle stats' % stat.name
575 stat.bins = 'idle'
576 printdata(runs, stat)
577
578 print '%s user stats' % stat.name
579 stat.bins = 'user'
580 printdata(runs, stat)
581
582 print '%s total stats' % stat.name
583 stat.bins = None
584
585 printdata(runs, stat)
586 return
587
588 if command == 'rxbps':
589 gbps = system.tsunami.etherdev0.rxBandwidth / 1e9
590 if options.graph:
591 graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps)
592 else:
593 printdata(runs, gbps)
594 return
595
596 if command == 'txbps':
597 gbps = system.tsunami.etherdev0.txBandwidth / 1e9
598 if options.graph:
599 graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps)
600 else:
601 printdata(runs, gbps)
602 return
603
604 if command == 'bps':
605 rxbps = system.tsunami.etherdev0.rxBandwidth
606 txbps = system.tsunami.etherdev0.txBandwidth
607 gbps = (rxbps + txbps) / 1e9
608 if options.graph:
609 graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps)
610 else:
611 printdata(runs, gbps)
612 return
613
614 if command == 'misses':
615 stat = system.l2.overall_mshr_misses
616 if options.binned:
617 print '%s kernel stats' % stat.name
618 stat.bins = 'kernel'
619 printdata(runs, stat)
620
621 print '%s idle stats' % stat.name
622 stat.bins = 'idle'
623 printdata(runs, stat)
624
625 print '%s user stats' % stat.name
626 stat.bins = 'user'
627 printdata(runs, stat)
628
629 print '%s total stats' % stat.name
630
631 stat.bins = None
632 if options.graph:
633 graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat)
634 else:
635 printdata(runs, stat)
636 return
637
638 if command == 'mpkb':
639 misses = system.l2.overall_mshr_misses
640 rxbytes = system.tsunami.etherdev0.rxBytes
641 txbytes = system.tsunami.etherdev0.txBytes
642
643 if options.binned:
644 print 'mpkb kernel stats'
645 misses.bins = 'kernel'
646 mpkb = misses / ((rxbytes + txbytes) / 1024)
647 printdata(runs, mpkb)
648
649 print 'mpkb idle stats'
650 misses.bins = 'idle'
651 mpkb = misses / ((rxbytes + txbytes) / 1024)
652 printdata(runs, mpkb)
653
654 print 'mpkb user stats'
655 misses.bins = 'user'
656 mpkb = misses / ((rxbytes + txbytes) / 1024)
657 printdata(runs, mpkb)
658
659 print 'mpkb total stats'
660
661 mpkb = misses / ((rxbytes + txbytes) / 1024)
662 misses.bins = None
663 if options.graph:
664 graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb)
665 else:
666 printdata(runs, mpkb)
667 return
668
669 if command == 'ipkb':
670 interrupts = system.full0.kern.faults[4]
671 rxbytes = system.tsunami.etherdev0.rxBytes
672 txbytes = system.tsunami.etherdev0.txBytes
673
674 if options.binned:
675 print 'ipkb kernel stats'
676 interrupts.bins = 'kernel'
677 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
678 printdata(runs, ipkb)
679
680 print 'ipkb idle stats'
681 interrupts.bins = 'idle'
682 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
683 printdata(runs, ipkb)
684
685 print 'ipkb user stats'
686 interrupts.bins = 'user'
687 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
688 printdata(runs, ipkb)
689
690 print 'ipkb total stats'
691
692 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
693 interrupts.bins = None
694 if options.graph:
695 graphdata(runs, options, 'ipkb', 'Interrupts / KB', ipkb)
696 else:
697 printdata(runs, ipkb)
698 return
699
700 if command == 'execute':
701 printdata(runs, system.full0.ISSUE__count)
702 return
703
704 if command == 'commit':
705 printdata(runs, system.full0.COM__count)
706 return
707
708 if command == 'fetch':
709 printdata(runs, system.full0.FETCH__count)
710 return
711
712 if command == 'bpp':
713 ed = system.tsunami.etherdev0
714 bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets)
715 if options.graph:
716 graphdata(runs, options, 'bpp', 'Bytes / Packet', bpp)
717 else:
718 printdata(runs, bpp)
719 return
720
721 if command == 'rxbpp':
722 bpp = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.rxPackets
723 if options.graph:
724 graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp)
725 else:
726 printdata(runs, bpp)
727 return
728
729 if command == 'txbpp':
730 bpp = system.tsunami.etherdev0.txBytes / system.tsunami.etherdev0.txPackets
731 if options.graph:
732 graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp)
733 else:
734 printdata(runs, bpp)
735 return
736
737 if command == 'rtp':
738 rtp = system.tsunami.etherdev0.rxPackets / system.tsunami.etherdev0.txPackets
739 if options.graph:
740 graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp)
741 else:
742 printdata(runs, rtp)
743 return
744
745 if command == 'rtb':
746 rtb = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.txBytes
747 if options.graph:
748 graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb)
749 else:
750 printdata(runs, rtb)
751 return
752
753 raise CommandException
754
755
756class Options: pass
757
758if __name__ == '__main__':
759 import getpass
760
761 options = Options()
762 options.host = 'zizzer.pool'
763 options.db = None
764 options.passwd = ''
765 options.user = getpass.getuser()
766 options.runs = None
767 options.system = 'client'
768 options.get = None
769 options.binned = False
770 options.graph = False
771 options.ticks = False
772
773 opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:T:')
774 for o,a in opts:
775 if o == '-B':
776 options.binned = True
777 if o == '-E':
778 printval.mode = 'E'
779 if o == '-F':
780 printval.mode = 'F'
781 if o == '-G':
782 options.graph = True;
783 if o == '-d':
784 options.db = a
785 if o == '-g':
786 options.get = a
787 if o == '-h':
788 options.host = a
789 if o == '-p':
790 options.passwd = getpass.getpass()
791 if o == '-r':
792 options.runs = a
793 if o == '-u':
794 options.user = a
795 if o == '-s':
796 options.system = a
797 if o == '-T':
798 options.ticks = a
799
800 if len(args) == 0:
801 usage()
802
803 command = args[0]
804 args = args[1:]
805
806 try:
807 commands(options, command, args)
808 except CommandException:
809 usage()