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 |
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) |
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 |
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: |
284 output.display(stat.name, options.binned, options.printmode) |
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: |
304 output.display(command, options.binned, options.printmode) |
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 |
317 if command == 'ticks': 318 output.stat = system.run0.numCycles |
319 output.binstats = [ system.run0.numCycles ] |
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 ] |
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 ] |
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 |
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 |
459 opts, args = getopts(sys.argv[1:], '-BEFJad:g:h:j:m:pr:s:u:T:') |
460 for o,a in opts: |
461 if o == '-B': 462 options.binned = True |
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 --- |