stats.py (2343:a2b4a6ccee56) | stats.py (2665:a124942bacb8) |
---|---|
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 --- 11 unchanged lines hidden (view full) --- 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. | 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 --- 11 unchanged lines hidden (view full) --- 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# Authors: Nathan Binkert |
|
28 29from __future__ import division 30import re, sys, math 31 32def usage(): 33 print '''\ 34Usage: %s [-E] [-F] [ -G <get> ] [-d <db> ] [-g <graphdir> ] [-h <host>] [-p] 35 [-s <system>] [-r <runs> ] [-T <samples>] [-u <username>] 36 <command> [command args] 37 38 commands extra parameters description 39 ----------- ------------------ --------------------------------------- | 30 31from __future__ import division 32import re, sys, math 33 34def usage(): 35 print '''\ 36Usage: %s [-E] [-F] [ -G <get> ] [-d <db> ] [-g <graphdir> ] [-h <host>] [-p] 37 [-s <system>] [-r <runs> ] [-T <samples>] [-u <username>] 38 <command> [command args] 39 40 commands extra parameters description 41 ----------- ------------------ --------------------------------------- |
42 bins [regex] List bins (only matching regex) |
|
40 formula <formula> Evaluated formula specified 41 formulas [regex] List formulas (only matching regex) 42 runs none List all runs in database 43 samples none List samples present in database 44 stability <pairnum> <stats> Calculated statistical info about stats 45 stat <regex> Show stat data (only matching regex) 46 stats [regex] List all stats (only matching regex) 47 --- 86 unchanged lines hidden (view full) --- 134 source.listStats() 135 elif len(args) == 1: 136 source.listStats(args[0]) 137 else: 138 raise CommandException 139 140 return 141 | 43 formula <formula> Evaluated formula specified 44 formulas [regex] List formulas (only matching regex) 45 runs none List all runs in database 46 samples none List samples present in database 47 stability <pairnum> <stats> Calculated statistical info about stats 48 stat <regex> Show stat data (only matching regex) 49 stats [regex] List all stats (only matching regex) 50 --- 86 unchanged lines hidden (view full) --- 137 source.listStats() 138 elif len(args) == 1: 139 source.listStats(args[0]) 140 else: 141 raise CommandException 142 143 return 144 |
145 if command == 'bins': 146 if len(args) == 0: 147 source.listBins() 148 elif len(args) == 1: 149 source.listBins(args[0]) 150 else: 151 raise CommandException 152 153 return 154 |
|
142 if command == 'formulas': 143 if len(args) == 0: 144 source.listFormulas() 145 elif len(args) == 1: 146 source.listFormulas(args[0]) 147 else: 148 raise CommandException 149 --- 113 unchanged lines hidden (view full) --- 263 stats = eval(args[0]) 264 265 for stat in stats: 266 output.stat = stat 267 output.ylabel = stat.name 268 if options.graph: 269 output.graph(stat.name, options.graphdir) 270 else: | 155 if command == 'formulas': 156 if len(args) == 0: 157 source.listFormulas() 158 elif len(args) == 1: 159 source.listFormulas(args[0]) 160 else: 161 raise CommandException 162 --- 113 unchanged lines hidden (view full) --- 276 stats = eval(args[0]) 277 278 for stat in stats: 279 output.stat = stat 280 output.ylabel = stat.name 281 if options.graph: 282 output.graph(stat.name, options.graphdir) 283 else: |
271 output.display(stat.name, options.printmode) | 284 output.display(stat.name, options.binned, options.printmode) |
272 273 return 274 275 if len(args): 276 raise CommandException 277 278 from info import ProxyGroup 279 proxy = ProxyGroup(system = source[options.system]) 280 system = proxy.system 281 282 etherdev = system.tsunami.etherdev0 283 bytes = etherdev.rxBytes + etherdev.txBytes 284 kbytes = bytes / 1024 285 packets = etherdev.rxPackets + etherdev.txPackets 286 287 def display(): 288 if options.graph: 289 output.graph(command, options.graphdir, proxy) 290 else: | 285 286 return 287 288 if len(args): 289 raise CommandException 290 291 from info import ProxyGroup 292 proxy = ProxyGroup(system = source[options.system]) 293 system = proxy.system 294 295 etherdev = system.tsunami.etherdev0 296 bytes = etherdev.rxBytes + etherdev.txBytes 297 kbytes = bytes / 1024 298 packets = etherdev.rxPackets + etherdev.txPackets 299 300 def display(): 301 if options.graph: 302 output.graph(command, options.graphdir, proxy) 303 else: |
291 output.display(command, options.printmode) | 304 output.display(command, options.binned, options.printmode) |
292 | 305 |
306 if command == 'usertime': 307 import copy 308 user = copy.copy(system.run0.numCycles) 309 user.bins = 'user' 310 311 output.stat = user / system.run0.numCycles 312 output.ylabel = 'User Fraction' 313 314 display() 315 return 316 |
|
293 if command == 'ticks': 294 output.stat = system.run0.numCycles | 317 if command == 'ticks': 318 output.stat = system.run0.numCycles |
319 output.binstats = [ system.run0.numCycles ] |
|
295 296 display() 297 return 298 299 if command == 'bytes': 300 output.stat = bytes 301 display() 302 return --- 70 unchanged lines hidden (view full) --- 373 if command == 'misses': 374 output.stat = misses 375 output.ylabel = 'Overall MSHR Misses' 376 display() 377 return 378 379 if command == 'mpkb': 380 output.stat = misses / (bytes / 1024) | 320 321 display() 322 return 323 324 if command == 'bytes': 325 output.stat = bytes 326 display() 327 return --- 70 unchanged lines hidden (view full) --- 398 if command == 'misses': 399 output.stat = misses 400 output.ylabel = 'Overall MSHR Misses' 401 display() 402 return 403 404 if command == 'mpkb': 405 output.stat = misses / (bytes / 1024) |
406 output.binstats = [ misses ] |
|
381 output.ylabel = 'Misses / KB' 382 display() 383 return 384 385 if command == 'ipkb': 386 interrupts = system.run0.kern.faults[4] 387 output.stat = interrupts / kbytes | 407 output.ylabel = 'Misses / KB' 408 display() 409 return 410 411 if command == 'ipkb': 412 interrupts = system.run0.kern.faults[4] 413 output.stat = interrupts / kbytes |
414 output.binstats = [ interrupts ] |
|
388 output.ylabel = 'Interrupts / KB' 389 display() 390 return 391 392 if command == 'execute': 393 output.stat = system.run0.ISSUE__count 394 display() 395 return --- 20 unchanged lines hidden (view full) --- 416 options = Options() 417 options.host = None 418 options.db = None 419 options.passwd = '' 420 options.user = getpass.getuser() 421 options.runs = None 422 options.system = 'client' 423 options.method = None | 415 output.ylabel = 'Interrupts / KB' 416 display() 417 return 418 419 if command == 'execute': 420 output.stat = system.run0.ISSUE__count 421 display() 422 return --- 20 unchanged lines hidden (view full) --- 443 options = Options() 444 options.host = None 445 options.db = None 446 options.passwd = '' 447 options.user = getpass.getuser() 448 options.runs = None 449 options.system = 'client' 450 options.method = None |
451 options.binned = False |
|
424 options.graph = False 425 options.ticks = False 426 options.printmode = 'G' 427 jobfilename = 'Test.py' 428 options.jobfile = None 429 options.all = False 430 | 452 options.graph = False 453 options.ticks = False 454 options.printmode = 'G' 455 jobfilename = 'Test.py' 456 options.jobfile = None 457 options.all = False 458 |
431 opts, args = getopts(sys.argv[1:], '-EFJad:g:h:j:m:pr:s:u:T:') | 459 opts, args = getopts(sys.argv[1:], '-BEFJad:g:h:j:m:pr:s:u:T:') |
432 for o,a in opts: | 460 for o,a in opts: |
461 if o == '-B': 462 options.binned = True |
|
433 if o == '-E': 434 options.printmode = 'E' 435 if o == '-F': 436 options.printmode = 'F' 437 if o == '-a': 438 options.all = True 439 if o == '-d': 440 options.db = a --- 45 unchanged lines hidden --- | 463 if o == '-E': 464 options.printmode = 'E' 465 if o == '-F': 466 options.printmode = 'F' 467 if o == '-a': 468 options.all = True 469 if o == '-d': 470 options.db = a --- 45 unchanged lines hidden --- |