Skip to content
Snippets Groups Projects
Commit e6e244cd authored by lukas leufen's avatar lukas leufen
Browse files

new time tracking wrapper to use as decorator

parent 038beaf2
No related branches found
No related tags found
3 merge requests!90WIP: new release update,!89Resolve "release branch / CI on gpu",!87Resolve "Data summary plot for usage of data (time-series)"
...@@ -5,6 +5,7 @@ __date__ = '2019-10-21' ...@@ -5,6 +5,7 @@ __date__ = '2019-10-21'
import datetime as dt import datetime as dt
from functools import wraps
import logging import logging
import math import math
import os import os
...@@ -43,6 +44,16 @@ def l_p_loss(power: int): ...@@ -43,6 +44,16 @@ def l_p_loss(power: int):
return loss return loss
class TimeTrackingWrapper:
def __init__(self, func):
wraps(func)(self)
def __call__(self, *args, **kwargs):
with TimeTracking(name=self.__wrapped__.__name__):
return self.__wrapped__(*args, **kwargs)
class TimeTracking(object): class TimeTracking(object):
""" """
Track time to measure execution time. Time tracking automatically starts on initialisation and ends by calling stop Track time to measure execution time. Time tracking automatically starts on initialisation and ends by calling stop
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment