stats.py (1772:a3a83e812a5e) | stats.py (1881:fc205a7edd58) |
---|---|
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 --- 15 unchanged lines hidden (view full) --- 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 29from __future__ import division 30import re, sys, math 31 | 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 --- 15 unchanged lines hidden (view full) --- 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 29from __future__ import division 30import re, sys, math 31 |
32 | |
33def usage(): 34 print '''\ | 32def usage(): 33 print '''\ |
35Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p] | 34Usage: %s [-E] [-F] [ -G <get> ] [-d <db> ] [-g <graphdir> ] [-h <host>] [-p] |
36 [-s <system>] [-r <runs> ] [-T <samples>] [-u <username>] 37 <command> [command args] 38 39 commands extra parameters description 40 ----------- ------------------ --------------------------------------- 41 bins [regex] List bins (only matching regex) 42 formula <formula> Evaluated formula specified 43 formulas [regex] List formulas (only matching regex) --- 12 unchanged lines hidden (view full) --- 56 import getopt 57 try: 58 opts, args = getopt.getopt(list, flags) 59 except getopt.GetoptError: 60 usage() 61 62 return opts, args 63 | 35 [-s <system>] [-r <runs> ] [-T <samples>] [-u <username>] 36 <command> [command args] 37 38 commands extra parameters description 39 ----------- ------------------ --------------------------------------- 40 bins [regex] List bins (only matching regex) 41 formula <formula> Evaluated formula specified 42 formulas [regex] List formulas (only matching regex) --- 12 unchanged lines hidden (view full) --- 55 import getopt 56 try: 57 opts, args = getopt.getopt(list, flags) 58 except getopt.GetoptError: 59 usage() 60 61 return opts, args 62 |
64def printval(name, value, invert = False): 65 if invert and value != 0.0: 66 value = 1 / value 67 68 if value == (1e300*1e300): 69 return 70 71 if printval.mode == 'G': 72 print '%s: %g' % (name, value) 73 elif printval.mode != 'F' and value > 1e6: 74 print '%s: %0.5e' % (name, value) 75 else: 76 print '%s: %f' % (name, value) 77 78printval.mode = 'G' 79 80def unique(list): 81 set = {} 82 map(set.__setitem__, list, []) 83 return set.keys() 84 85#benchmarks = [ 'm', 's', 'snt', 'nb1', 'w1', 'w2', 'w3', 'w4', 'nm', 'ns', 'nw1', 'nw2', 'nw3' ] 86 87def graphdata(runs, options, tag, label, value): 88 import info 89 90 bench_system = { 91 'm' : 'client', 92 's' : 'client', 93 'snt' : 'client', 94 'nb1' : 'server', 95 'nb2' : 'server', 96 'nt1' : 'server', 97 'nt2' : 'server', 98 'w1' : 'server', 99 'w2' : 'server', 100 'w3' : 'server', 101 'w4' : 'server', 102 'w1s' : 'server', 103 'w2s' : 'server', 104 'w3s' : 'server', 105 'ns' : 'natbox', 106 'nm' : 'natbox', 107 'nw1' : 'natbox', 108 'nw2' : 'natbox', 109 'nw3' : 'natbox' 110 } 111 112 system_configs = { 113 's1' : 'Uni 4GHz', 114 'm1' : 'Uni 6GHz', 115 'f1' : 'Uni 8GHz', 116 'q1' : 'Uni 10GHz', 117 's2' : 'Dual 4GHz', 118 'm2' : 'Dual 6GHz', 119 's4' : 'Quad 4GHz', 120 'm4' : 'Quad 6GHz' } 121 122 configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ] 123 benchmarks = [ 'm', 'snt', 'w2', 'nm', 'nw2' ] 124 caches = [ '0', '2', '4' ] 125 126 names = [] 127 for bench in benchmarks: 128 if bench_system[bench] != options.system: 129 continue 130 131 for cache in caches: 132 names.append([bench, cache]) 133 134 for bench,cache in names: 135 base = '%s.%s' % (bench, cache) 136 fname = 'data/uni.%s.%s.dat' % (tag, base) 137 f = open(fname, 'w') 138 print >>f, '#set TITLE = ' 139 print >>f, '#set ylbl = %s' % label 140 #print >>f, '#set sublabels = %s' % ' '.join(configs) 141 print >>f, '#set sublabels = ste hte htd ocm occ ocs' 142 143 for speed in ('s1', 'm1', 'f1', 'q1'): 144 label = system_configs[speed] 145 print >>f, '"%s"' % label, 146 for conf in configs: 147 name = '%s.%s.%s.%s' % (conf, bench, cache, speed) 148 run = info.source.allRunNames[name] 149 info.display_run = run.run; 150 val = float(value) 151 if val == 1e300*1e300: 152 print >>f, 0.0, 153 else: 154 print >>f, "%f" % val, 155 print >>f 156 f.close() 157 158 configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ] 159 benchmarks = [ 'w2'] 160 caches = [ '0', '2', '4' ] 161 162 names = [] 163 for bench in benchmarks: 164 if bench_system[bench] != options.system: 165 continue 166 167 for cache in caches: 168 names.append([bench, cache]) 169 170 for bench,cache in names: 171 base = '%s.%s' % (bench, cache) 172 fname = 'data/mp.%s.%s.dat' % (tag, base) 173 f = open(fname, 'w') 174 print >>f, '#set TITLE = ' 175 print >>f, '#set ylbl = %s' % label 176 #print >>f, '#set sublabels = %s' % ' '.join(configs) 177 print >>f, '#set sublabels = ste hte htd ocm occ ocs' 178 179 for speed in ('s2', 'm2', 's4', 'm4'): 180 label = system_configs[speed] 181 print >>f, '"%s"' % label, 182 for conf in configs: 183 name = '%s.%s.%s.%s' % (conf, bench, cache, speed) 184 run = info.source.allRunNames[name] 185 info.display_run = run.run; 186 val = float(value) 187 if val == 1e300*1e300: 188 print >>f, 0.0, 189 else: 190 print >>f, "%f" % val, 191 print >>f 192 f.close() 193 194def printdata(runs, value, invert = False): 195 import info 196 for run in runs: 197 info.display_run = run.run; 198 val = float(value) 199 printval(run.name, val) 200 | |
201class CommandException(Exception): 202 pass 203 204def commands(options, command, args): 205 if command == 'database': 206 if len(args) == 0: raise CommandException 207 208 import dbinit --- 29 unchanged lines hidden (view full) --- 238 239 import db, info 240 info.source = db.Database() 241 info.source.host = options.host 242 info.source.db = options.db 243 info.source.passwd = options.passwd 244 info.source.user = options.user 245 info.source.connect() | 63class CommandException(Exception): 64 pass 65 66def commands(options, command, args): 67 if command == 'database': 68 if len(args) == 0: raise CommandException 69 70 import dbinit --- 29 unchanged lines hidden (view full) --- 100 101 import db, info 102 info.source = db.Database() 103 info.source.host = options.host 104 info.source.db = options.db 105 info.source.passwd = options.passwd 106 info.source.user = options.user 107 info.source.connect() |
246 info.source.update_dict(globals()) | 108 #info.source.update_dict(globals()) |
247 248 if type(options.get) is str: 249 info.source.get = options.get 250 251 if options.runs is None: 252 runs = info.source.allRuns 253 else: 254 rx = re.compile(options.runs) --- 10 unchanged lines hidden (view full) --- 265 if len(args): 266 raise CommandException 267 for o,a in opts: 268 if o == '-u': 269 user = a 270 info.source.listRuns(user) 271 return 272 | 109 110 if type(options.get) is str: 111 info.source.get = options.get 112 113 if options.runs is None: 114 runs = info.source.allRuns 115 else: 116 rx = re.compile(options.runs) --- 10 unchanged lines hidden (view full) --- 127 if len(args): 128 raise CommandException 129 for o,a in opts: 130 if o == '-u': 131 user = a 132 info.source.listRuns(user) 133 return 134 |
135 if command == 'stats': 136 if len(args) == 0: 137 info.source.listStats() 138 elif len(args) == 1: 139 info.source.listStats(args[0]) 140 else: 141 raise CommandException 142 143 return 144 145 if command == 'bins': 146 if len(args) == 0: 147 info.source.listBins() 148 elif len(args) == 1: 149 info.source.listBins(args[0]) 150 else: 151 raise CommandException 152 153 return 154 155 if command == 'formulas': 156 if len(args) == 0: 157 info.source.listFormulas() 158 elif len(args) == 1: 159 info.source.listFormulas(args[0]) 160 else: 161 raise CommandException 162 163 return 164 165 if command == 'samples': 166 if len(args): 167 raise CommandException 168 169 info.source.listTicks(runs) 170 return 171 |
|
273 if command == 'stability': 274 if len(args) < 2: 275 raise CommandException 276 277 try: 278 merge = int(args[0]) 279 except ValueError: 280 usage() 281 stats = info.source.getStat(args[1]) 282 info.source.get = "sum" 283 | 172 if command == 'stability': 173 if len(args) < 2: 174 raise CommandException 175 176 try: 177 merge = int(args[0]) 178 except ValueError: 179 usage() 180 stats = info.source.getStat(args[1]) 181 info.source.get = "sum" 182 |
183 def disp(*args): 184 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % args |
|
284 | 185 |
186 # temporary variable containing a bunch of dashes 187 d = '-' * 100 188 |
|
285 #loop through all the stats selected 286 for stat in stats: | 189 #loop through all the stats selected 190 for stat in stats: |
287 | |
288 print "%s:" % stat.name | 191 print "%s:" % stat.name |
289 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ 290 ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV") 291 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ 292 ("--------------------", "------------", 293 "------------", "----", "-----", "-----", "-----", "----------") | 192 disp("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", 193 "SAMP", "CV") 194 disp(d[:20], d[:12], d[:12], d[:4], d[:5], d[:5], d[:5], d[:10]) 195 |
294 #loop through all the selected runs 295 for run in runs: 296 info.display_run = run.run; 297 runTicks = info.source.retTicks([ run ]) 298 #throw away the first one, it's 0 299 runTicks.pop(0) 300 info.globalTicks = runTicks 301 avg = 0 --- 24 unchanged lines hidden (view full) --- 326 val = float(stat) 327 if (val < (avg * .9)) or (val > (avg * 1.1)): 328 numoutsideavg += 1 329 if (val < (avg - stdev)) or (val > (avg + stdev)): 330 numoutside1std += 1 331 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))): 332 numoutside2std += 1 333 if avg > 1000: | 196 #loop through all the selected runs 197 for run in runs: 198 info.display_run = run.run; 199 runTicks = info.source.retTicks([ run ]) 200 #throw away the first one, it's 0 201 runTicks.pop(0) 202 info.globalTicks = runTicks 203 avg = 0 --- 24 unchanged lines hidden (view full) --- 228 val = float(stat) 229 if (val < (avg * .9)) or (val > (avg * 1.1)): 230 numoutsideavg += 1 231 if (val < (avg - stdev)) or (val > (avg + stdev)): 232 numoutside1std += 1 233 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))): 234 numoutside2std += 1 235 if avg > 1000: |
334 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ 335 (run.name, "%.1f" % avg, "%.1f" % stdev, 336 "%d" % numoutsideavg, "%d" % numoutside1std, 337 "%d" % numoutside2std, "%d" % len(pairRunTicks), 338 "%.3f" % (stdev/avg*100)) | 236 disp(run.name, "%.1f" % avg, "%.1f" % stdev, 237 "%d" % numoutsideavg, "%d" % numoutside1std, 238 "%d" % numoutside2std, "%d" % len(pairRunTicks), 239 "%.3f" % (stdev/avg*100)) |
339 elif avg > 100: | 240 elif avg > 100: |
340 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ 341 (run.name, "%.1f" % avg, "%.1f" % stdev, 342 "%d" % numoutsideavg, "%d" % numoutside1std, 343 "%d" % numoutside2std, "%d" % len(pairRunTicks), 344 "%.5f" % (stdev/avg*100)) | 241 disp(run.name, "%.1f" % avg, "%.1f" % stdev, 242 "%d" % numoutsideavg, "%d" % numoutside1std, 243 "%d" % numoutside2std, "%d" % len(pairRunTicks), 244 "%.5f" % (stdev/avg*100)) |
345 else: | 245 else: |
346 print "%-20s %12s %12s %4s %5s %5s %5s %10s" % \ 347 (run.name, "%.5f" % avg, "%.5f" % stdev, 348 "%d" % numoutsideavg, "%d" % numoutside1std, 349 "%d" % numoutside2std, "%d" % len(pairRunTicks), 350 "%.7f" % (stdev/avg*100)) | 246 disp(run.name, "%.5f" % avg, "%.5f" % stdev, 247 "%d" % numoutsideavg, "%d" % numoutside1std, 248 "%d" % numoutside2std, "%d" % len(pairRunTicks), 249 "%.7f" % (stdev/avg*100)) |
351 return 352 | 250 return 251 |
353 if command == 'stats': 354 if len(args) == 0: 355 info.source.listStats() 356 elif len(args) == 1: 357 info.source.listStats(args[0]) 358 else: | 252 if command == 'all': 253 if len(args): |
359 raise CommandException 360 | 254 raise CommandException 255 |
361 return | 256 all = [ 'bps', 'rxbps', 'txbps', 'bpt', 257 'misses', 'mpkb', 258 'ipkb', 259 'pps', 'bpp', 'txbpp', 'rxbpp', 260 'rtp', 'rtb' ] 261 for command in all: 262 commands(options, command, args) |
362 | 263 |
363 if command == 'stat': 364 if len(args) != 1: 365 raise CommandException | 264 if options.ticks: 265 if not options.graph: 266 print 'only displaying sample %s' % options.ticks 267 info.globalTicks = [ int(x) for x in options.ticks.split() ] |
366 | 268 |
367 stats = info.source.getStat(args[0]) 368 for stat in stats: 369 if options.graph: 370 graphdata(runs, options, stat.name, stat.name, stat) 371 else: 372 if options.ticks: 373 print 'only displaying sample %s' % options.ticks 374 info.globalTicks = [ int(x) for x in options.ticks.split() ] | 269 from output import StatOutput |
375 | 270 |
376 if options.binned: 377 print 'kernel ticks' 378 stat.bins = 'kernel' 379 printdata(runs, stat) | 271 def display(): 272 if options.graph: 273 output.graph(options.graphdir) 274 else: 275 output.display(options.binned, options.printmode) |
380 | 276 |
381 print 'idle ticks' 382 stat.bins = 'idle' 383 printdata(runs, stat) | |
384 | 277 |
385 print 'user ticks' 386 stat.bins = 'user' 387 printdata(runs, stat) 388 389 print 'interrupt ticks' 390 stat.bins = 'interrupt' 391 printdata(runs, stat) 392 393 print 'total ticks' 394 395 stat.bins = None 396 print stat.name 397 printdata(runs, stat) 398 return 399 400 if command == 'formula': | 278 if command == 'stat' or command == 'formula': |
401 if len(args) != 1: 402 raise CommandException 403 | 279 if len(args) != 1: 280 raise CommandException 281 |
404 stats = eval(args[0]) | 282 if command == 'stat': 283 stats = info.source.getStat(args[0]) 284 if command == 'formula': 285 stats = eval(args[0]) 286 |
405 for stat in stats: | 287 for stat in stats: |
406 if options.graph: 407 graphdata(runs, options, stat.name, stat.name, stat) 408 else: 409 if options.binned: 410 print 'kernel ticks' 411 stat.bins = 'kernel' 412 printdata(runs, stat) | 288 output = StatOutput(stat.name, options.jobfile) 289 output.stat = stat 290 output.label = stat.name 291 display() |
413 | 292 |
414 print 'idle ticks' 415 stat.bins = 'idle' 416 printdata(runs, stat) 417 418 print 'user ticks' 419 stat.bins = 'user' 420 printdata(runs, stat) 421 422 print 'interrupt ticks' 423 stat.bins = 'interrupt' 424 printdata(runs, stat) 425 426 print 'total ticks' 427 428 stat.bins = None 429 print args[0] 430 printdata(runs, stat) | |
431 return 432 | 293 return 294 |
433 if command == 'bins': 434 if len(args) == 0: 435 info.source.listBins() 436 elif len(args) == 1: 437 info.source.listBins(args[0]) 438 else: 439 raise CommandException 440 441 return 442 443 if command == 'formulas': 444 if len(args) == 0: 445 info.source.listFormulas() 446 elif len(args) == 1: 447 info.source.listFormulas(args[0]) 448 else: 449 raise CommandException 450 451 return 452 453 if command == 'samples': 454 if len(args): 455 raise CommandException 456 457 info.source.listTicks(runs) 458 return 459 | |
460 if len(args): 461 raise CommandException 462 463 system = info.source.__dict__[options.system] 464 | 295 if len(args): 296 raise CommandException 297 298 system = info.source.__dict__[options.system] 299 |
300 from proxy import ProxyGroup 301 sim_ticks = info.source['sim_ticks'] 302 sim_seconds = info.source['sim_seconds'] 303 proxy = ProxyGroup(system = info.source[options.system]) 304 system = proxy.system 305 306 etherdev = system.tsunami.etherdev0 307 bytes = etherdev.rxBytes + etherdev.txBytes 308 kbytes = bytes / 1024 309 packets = etherdev.rxPackets + etherdev.txPackets 310 bps = etherdev.rxBandwidth + etherdev.txBandwidth 311 312 output = StatOutput(command, options.jobfile) 313 |
|
465 if command == 'usertime': 466 import copy | 314 if command == 'usertime': 315 import copy |
467 kernel = copy.copy(system.full0.numCycles) 468 kernel.bins = 'kernel' 469 | |
470 user = copy.copy(system.full0.numCycles) 471 user.bins = 'user' 472 | 316 user = copy.copy(system.full0.numCycles) 317 user.bins = 'user' 318 |
473 if options.graph: 474 graphdata(runs, options, 'usertime', 'User Fraction', 475 user / system.full0.numCycles) 476 else: 477 printdata(runs, user / system.full0.numCycles) | 319 output.stat = user / system.full0.numCycles 320 output.label = 'User Fraction' 321 322 display() |
478 return 479 480 if command == 'ticks': | 323 return 324 325 if command == 'ticks': |
481 if options.binned: 482 print 'kernel ticks' 483 system.full0.numCycles.bins = 'kernel' 484 printdata(runs, system.full0.numCycles) | 326 output.stat = system.full0.numCycles 327 output.binstats = [ system.full0.numCycles ] |
485 | 328 |
486 print 'idle ticks' 487 system.full0.numCycles.bins = 'idle' 488 printdata(runs, system.full0.numCycles) | 329 display() 330 return |
489 | 331 |
490 print 'user ticks' 491 system.full0.numCycles.bins = 'user' 492 printdata(runs, system.full0.numCycles) 493 494 print 'total ticks' 495 496 system.full0.numCycles.bins = None 497 printdata(runs, system.full0.numCycles) | 332 if command == 'bytes': 333 output.stat = bytes 334 display() |
498 return 499 500 if command == 'packets': | 335 return 336 337 if command == 'packets': |
501 packets = system.tsunami.etherdev0.rxPackets 502 if options.graph: 503 graphdata(runs, options, 'packets', 'Packets', packets) 504 else: 505 printdata(runs, packets) | 338 output.stat = packets 339 display() |
506 return 507 508 if command == 'ppt' or command == 'tpp': | 340 return 341 342 if command == 'ppt' or command == 'tpp': |
509 ppt = system.tsunami.etherdev0.rxPackets / sim_ticks 510 printdata(runs, ppt, command == 'tpp') | 343 output.stat = packets / sim_ticks 344 output.invert = command == 'tpp' 345 display() |
511 return 512 513 if command == 'pps': | 346 return 347 348 if command == 'pps': |
514 pps = system.tsunami.etherdev0.rxPackets / sim_seconds 515 if options.graph: 516 graphdata(runs, options, 'pps', 'Packets/s', pps) 517 else: 518 printdata(runs, pps) | 349 output.stat = packets / sim_seconds 350 output.label = 'Packets/s' 351 display() |
519 return 520 521 if command == 'bpt' or command == 'tpb': | 352 return 353 354 if command == 'bpt' or command == 'tpb': |
522 bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes 523 bpt = bytes / sim_ticks * 8 524 if options.graph: 525 graphdata(runs, options, 'bpt', 'bps / Hz', bpt) 526 else: 527 printdata(runs, bpt, command == 'tpb') | 355 output.stat = bytes / sim_ticks * 8 356 output.label = 'bps / Hz' 357 output.invert = command == 'tpb' 358 display() |
528 return 529 | 359 return 360 |
530 if command == 'bptb' or command == 'tpbb': 531 bytes = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes 532 533 print 'kernel stats' 534 bytes.bins = 'kernel' 535 printdata(runs, bytes / ticks) 536 537 print 'idle stats' 538 bytes.bins = 'idle' 539 printdata(runs, bytes / ticks) 540 541 print 'user stats' 542 bytes.bins = 'user' 543 printdata(runs, bytes / ticks) 544 545 return 546 547 if command == 'bytes': 548 stat = system.tsunami.etherdev0.rxBytes + system.tsunami.etherdev0.txBytes 549 550 if options.binned: 551 print '%s kernel stats' % stat.name 552 stat.bins = 'kernel' 553 printdata(runs, stat) 554 555 print '%s idle stats' % stat.name 556 stat.bins = 'idle' 557 printdata(runs, stat) 558 559 print '%s user stats' % stat.name 560 stat.bins = 'user' 561 printdata(runs, stat) 562 563 print '%s total stats' % stat.name 564 stat.bins = None 565 566 printdata(runs, stat) 567 return 568 | |
569 if command == 'rxbps': | 361 if command == 'rxbps': |
570 gbps = system.tsunami.etherdev0.rxBandwidth / 1e9 571 if options.graph: 572 graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps) 573 else: 574 printdata(runs, gbps) | 362 output.stat = etherdev.rxBandwidth / 1e9 363 output.label = 'Bandwidth (Gbps)' 364 display() |
575 return 576 577 if command == 'txbps': | 365 return 366 367 if command == 'txbps': |
578 gbps = system.tsunami.etherdev0.txBandwidth / 1e9 579 if options.graph: 580 graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps) 581 else: 582 printdata(runs, gbps) | 368 output.stat = etherdev.txBandwidth / 1e9 369 output.label = 'Bandwidth (Gbps)' 370 display() |
583 return 584 585 if command == 'bps': | 371 return 372 373 if command == 'bps': |
586 rxbps = system.tsunami.etherdev0.rxBandwidth 587 txbps = system.tsunami.etherdev0.txBandwidth 588 gbps = (rxbps + txbps) / 1e9 589 if options.graph: 590 graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps) 591 else: 592 printdata(runs, gbps) | 374 output.stat = bps / 1e9 375 output.label = 'Bandwidth (Gbps)' 376 display() |
593 return 594 | 377 return 378 |
595 if command == 'misses': 596 stat = system.l2.overall_mshr_misses 597 if options.binned: 598 print '%s kernel stats' % stat.name 599 stat.bins = 'kernel' 600 printdata(runs, stat) | 379 if command == 'bpp': 380 output.stat = bytes / packets 381 output.label = 'Bytes / Packet' 382 display() 383 return |
601 | 384 |
602 print '%s idle stats' % stat.name 603 stat.bins = 'idle' 604 printdata(runs, stat) | 385 if command == 'rxbpp': 386 output.stat = etherdev.rxBytes / etherdev.rxPackets 387 output.label = 'Receive Bytes / Packet' 388 display() 389 return |
605 | 390 |
606 print '%s user stats' % stat.name 607 stat.bins = 'user' 608 printdata(runs, stat) | 391 if command == 'txbpp': 392 output.stat = etherdev.txBytes / etherdev.txPackets 393 output.label = 'Transmit Bytes / Packet' 394 display() 395 return |
609 | 396 |
610 print '%s total stats' % stat.name | 397 if command == 'rtp': 398 output.stat = etherdev.rxPackets / etherdev.txPackets 399 output.label = 'rxPackets / txPackets' 400 display() 401 return |
611 | 402 |
612 stat.bins = None 613 if options.graph: 614 graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat) 615 else: 616 printdata(runs, stat) | 403 if command == 'rtb': 404 output.stat = etherdev.rxBytes / etherdev.txBytes 405 output.label = 'rxBytes / txBytes' 406 display() |
617 return 618 | 407 return 408 |
619 if command == 'mpkb': 620 misses = system.l2.overall_mshr_misses 621 rxbytes = system.tsunami.etherdev0.rxBytes 622 txbytes = system.tsunami.etherdev0.txBytes | 409 misses = system.l2.overall_mshr_misses |
623 | 410 |
624 if options.binned: 625 print 'mpkb kernel stats' 626 misses.bins = 'kernel' 627 mpkb = misses / ((rxbytes + txbytes) / 1024) 628 printdata(runs, mpkb) | 411 if command == 'misses': 412 output.stat = misses 413 output.label = 'Overall MSHR Misses' 414 display() 415 return |
629 | 416 |
630 print 'mpkb idle stats' 631 misses.bins = 'idle' 632 mpkb = misses / ((rxbytes + txbytes) / 1024) 633 printdata(runs, mpkb) 634 635 print 'mpkb user stats' 636 misses.bins = 'user' 637 mpkb = misses / ((rxbytes + txbytes) / 1024) 638 printdata(runs, mpkb) 639 640 print 'mpkb total stats' 641 642 mpkb = misses / ((rxbytes + txbytes) / 1024) 643 misses.bins = None 644 if options.graph: 645 graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb) 646 else: 647 printdata(runs, mpkb) | 417 if command == 'mpkb': 418 output.stat = misses / (bytes / 1024) 419 output.binstats = [ misses ] 420 output.label = 'Misses / KB' 421 display() |
648 return 649 650 if command == 'ipkb': 651 interrupts = system.full0.kern.faults[4] | 422 return 423 424 if command == 'ipkb': 425 interrupts = system.full0.kern.faults[4] |
652 rxbytes = system.tsunami.etherdev0.rxBytes 653 txbytes = system.tsunami.etherdev0.txBytes 654 655 if options.binned: 656 print 'ipkb kernel stats' 657 interrupts.bins = 'kernel' 658 ipkb = interrupts / ((rxbytes + txbytes) / 1024) 659 printdata(runs, ipkb) 660 661 print 'ipkb idle stats' 662 interrupts.bins = 'idle' 663 ipkb = interrupts / ((rxbytes + txbytes) / 1024) 664 printdata(runs, ipkb) 665 666 print 'ipkb user stats' 667 interrupts.bins = 'user' 668 ipkb = interrupts / ((rxbytes + txbytes) / 1024) 669 printdata(runs, ipkb) 670 671 print 'ipkb total stats' 672 673 ipkb = interrupts / ((rxbytes + txbytes) / 1024) 674 interrupts.bins = None 675 if options.graph: 676 graphdata(runs, options, 'ipkb', 'Interrupts / KB', ipkb) 677 else: 678 printdata(runs, ipkb) | 426 output.stat = interrupts / kbytes 427 output.binstats = [ interrupts ] 428 output.label = 'Interrupts / KB' 429 display() |
679 return 680 681 if command == 'execute': | 430 return 431 432 if command == 'execute': |
682 printdata(runs, system.full0.ISSUE__count) | 433 output.stat = system.full0.ISSUE__count 434 display() |
683 return 684 685 if command == 'commit': | 435 return 436 437 if command == 'commit': |
686 printdata(runs, system.full0.COM__count) | 438 output.stat = system.full0.COM__count 439 display() |
687 return 688 689 if command == 'fetch': | 440 return 441 442 if command == 'fetch': |
690 printdata(runs, system.full0.FETCH__count) | 443 output.stat = system.full0.FETCH__count 444 display() |
691 return 692 | 445 return 446 |
693 if command == 'bpp': 694 ed = system.tsunami.etherdev0 695 bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets) 696 if options.graph: 697 graphdata(runs, options, 'bpp', 'Bytes / Packet', bpp) 698 else: 699 printdata(runs, bpp) 700 return 701 702 if command == 'rxbpp': 703 bpp = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.rxPackets 704 if options.graph: 705 graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp) 706 else: 707 printdata(runs, bpp) 708 return 709 710 if command == 'txbpp': 711 bpp = system.tsunami.etherdev0.txBytes / system.tsunami.etherdev0.txPackets 712 if options.graph: 713 graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp) 714 else: 715 printdata(runs, bpp) 716 return 717 718 if command == 'rtp': 719 rtp = system.tsunami.etherdev0.rxPackets / system.tsunami.etherdev0.txPackets 720 if options.graph: 721 graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp) 722 else: 723 printdata(runs, rtp) 724 return 725 726 if command == 'rtb': 727 rtb = system.tsunami.etherdev0.rxBytes / system.tsunami.etherdev0.txBytes 728 if options.graph: 729 graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb) 730 else: 731 printdata(runs, rtb) 732 return 733 | |
734 raise CommandException 735 736 737class Options: pass 738 739if __name__ == '__main__': 740 import getpass | 447 raise CommandException 448 449 450class Options: pass 451 452if __name__ == '__main__': 453 import getpass |
454 from jobfile import JobFile |
|
741 742 options = Options() | 455 456 options = Options() |
743 options.host = 'zizzer.pool' | 457 options.host = None |
744 options.db = None 745 options.passwd = '' 746 options.user = getpass.getuser() 747 options.runs = None 748 options.system = 'client' 749 options.get = None 750 options.binned = False 751 options.graph = False 752 options.ticks = False | 458 options.db = None 459 options.passwd = '' 460 options.user = getpass.getuser() 461 options.runs = None 462 options.system = 'client' 463 options.get = None 464 options.binned = False 465 options.graph = False 466 options.ticks = False |
467 options.printmode = 'G' 468 options.jobfile = None 469 options.all = False |
|
753 | 470 |
754 opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:T:') | 471 opts, args = getopts(sys.argv[1:], '-BEFG:ad:g:h:j:pr:s:u:T:') |
755 for o,a in opts: 756 if o == '-B': 757 options.binned = True 758 if o == '-E': | 472 for o,a in opts: 473 if o == '-B': 474 options.binned = True 475 if o == '-E': |
759 printval.mode = 'E' | 476 options.printmode = 'E' |
760 if o == '-F': | 477 if o == '-F': |
761 printval.mode = 'F' | 478 options.printmode = 'F' |
762 if o == '-G': | 479 if o == '-G': |
763 options.graph = True; | 480 options.get = a 481 if o == '-a': 482 options.all = True |
764 if o == '-d': 765 options.db = a 766 if o == '-g': | 483 if o == '-d': 484 options.db = a 485 if o == '-g': |
767 options.get = a | 486 options.graph = True; 487 options.graphdir = a |
768 if o == '-h': 769 options.host = a | 488 if o == '-h': 489 options.host = a |
490 if o == '-j': 491 options.jobfile = JobFile(a) |
|
770 if o == '-p': 771 options.passwd = getpass.getpass() 772 if o == '-r': 773 options.runs = a 774 if o == '-u': 775 options.user = a 776 if o == '-s': 777 options.system = a 778 if o == '-T': 779 options.ticks = a 780 | 492 if o == '-p': 493 options.passwd = getpass.getpass() 494 if o == '-r': 495 options.runs = a 496 if o == '-u': 497 options.user = a 498 if o == '-s': 499 options.system = a 500 if o == '-T': 501 options.ticks = a 502 |
503 if options.jobfile: 504 if not options.host: 505 options.host = options.jobfile.dbhost 506 if not options.db: 507 options.db = options.jobfile.statdb 508 509 if not options.host: 510 sys.exit('Database server must be provided from a jobfile or -h') 511 512 if not options.db: 513 sys.exit('Database name must be provided from a jobfile or -d') 514 |
|
781 if len(args) == 0: 782 usage() 783 784 command = args[0] 785 args = args[1:] 786 787 try: 788 commands(options, command, args) 789 except CommandException: 790 usage() | 515 if len(args) == 0: 516 usage() 517 518 command = args[0] 519 args = args[1:] 520 521 try: 522 commands(options, command, args) 523 except CommandException: 524 usage() |