Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Python decorators for profiling/tracing/timing a single function
Python Makefile
Branch: master

Include PID in temporary filenames

Allows you to profile the same function from multiple processes at the
same time, without scribbling all over the same shared temporary file.

Fixes #6.
latest commit d983414f91
@mgedmin authored



It's a collection of decorators for profiling functions. E.g. to profile a single function:

from profilehooks import profile

def my_function(args, etc):

The results will be printed when the program exits (or you can use @profile(immediate=True)).

If you're interested in coarse timings and don't want to pay for the overhead of profiling, use

from profilehooks import timecall

@timecall       # or @timecall(immediate=True)
def my_function(args, etc):

Finally, you may be interested in seeing line coverage for a single function

from profilehooks import coverage

def my_function(args, etc):

Also functions can be available in Python console or module if run it with -m arg

$ python -m profilehooks
>>> profile
<function profile at 0x1005c6488>

$ python -m profilehooks yourmodule

Full documentation is available through pydoc profilehooks after installation.

The home page for this module is It has screensho, uh, that is, more examples.

Something went wrong with that request. Please try again.