ATLAS Offline Software
Loading...
Searching...
No Matches
python.utils.AtlRunQueryTimer Namespace Reference

Classes

class  TimeCount
class  TimerStats

Functions

 timer (name, disabled=False)

Function Documentation

◆ timer()

python.utils.AtlRunQueryTimer.timer ( name,
disabled = False )

Definition at line 85 of file AtlRunQueryTimer.py.

85def timer(name, disabled = False):
86 "A context manager which spits out how long the block took to execute"
87 if disabled: #not environ.has_key("ARQDEBUG"):
88 yield
89 return
90
91 from CoolRunQuery.utils.AtlRunQueryTimer import TimerStats as TS
92
93 start = time()
94 TS.level += 1
95 TS.context.append(name)
96 try:
97 yield
98 finally:
99 end = time()
100 execTime = end - start
101 TS.saveTime(execTime)
102 TS.level -= 1
103 TS.context.pop()
104 print ("%*s took %.2f sec to %s" % (5*TS.level, "...", execTime, name))