stats.py (1318:57d49cdb92a5) stats.py (1329:1e7bd1684f64)
1#!/usr/bin/env python
2from __future__ import division
3import re, sys, math
4
1#!/usr/bin/env python
2from __future__ import division
3import re, sys, math
4
5
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]
9''' % sys.argv[0]
10 sys.exit(1)
11
12def getopts(list, flags):

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

252 if command == 'stability':
253 stats = info.source.getStat(args[0])
254 info.source.get = "avg"
255
256 #loop through all the stats selected
257 for stat in stats:
258
259 print "%s:" % stat.name
6def usage():
7 print '''\
8Usage: %s [-E] [-F] [-d <db> ] [-g <get> ] [-h <host>] [-p]
9 [-s <system>] [-r <runs> ] [-u <username>] <command> [command args]
10''' % sys.argv[0]
11 sys.exit(1)
12
13def getopts(list, flags):

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

253 if command == 'stability':
254 stats = info.source.getStat(args[0])
255 info.source.get = "avg"
256
257 #loop through all the stats selected
258 for stat in stats:
259
260 print "%s:" % stat.name
260 print "%-30s %12s %12s %4s %5s %5s %5s" % \
261 ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP")
262 print "%-30s %12s %12s %4s %5s %5s %5s" % \
263 ("------------------------------", "------------",
264 "------------", "----", "-----", "-----", "-----")
261 print "%-20s %12s %12s %4s %5s %5s %5s %6s" % \
262 ("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV")
263 print "%-20s %12s %12s %4s %5s %5s %5s %6s" % \
264 ("--------------------", "------------",
265 "------------", "----", "-----", "-----", "-----", "------")
265 #loop through all the selected runs
266 for run in runs:
267 info.display_run = run.run;
268 runTicks = info.source.retTicks([ run ])
269 #throw away the first one, it's 0
270 runTicks.pop(0)
266 #loop through all the selected runs
267 for run in runs:
268 info.display_run = run.run;
269 runTicks = info.source.retTicks([ run ])
270 #throw away the first one, it's 0
271 runTicks.pop(0)
271 stat.ticks = runTicks
272 info.globalTicks = runTicks
272 avg = float(stat)
273 stdev = 0
274 numoutsideavg = 0
275 numoutside1std = 0
276 numoutside2std = 0
277
278 #loop through all the various ticks for each run
279 for tick in runTicks:
273 avg = float(stat)
274 stdev = 0
275 numoutsideavg = 0
276 numoutside1std = 0
277 numoutside2std = 0
278
279 #loop through all the various ticks for each run
280 for tick in runTicks:
280 stat.ticks = str(tick)
281 #stat.ticks = str(tick)
282 info.globalTicks = [ tick ]
281 val = float(stat)
282 if (val < (avg * .9)) or (val > (avg * 1.1)):
283 numoutsideavg += 1
284 stdev += pow((val-avg),2)
285
286 stdev = math.sqrt(stdev / len(runTicks))
287 for tick in runTicks:
283 val = float(stat)
284 if (val < (avg * .9)) or (val > (avg * 1.1)):
285 numoutsideavg += 1
286 stdev += pow((val-avg),2)
287
288 stdev = math.sqrt(stdev / len(runTicks))
289 for tick in runTicks:
288 stat.ticks = str(tick)
290 info.globalTicks = [ tick ]
289 val = float(stat)
290 if (val < (avg - stdev)) or (val > (avg + stdev)):
291 numoutside1std += 1
292 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))):
293 numoutside2std += 1
294
291 val = float(stat)
292 if (val < (avg - stdev)) or (val > (avg + stdev)):
293 numoutside1std += 1
294 if (val < (avg - (2*stdev))) or (val > (avg + (2*stdev))):
295 numoutside2std += 1
296
295 print "%-30s %12s %12s %4s %5s %5s %5s" % \
297 print "%-20s %12s %12s %4s %5s %5s %5s %6s" % \
296 (run.name, "%.1f" % avg, "%.1f" % stdev,
297 "%d" % numoutsideavg, "%d" % numoutside1std,
298 (run.name, "%.1f" % avg, "%.1f" % stdev,
299 "%d" % numoutsideavg, "%d" % numoutside1std,
298 "%d" % numoutside2std, "%d" % len(runTicks))
300 "%d" % numoutside2std, "%d" % len(runTicks),
301 "%.1f" % (stdev/avg*100))
299 return
300
301
302 if command == 'stats':
303 if len(args) == 0:
304 info.source.listStats()
305 elif len(args) == 1:
306 info.source.listStats(args[0])

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

315
316 stats = info.source.getStat(args[0])
317 for stat in stats:
318 if options.graph:
319 graphdata(runs, options, stat.name, stat.name, stat)
320 else:
321 if options.ticks:
322 print 'only displaying sample %s' % options.ticks
302 return
303
304
305 if command == 'stats':
306 if len(args) == 0:
307 info.source.listStats()
308 elif len(args) == 1:
309 info.source.listStats(args[0])

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

318
319 stats = info.source.getStat(args[0])
320 for stat in stats:
321 if options.graph:
322 graphdata(runs, options, stat.name, stat.name, stat)
323 else:
324 if options.ticks:
325 print 'only displaying sample %s' % options.ticks
323 stat.ticks = options.ticks
326 info.globalTicks = [ int(x) for x in options.ticks.split() ]
324
325 if options.binned:
326 print 'kernel ticks'
327 stat.bins = 'kernel'
328 printdata(runs, stat)
329
330 print 'idle ticks'
331 stat.bins = 'idle'

--- 411 unchanged lines hidden ---
327
328 if options.binned:
329 print 'kernel ticks'
330 stat.bins = 'kernel'
331 printdata(runs, stat)
332
333 print 'idle ticks'
334 stat.bins = 'idle'

--- 411 unchanged lines hidden ---