stats.py (1209:7eb1f18fcaa6) stats.py (1269:419b73347a1e)
1#!/usr/bin/env python
2from __future__ import division
3import re, sys
4
5def usage():
6 print '''\
7Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
8 [-s <system>] [-r <runs> ] [-u <username>] <command> [command args]

--- 25 unchanged lines hidden (view full) ---

34
35printval.mode = 'G'
36
37def unique(list):
38 set = {}
39 map(set.__setitem__, list, [])
40 return set.keys()
41
1#!/usr/bin/env python
2from __future__ import division
3import re, sys
4
5def usage():
6 print '''\
7Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
8 [-s <system>] [-r <runs> ] [-u <username>] <command> [command args]

--- 25 unchanged lines hidden (view full) ---

34
35printval.mode = 'G'
36
37def unique(list):
38 set = {}
39 map(set.__setitem__, list, [])
40 return set.keys()
41
42def graphdata(runs, tag, label, value):
42def graphdata(runs, options, tag, label, value):
43 import info
43 import info
44 configs = ['stx', 'ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
45 benchmarks = [ 'm', 's' ]
46 dmas = [ 'x', 'd', 'b' ]
44 configs = ['ste', 'hte', 'htd', 'ocm', 'occ', 'ocp' ]
45 #benchmarks = [ 'm', 's', 'nb1', 'nb2', 'nt1', 'nt2', 'w1', 'w2', 'w3', 'w4', 'ns', 'nm', 'nw1', 'nw2', 'nw3' ]
46 #benchmarks = [ 'm', 's', 'nb1', 'nb2', 'nt1', 'w1', 'w2', 'w3', 'ns', 'nm', 'w1s' ]
47 benchmarks = [ 'm', 's', 'nb1', 'nb2', 'w1', 'w2', 'w3', 'w4', 'ns', 'nm', 'nw1', 'snt' ]
48 #dmas = [ 'x', 'd', 'b' ]
49 dmas = [ 'x' ]
47 caches = [ '2', '4' ]
50 caches = [ '2', '4' ]
48 checkpoints = [ '1' ]
49
50 names = []
51
52 names = []
53
54 bench_system = {
55 'm' : 'client',
56 's' : 'client',
57 'snt' : 'client',
58 'nb1' : 'server',
59 'nb2' : 'server',
60 'nt1' : 'server',
61 'nt2' : 'server',
62 'w1' : 'server',
63 'w2' : 'server',
64 'w3' : 'server',
65 'w4' : 'server',
66 'w1s' : 'server',
67 'w2s' : 'server',
68 'w3s' : 'server',
69 'ns' : 'natbox',
70 'nm' : 'natbox',
71 'nw1' : 'natbox',
72 'nw2' : 'natbox',
73 'nw3' : 'natbox'
74 }
75
51 for bench in benchmarks:
76 for bench in benchmarks:
77 if bench_system[bench] != options.system:
78 continue
79
52 for dma in dmas:
53 for cache in caches:
80 for dma in dmas:
81 for cache in caches:
54 for cpt in checkpoints:
55 names.append([bench, dma, cache, cpt])
82 names.append([bench, dma, cache])
56
83
57 for bench,dma,cache,cpt in names:
58 base = '%s.%s.%s.%s' % (bench, dma, cache, cpt)
84 for bench,dma,cache in names:
85 base = '%s.%s.%s' % (bench, dma, cache)
59 fname = 'data/%s.%s.dat' % (tag, base)
60 f = open(fname, 'w')
61 print >>f, '#set TITLE = %s' % base
62 print >>f, '#set xlbl = Configuration'
63 print >>f, '#set ylbl = %s' % label
64 print >>f, '#set sublabels = %s' % ' '.join(configs)
65
66 for speed,freq in zip(['s', 'q'],['4GHz','10GHz']):
67 print >>f, '"%s"' % freq,
68 for conf in configs:
86 fname = 'data/%s.%s.dat' % (tag, base)
87 f = open(fname, 'w')
88 print >>f, '#set TITLE = %s' % base
89 print >>f, '#set xlbl = Configuration'
90 print >>f, '#set ylbl = %s' % label
91 print >>f, '#set sublabels = %s' % ' '.join(configs)
92
93 for speed,freq in zip(['s', 'q'],['4GHz','10GHz']):
94 print >>f, '"%s"' % freq,
95 for conf in configs:
69 name = '%s.%s.%s.%s.%s.%s' % (conf, bench, dma, speed, cache,
70 cpt)
96 name = '%s.%s.%s.%s.%s' % (conf, bench, dma, cache, speed)
71 run = info.source.allRunNames[name]
72 info.display_run = run.run;
73 val = float(value)
74 if val == 1e300*1e300:
75 print >>f, 0.0,
76 else:
77 print >>f, "%f" % val,
78 print >>f

--- 90 unchanged lines hidden (view full) ---

169
170 if command == 'stat':
171 if len(args) != 1:
172 raise CommandException
173
174 stats = info.source.getStat(args[0])
175 for stat in stats:
176 if options.graph:
97 run = info.source.allRunNames[name]
98 info.display_run = run.run;
99 val = float(value)
100 if val == 1e300*1e300:
101 print >>f, 0.0,
102 else:
103 print >>f, "%f" % val,
104 print >>f

--- 90 unchanged lines hidden (view full) ---

195
196 if command == 'stat':
197 if len(args) != 1:
198 raise CommandException
199
200 stats = info.source.getStat(args[0])
201 for stat in stats:
202 if options.graph:
177 graphdata(runs, stat.name, stat.name, stat)
203 graphdata(runs, options, stat.name, stat.name, stat)
178 else:
179 if options.binned:
180 print 'kernel ticks'
181 stat.bins = 'kernel'
182 printdata(runs, stat)
183
184 print 'idle ticks'
185 stat.bins = 'idle'

--- 9 unchanged lines hidden (view full) ---

195
196 print 'total ticks'
197
198 stat.bins = None
199 print stat.name
200 printdata(runs, stat)
201 return
202
204 else:
205 if options.binned:
206 print 'kernel ticks'
207 stat.bins = 'kernel'
208 printdata(runs, stat)
209
210 print 'idle ticks'
211 stat.bins = 'idle'

--- 9 unchanged lines hidden (view full) ---

221
222 print 'total ticks'
223
224 stat.bins = None
225 print stat.name
226 printdata(runs, stat)
227 return
228
229 if command == 'formula':
230 if len(args) != 1:
231 raise CommandException
232
233 stats = eval(args[0])
234 for stat in stats:
235 if options.graph:
236 graphdata(runs, options, stat.name, stat.name, stat)
237 else:
238 if options.binned:
239 print 'kernel ticks'
240 stat.bins = 'kernel'
241 printdata(runs, stat)
242
243 print 'idle ticks'
244 stat.bins = 'idle'
245 printdata(runs, stat)
246
247 print 'user ticks'
248 stat.bins = 'user'
249 printdata(runs, stat)
250
251 print 'interrupt ticks'
252 stat.bins = 'user'
253 printdata(runs, stat)
254
255 print 'total ticks'
256
257 stat.bins = None
258 print args[0]
259 printdata(runs, stat)
260 return
261
203 if command == 'bins':
204 if len(args) == 0:
205 info.source.listBins()
206 elif len(args) == 1:
207 info.source.listBins(args[0])
208 else:
209 raise CommandException
210

--- 25 unchanged lines hidden (view full) ---

236 import copy
237 kernel = copy.copy(system.full_cpu.numCycles)
238 kernel.bins = 'kernel'
239
240 user = copy.copy(system.full_cpu.numCycles)
241 user.bins = 'user'
242
243 if options.graph:
262 if command == 'bins':
263 if len(args) == 0:
264 info.source.listBins()
265 elif len(args) == 1:
266 info.source.listBins(args[0])
267 else:
268 raise CommandException
269

--- 25 unchanged lines hidden (view full) ---

295 import copy
296 kernel = copy.copy(system.full_cpu.numCycles)
297 kernel.bins = 'kernel'
298
299 user = copy.copy(system.full_cpu.numCycles)
300 user.bins = 'user'
301
302 if options.graph:
244 graphdata(runs, 'usertime', 'User Fraction',
303 graphdata(runs, options, 'usertime', 'User Fraction',
245 user / system.full_cpu.numCycles)
246 else:
247 printdata(runs, user / system.full_cpu.numCycles)
248 return
249
250 if command == 'ticks':
251 if options.binned:
252 print 'kernel ticks'

--- 12 unchanged lines hidden (view full) ---

265
266 system.full_cpu.numCycles.bins = None
267 printdata(runs, system.full_cpu.numCycles)
268 return
269
270 if command == 'packets':
271 packets = system.tsunami.etherdev.rxPackets
272 if options.graph:
304 user / system.full_cpu.numCycles)
305 else:
306 printdata(runs, user / system.full_cpu.numCycles)
307 return
308
309 if command == 'ticks':
310 if options.binned:
311 print 'kernel ticks'

--- 12 unchanged lines hidden (view full) ---

324
325 system.full_cpu.numCycles.bins = None
326 printdata(runs, system.full_cpu.numCycles)
327 return
328
329 if command == 'packets':
330 packets = system.tsunami.etherdev.rxPackets
331 if options.graph:
273 graphdata(runs, 'packets', 'Packets', packets)
332 graphdata(runs, options, 'packets', 'Packets', packets)
274 else:
275 printdata(runs, packets)
276 return
277
278 if command == 'ppt' or command == 'tpp':
279 ppt = system.tsunami.etherdev.rxPackets / sim_ticks
280 printdata(runs, ppt, command == 'tpp')
281 return
282
283 if command == 'pps':
284 pps = system.tsunami.etherdev.rxPackets / sim_seconds
285 if options.graph:
333 else:
334 printdata(runs, packets)
335 return
336
337 if command == 'ppt' or command == 'tpp':
338 ppt = system.tsunami.etherdev.rxPackets / sim_ticks
339 printdata(runs, ppt, command == 'tpp')
340 return
341
342 if command == 'pps':
343 pps = system.tsunami.etherdev.rxPackets / sim_seconds
344 if options.graph:
286 graphdata(runs, 'pps', 'Packets/s', pps)
345 graphdata(runs, options, 'pps', 'Packets/s', pps)
287 else:
288 printdata(runs, pps)
289 return
290
291 if command == 'bpt' or command == 'tpb':
292 bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes
293 bpt = bytes / sim_ticks * 8
294 if options.graph:
346 else:
347 printdata(runs, pps)
348 return
349
350 if command == 'bpt' or command == 'tpb':
351 bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes
352 bpt = bytes / sim_ticks * 8
353 if options.graph:
295 graphdata(runs, 'bpt', 'bps / Hz', bpt)
354 graphdata(runs, options, 'bpt', 'bps / Hz', bpt)
296 else:
297 printdata(runs, bpt, command == 'tpb')
298 return
299
300 if command == 'bptb' or command == 'tpbb':
301 bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes
302
303 print 'kernel stats'

--- 30 unchanged lines hidden (view full) ---

334 stat.bins = None
335
336 printdata(runs, stat)
337 return
338
339 if command == 'rxbps':
340 gbps = system.tsunami.etherdev.rxBandwidth / 1e9
341 if options.graph:
355 else:
356 printdata(runs, bpt, command == 'tpb')
357 return
358
359 if command == 'bptb' or command == 'tpbb':
360 bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes
361
362 print 'kernel stats'

--- 30 unchanged lines hidden (view full) ---

393 stat.bins = None
394
395 printdata(runs, stat)
396 return
397
398 if command == 'rxbps':
399 gbps = system.tsunami.etherdev.rxBandwidth / 1e9
400 if options.graph:
342 graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps)
401 graphdata(runs, options, 'rxbps', 'Bandwidth (Gbps)', gbps)
343 else:
344 printdata(runs, gbps)
345 return
346
347 if command == 'txbps':
348 gbps = system.tsunami.etherdev.txBandwidth / 1e9
349 if options.graph:
402 else:
403 printdata(runs, gbps)
404 return
405
406 if command == 'txbps':
407 gbps = system.tsunami.etherdev.txBandwidth / 1e9
408 if options.graph:
350 graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps)
409 graphdata(runs, options, 'txbps', 'Bandwidth (Gbps)', gbps)
351 else:
352 printdata(runs, gbps)
353 return
354
355 if command == 'bps':
356 rxbps = system.tsunami.etherdev.rxBandwidth
357 txbps = system.tsunami.etherdev.txBandwidth
358 gbps = (rxbps + txbps) / 1e9
359 if options.graph:
410 else:
411 printdata(runs, gbps)
412 return
413
414 if command == 'bps':
415 rxbps = system.tsunami.etherdev.rxBandwidth
416 txbps = system.tsunami.etherdev.txBandwidth
417 gbps = (rxbps + txbps) / 1e9
418 if options.graph:
360 graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps)
419 graphdata(runs, options, 'bps', 'Bandwidth (Gbps)', gbps)
361 else:
362 printdata(runs, gbps)
363 return
364
365 if command == 'misses':
366 stat = system.L2.overall_mshr_misses
367 if options.binned:
368 print '%s kernel stats' % stat.name

--- 7 unchanged lines hidden (view full) ---

376 print '%s user stats' % stat.name
377 stat.bins = 'user'
378 printdata(runs, stat)
379
380 print '%s total stats' % stat.name
381
382 stat.bins = None
383 if options.graph:
420 else:
421 printdata(runs, gbps)
422 return
423
424 if command == 'misses':
425 stat = system.L2.overall_mshr_misses
426 if options.binned:
427 print '%s kernel stats' % stat.name

--- 7 unchanged lines hidden (view full) ---

435 print '%s user stats' % stat.name
436 stat.bins = 'user'
437 printdata(runs, stat)
438
439 print '%s total stats' % stat.name
440
441 stat.bins = None
442 if options.graph:
384 graphdata(runs, 'misses', 'Overall MSHR Misses', stat)
443 graphdata(runs, options, 'misses', 'Overall MSHR Misses', stat)
385 else:
386 printdata(runs, stat)
387 return
388
389 if command == 'mpkb':
390 misses = system.L2.overall_mshr_misses
391 rxbytes = system.tsunami.etherdev.rxBytes
392 txbytes = system.tsunami.etherdev.txBytes

--- 14 unchanged lines hidden (view full) ---

407 mpkb = misses / ((rxbytes + txbytes) / 1024)
408 printdata(runs, mpkb)
409
410 print 'mpkb total stats'
411
412 mpkb = misses / ((rxbytes + txbytes) / 1024)
413 misses.bins = None
414 if options.graph:
444 else:
445 printdata(runs, stat)
446 return
447
448 if command == 'mpkb':
449 misses = system.L2.overall_mshr_misses
450 rxbytes = system.tsunami.etherdev.rxBytes
451 txbytes = system.tsunami.etherdev.txBytes

--- 14 unchanged lines hidden (view full) ---

466 mpkb = misses / ((rxbytes + txbytes) / 1024)
467 printdata(runs, mpkb)
468
469 print 'mpkb total stats'
470
471 mpkb = misses / ((rxbytes + txbytes) / 1024)
472 misses.bins = None
473 if options.graph:
415 graphdata(runs, 'mpkb', 'Misses / KB', mpkb)
474 graphdata(runs, options, 'mpkb', 'Misses / KB', mpkb)
416 else:
417 printdata(runs, mpkb)
418 return
419
475 else:
476 printdata(runs, mpkb)
477 return
478
479 if command == 'ipkb':
480 interrupts = system.full_cpu.kern.faults[4]
481 rxbytes = system.tsunami.etherdev.rxBytes
482 txbytes = system.tsunami.etherdev.txBytes
483
484 if options.binned:
485 print 'ipkb kernel stats'
486 interrupts.bins = 'kernel'
487 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
488 printdata(runs, ipkb)
489
490 print 'ipkb idle stats'
491 interrupts.bins = 'idle'
492 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
493 printdata(runs, ipkb)
494
495 print 'ipkb user stats'
496 interrupts.bins = 'user'
497 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
498 printdata(runs, ipkb)
499
500 print 'ipkb total stats'
501
502 ipkb = interrupts / ((rxbytes + txbytes) / 1024)
503 interrupts.bins = None
504 if options.graph:
505 graphdata(runs, options, 'ipkb', 'Interrupts / KB', ipkb)
506 else:
507 printdata(runs, ipkb)
508 return
509
420 if command == 'execute':
421 printdata(runs, system.full_cpu.ISSUE__count)
422 return
423
424 if command == 'commit':
425 printdata(runs, system.full_cpu.COM__count)
426 return
427
428 if command == 'fetch':
429 printdata(runs, system.full_cpu.FETCH__count)
430 return
431
432 if command == 'bpp':
433 ed = system.tsunami.etherdev
434 bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets)
435 if options.graph:
510 if command == 'execute':
511 printdata(runs, system.full_cpu.ISSUE__count)
512 return
513
514 if command == 'commit':
515 printdata(runs, system.full_cpu.COM__count)
516 return
517
518 if command == 'fetch':
519 printdata(runs, system.full_cpu.FETCH__count)
520 return
521
522 if command == 'bpp':
523 ed = system.tsunami.etherdev
524 bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets)
525 if options.graph:
436 graphdata(runs, 'bpp', 'Bytes / Packet', bpp)
526 graphdata(runs, options, 'bpp', 'Bytes / Packet', bpp)
437 else:
438 printdata(runs, bpp)
439 return
440
441 if command == 'rxbpp':
442 bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets
443 if options.graph:
527 else:
528 printdata(runs, bpp)
529 return
530
531 if command == 'rxbpp':
532 bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets
533 if options.graph:
444 graphdata(runs, 'rxbpp', 'Receive Bytes / Packet', bpp)
534 graphdata(runs, options, 'rxbpp', 'Receive Bytes / Packet', bpp)
445 else:
446 printdata(runs, bpp)
447 return
448
449 if command == 'txbpp':
450 bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets
451 if options.graph:
535 else:
536 printdata(runs, bpp)
537 return
538
539 if command == 'txbpp':
540 bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets
541 if options.graph:
452 graphdata(runs, 'txbpp', 'Transmit Bytes / Packet', bpp)
542 graphdata(runs, options, 'txbpp', 'Transmit Bytes / Packet', bpp)
453 else:
454 printdata(runs, bpp)
455 return
456
457 if command == 'rtp':
458 rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets
459 if options.graph:
543 else:
544 printdata(runs, bpp)
545 return
546
547 if command == 'rtp':
548 rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets
549 if options.graph:
460 graphdata(runs, 'rtp', 'rxPackets / txPackets', rtp)
550 graphdata(runs, options, 'rtp', 'rxPackets / txPackets', rtp)
461 else:
462 printdata(runs, rtp)
463 return
464
465 if command == 'rtb':
466 rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes
467 if options.graph:
551 else:
552 printdata(runs, rtp)
553 return
554
555 if command == 'rtb':
556 rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes
557 if options.graph:
468 graphdata(runs, 'rtb', 'rxBytes / txBytes', rtb)
558 graphdata(runs, options, 'rtb', 'rxBytes / txBytes', rtb)
469 else:
470 printdata(runs, rtb)
471 return
472
473 raise CommandException
474
475
476class Options: pass

--- 50 unchanged lines hidden ---
559 else:
560 printdata(runs, rtb)
561 return
562
563 raise CommandException
564
565
566class Options: pass

--- 50 unchanged lines hidden ---