Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 12
    You can also take a look at profilehooks pip install profilehooks, and its homepage here Commented Jan 5, 2013 at 5:08
  • 19
    Note that since Python 3.3, one should probably use time.monotonic() rather then time.time() when measuring timeouts or durations. docs.python.org/3/library/time.html#time.monotonic Commented May 18, 2015 at 21:53
  • 47
    Worth adding/noting here that the unit of measure for elapsed time will be seconds. Commented Jan 16, 2016 at 3:59
  • 5
    @EricKramer thank you! huge pet peev of mine, explaining measurements without defining the unit of measurement. And as a .NET guy dipping his toes into Python for the first time, I automatically thought "milliseconds". Commented Nov 30, 2016 at 1:01
  • 4
    Doesn't work if (e.g.) the system clock is changed, and may not have subsecond resolution. Correct answer: stackoverflow.com/a/47637891/476716 Commented Dec 4, 2017 at 16:44