I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running.
I\'ve looked at the timeit
Later answer, but I use timeit:
import timeit
code_to_test = """
a = range(100000)
b = []
for i in a:
b.append(i*2)
"""
elapsed_time = timeit.timeit(code_to_test, number=500)
print(elapsed_time)
# 10.159821493085474
code_to_test
.number
argument specifies the amount of times the code should repeat.