stats.py (1269:419b73347a1e) | stats.py (1301:f85f6fb43474) |
---|---|
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] --- 188 unchanged lines hidden (view full) --- 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: 203 graphdata(runs, options, stat.name, stat.name, stat) 204 else: | 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] --- 188 unchanged lines hidden (view full) --- 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: 203 graphdata(runs, options, stat.name, stat.name, stat) 204 else: |
205 if options.ticks: 206 print 'only displaying sample %s' % options.ticks 207 stat.ticks = options.ticks 208 |
|
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' 212 printdata(runs, stat) 213 214 print 'user ticks' 215 stat.bins = 'user' 216 printdata(runs, stat) 217 218 print 'interrupt ticks' | 209 if options.binned: 210 print 'kernel ticks' 211 stat.bins = 'kernel' 212 printdata(runs, stat) 213 214 print 'idle ticks' 215 stat.bins = 'idle' 216 printdata(runs, stat) 217 218 print 'user ticks' 219 stat.bins = 'user' 220 printdata(runs, stat) 221 222 print 'interrupt ticks' |
219 stat.bins = 'user' | 223 stat.bins = 'interrupt' |
220 printdata(runs, stat) 221 222 print 'total ticks' 223 224 stat.bins = None 225 print stat.name 226 printdata(runs, stat) 227 return --- 16 unchanged lines hidden (view full) --- 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' | 224 printdata(runs, stat) 225 226 print 'total ticks' 227 228 stat.bins = None 229 print stat.name 230 printdata(runs, stat) 231 return --- 16 unchanged lines hidden (view full) --- 248 stat.bins = 'idle' 249 printdata(runs, stat) 250 251 print 'user ticks' 252 stat.bins = 'user' 253 printdata(runs, stat) 254 255 print 'interrupt ticks' |
252 stat.bins = 'user' | 256 stat.bins = 'interrupt' |
253 printdata(runs, stat) 254 255 print 'total ticks' 256 257 stat.bins = None 258 print args[0] 259 printdata(runs, stat) 260 return --- 312 unchanged lines hidden (view full) --- 573 options.db = None 574 options.passwd = '' 575 options.user = getpass.getuser() 576 options.runs = None 577 options.system = 'client' 578 options.get = None 579 options.binned = False 580 options.graph = False | 257 printdata(runs, stat) 258 259 print 'total ticks' 260 261 stat.bins = None 262 print args[0] 263 printdata(runs, stat) 264 return --- 312 unchanged lines hidden (view full) --- 577 options.db = None 578 options.passwd = '' 579 options.user = getpass.getuser() 580 options.runs = None 581 options.system = 'client' 582 options.get = None 583 options.binned = False 584 options.graph = False |
585 options.ticks = False |
|
581 | 586 |
582 opts, args = getopts(sys.argv[1:], '-BEFGd:g:h:pr:s:u:') | 587 opts, args = getopts(sys.argv[1:], '-BEFGd:g:h:pr:s:u:T:') |
583 for o,a in opts: 584 if o == '-B': 585 options.binned = True 586 if o == '-E': 587 printval.mode = 'E' 588 if o == '-F': 589 printval.mode = 'F' 590 if o == '-G': --- 7 unchanged lines hidden (view full) --- 598 if o == '-p': 599 options.passwd = getpass.getpass() 600 if o == '-r': 601 options.runs = a 602 if o == '-u': 603 options.user = a 604 if o == '-s': 605 options.system = a | 588 for o,a in opts: 589 if o == '-B': 590 options.binned = True 591 if o == '-E': 592 printval.mode = 'E' 593 if o == '-F': 594 printval.mode = 'F' 595 if o == '-G': --- 7 unchanged lines hidden (view full) --- 603 if o == '-p': 604 options.passwd = getpass.getpass() 605 if o == '-r': 606 options.runs = a 607 if o == '-u': 608 options.user = a 609 if o == '-s': 610 options.system = a |
611 if o == '-T': 612 options.ticks = a |
|
606 607 if len(args) == 0: 608 usage() 609 610 command = args[0] 611 args = args[1:] 612 613 try: 614 commands(options, command, args) 615 except CommandException: 616 usage() | 613 614 if len(args) == 0: 615 usage() 616 617 command = args[0] 618 args = args[1:] 619 620 try: 621 commands(options, command, args) 622 except CommandException: 623 usage() |