I am coding a program (in Python) that returns me some data. I want to know how to measure the response time between request and response (for performance analysis), then I will store this somewhere.
Is there a better and effective way to do this or simply insert, for example, time.ctime()before the request and the other time.ctime()after the answer, and then subtract them? How:
pre_time = time.ctime()
a = x + y
print a
pos_time = time.ctime()
result_time = postime - pretime
Of course, this subtraction will not work, but it is just for reference.
Thank!
source
share