4 from __future__
import print_function
5 from contextlib
import contextmanager
21 from operator
import attrgetter
26 print (
"%s%-70s : %f (sub sum %f)" % (5*lvl*
" ", self.
name, self.
totaltime, ts))
28 print (
"%s%-70s : %f" % (5*lvl*
" ", self.
name, self.
totaltime))
30 sortedByTime =
sorted(self.
subcounts,key=attrgetter(
'totaltime'),reverse=
True)
32 for subtc
in sortedByTime:
33 subtc.printRecursive(lvl+1)
62 idx = cur.subcounts.index(n)
64 cur = cur.subcounts[idx]
67 cur = cur.subcounts[-1]
68 cur.totaltime += exectime
77 cls.
total.printRecursive(0)
82 print (
"%-70s : %f (%i)" % (name, _time, callcount))
86 def timer(name, disabled = False):
87 "A context manager which spits out how long the block took to execute"
92 from CoolRunQuery.utils.AtlRunQueryTimer
import TimerStats
as TS
96 TS.context.append(name)
101 execTime = end - start
102 TS.saveTime(execTime)
105 print (
"%*s took %.2f sec to %s" % (5*TS.level,
"...", execTime, name))