1 # log system for PLCAPI
6 from PLC.Logger import logger
10 Prints the runtime of the specified callable. Use as a decorator, e.g.,
24 result = profile(foo)(...)
27 def wrapper(*args, **kwds):
29 result = callable(*args, **kwds)
32 args += ["%s = %s" % (name, str(value)) for (name, value) in kwds.items()]
33 logger.info("%s (%s): %f s" % (callable.__name__, ", ".join(args), end - start))
38 if __name__ == "__main__":
39 def sleep(seconds = 1):
42 sleep = profile(sleep)