PYME.util.fProfile.fProfile module - Matlab(TM) style line based profiling for Python

Copyright: David Baddeley 2008
david_baddeley <at>

useage is similar to profiling in matlab (profile on, profile off, report), with the major difference being that you have to specify the filenames in which you want to do the profiling (to improve performance & to save wading through lots of standard library code etc ...).


mProfile.profileOn([‘’, ‘’])

stuff to be profiled ....


Due to the fact that we’re doing this in python, and hooking every line, there is a substantial performance hit, although for the numeric code I wrote it for (lots of vectorised numpy/scipy stuff) it’s only on the order of ~30%.

Licensing: Take your pick of BSD or GPL

class PYME.util.fProfile.fProfile.thread_profiler

Bases: object


prof_callback(frame, event, arg)
profileOn([regex, outfile])
prof_callback(frame, event, arg)
profileOn(regex='.*PYME.*', outfile='profile.txt')