stats.py (1307:e6b9976895c6) stats.py (1308:2078b53d65d9)
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]

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

263 if len(args) != 1:
264 raise CommandException
265
266 stats = info.source.getStat(args[0])
267 for stat in stats:
268 if options.graph:
269 graphdata(runs, options, stat.name, stat.name, stat)
270 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]

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

263 if len(args) != 1:
264 raise CommandException
265
266 stats = info.source.getStat(args[0])
267 for stat in stats:
268 if options.graph:
269 graphdata(runs, options, stat.name, stat.name, stat)
270 else:
271 if options.ticks:
272 print 'only displaying sample %s' % options.ticks
273 stat.ticks = options.ticks
274
271 if options.binned:
272 print 'kernel ticks'
273 stat.bins = 'kernel'
274 printdata(runs, stat)
275
276 print 'idle ticks'
277 stat.bins = 'idle'
278 printdata(runs, stat)
279
280 print 'user ticks'
281 stat.bins = 'user'
282 printdata(runs, stat)
283
284 print 'interrupt ticks'
275 if options.binned:
276 print 'kernel ticks'
277 stat.bins = 'kernel'
278 printdata(runs, stat)
279
280 print 'idle ticks'
281 stat.bins = 'idle'
282 printdata(runs, stat)
283
284 print 'user ticks'
285 stat.bins = 'user'
286 printdata(runs, stat)
287
288 print 'interrupt ticks'
285 stat.bins = 'user'
289 stat.bins = 'interrupt'
286 printdata(runs, stat)
287
288 print 'total ticks'
289
290 stat.bins = None
291 print stat.name
292 printdata(runs, stat)
293 return

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

310 stat.bins = 'idle'
311 printdata(runs, stat)
312
313 print 'user ticks'
314 stat.bins = 'user'
315 printdata(runs, stat)
316
317 print 'interrupt ticks'
290 printdata(runs, stat)
291
292 print 'total ticks'
293
294 stat.bins = None
295 print stat.name
296 printdata(runs, stat)
297 return

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

314 stat.bins = 'idle'
315 printdata(runs, stat)
316
317 print 'user ticks'
318 stat.bins = 'user'
319 printdata(runs, stat)
320
321 print 'interrupt ticks'
318 stat.bins = 'user'
322 stat.bins = 'interrupt'
319 printdata(runs, stat)
320
321 print 'total ticks'
322
323 stat.bins = None
324 print args[0]
325 printdata(runs, stat)
326 return

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

640 options.passwd = ''
641 options.user = getpass.getuser()
642 options.runs = None
643 options.system = 'client'
644 options.get = None
645 options.binned = False
646 options.graph = False
647 options.graph68 = False
323 printdata(runs, stat)
324
325 print 'total ticks'
326
327 stat.bins = None
328 print args[0]
329 printdata(runs, stat)
330 return

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

644 options.passwd = ''
645 options.user = getpass.getuser()
646 options.runs = None
647 options.system = 'client'
648 options.get = None
649 options.binned = False
650 options.graph = False
651 options.graph68 = False
652 options.ticks = False
648
653
649 opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:')
654 opts, args = getopts(sys.argv[1:], '-6BEFGd:g:h:pr:s:u:T:')
650 for o,a in opts:
651 if o == '-6':
652 options.graph68 = True
653 if o == '-B':
654 options.binned = True
655 if o == '-E':
656 printval.mode = 'E'
657 if o == '-F':

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

667 if o == '-p':
668 options.passwd = getpass.getpass()
669 if o == '-r':
670 options.runs = a
671 if o == '-u':
672 options.user = a
673 if o == '-s':
674 options.system = a
655 for o,a in opts:
656 if o == '-6':
657 options.graph68 = True
658 if o == '-B':
659 options.binned = True
660 if o == '-E':
661 printval.mode = 'E'
662 if o == '-F':

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

672 if o == '-p':
673 options.passwd = getpass.getpass()
674 if o == '-r':
675 options.runs = a
676 if o == '-u':
677 options.user = a
678 if o == '-s':
679 options.system = a
680 if o == '-T':
681 options.ticks = a
675
676 if len(args) == 0:
677 usage()
678
679 command = args[0]
680 args = args[1:]
681
682 try:
683 commands(options, command, args)
684 except CommandException:
685 usage()
682
683 if len(args) == 0:
684 usage()
685
686 command = args[0]
687 args = args[1:]
688
689 try:
690 commands(options, command, args)
691 except CommandException:
692 usage()