Profiling/tracing a single function
Sometimes you want to profile just a single function in your Python program. Here's a module that lets you do just that: profilehooks.py. Sample usage:
#!/usr/bin/python from profilehooks import profile class SampleClass: def silly_fibonacci_example(self, n): """Return the n-th Fibonacci number. This is a method rather rather than a function just to illustrate that you can use the 'profile' decorator on methods as well as global functions. Needless to say, this is a contrived example.