You can also use time.clock() It counts the time used by the process on Unix and time since the first call to it on Windows. It's more precise than time.time().
It's the usually used function to measure performance.
Just call
import time t_ = time.clock() #Your code here print 'Time in function', time.clock() - t_ EDITED: Ups, I miss the question as you want to know exactly the time, not the time spent...