ATLAS Offline Software
Classes | Functions
python.utils.AtlRunQueryTimer Namespace Reference

Classes

class  TimeCount
 
class  TimerStats
 

Functions

def timer (name, disabled=False)
 

Function Documentation

◆ timer()

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

Definition at line 86 of file AtlRunQueryTimer.py.

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