# PYME.util.fProfile.fProfile module¶

mProfile.py - Matlab(TM) style line based profiling for Python

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 …).

e.g.

mProfile.profileOn([‘onefile.py’, ‘anotherfile.py’])

stuff to be profiled ….

mProfile.profileOff() mProfile.report()

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

Methods

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