currently i'm using the below code to find elapsed time for any routine/functions that i manually use start time and end time all that
But, i want a fuction should automatically return the entire function took how long as if like when we run query and it use to say how many seconds and milli seconds like that i want to run any function and each function should return me with that elapsed time.
and here is my code and absolutely i'm not happy with this and i want a high end professional line of code's pls help. Thanks.
def ElaspedTime(stime,etime):
from datetime import timedelta
timediff = timedelta(seconds=etime - stime)
return timediff
def STime():
return time.monotonic()
def ETime():
return time.monotonic()
#start_time = time.monotonic()
##call functions here
#end_time = time.monotonic()
#print( ElaspedTime(start_time,end_time))