so I have a lot (thousands of single scripts) that use the same library (self-developed) by importing *.
Is there a way for me to see/print the execution time for each script without modifying every single script, probably define at the library but expecting it to print before the code ends?
CodePudding user response:
You can't put time recording inside the library.
You will either have to put it inside each and every script.
May I ask how are you calling these 1000s of scripts? you can put the timer wherever it is you're calling these scripts from
CodePudding user response:
I actually found a way.
I put this code inside the library.
class TestTimer:
def __init__(self) -> None:
self.TimeStart = time.time()
def __del__(self):
print(f'Total TestTime: {time.time() - self.TimeStart}')
ExecutionTime = TestTimer()