ATLAS Offline Software
Functions | Variables
python.decorators.timed Namespace Reference

Functions

def timed (name)
 Decorator to output function execution time. More...
 

Variables

 logger = Logging.logging.getLogger("PowhegControl")
 Get handle to Athena logging. More...
 

Function Documentation

◆ timed()

def python.decorators.timed.timed (   name)

Decorator to output function execution time.

Parameters
nameName of the process being timed.
Author
James Robinson james.nosp@m..rob.nosp@m.inson.nosp@m.@cer.nosp@m.n.ch

Definition at line 12 of file timed.py.

12 def timed(name):
13  """! Decorator to output function execution time.
14 
15  @param name Name of the process being timed.
16 
17  @author James Robinson <james.robinson@cern.ch>
18  """
19  def wrap(func):
20  @wraps(func)
21  def wrapped_f(*args, **kwargs):
22  start_time = datetime.datetime.now()
23  logger.info("=> Preparing to run {} <=".format(name))
24  result = func(*args, **kwargs)
25  logger.info("=> Running {} took {} <=".format(name, RepeatingTimer.readable_duration(datetime.datetime.now() - start_time)))
26  return result
27  return wrapped_f
28  return wrap

Variable Documentation

◆ logger

python.decorators.timed.logger = Logging.logging.getLogger("PowhegControl")

Get handle to Athena logging.

Definition at line 9 of file timed.py.

python.decorators.timed.timed
def timed(name)
Decorator to output function execution time.
Definition: timed.py:12
vtune_athena.format
format
Definition: vtune_athena.py:14