line_profiler
This profiler is different from cProfile
. It helps you profile a function line by line instead of doing a deterministic profiling, like the other one does.
To install this profiler, you can use the pip (https://pypi.python.org/pypi/pip) command-line tool, with the following command:
$ pip install line_profiler
Note
If you run into any trouble, such as missing files during installation, make sure you have all development dependencies installed. In the case of Ubuntu, you can ensure that all the dependencies are installed by running the following command:
$ sudo apt-get install python-dev libxml2-dev libxslt-dev
This profiler is trying to fill in a breach left by cProfile
and others like it. Other profilers cover CPU time on function ...
Get Mastering Python High Performance now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.