🔥 An easier way to use cProfile
Switch branches/tags
Nothing to show
Clone or download
Latest commit dee710a Dec 17, 2015



An easier way to use cProfile.


cprofilev runs and profiles a given python program and outputs a simple html view of the statistics collected.

See: http://ymichael.com/2014/03/08/profiling-python-with-cprofile.html on how to make sense of the profiled statistics.


on most UNIX-like systems, you'll probably need to run the following `install` command as root or by using sudo

pip install cprofilev


  1. Simply run your python program in with the -m cprofilev flag.
$ python -m cprofilev /path/to/python/program ...
  1. Navigate to http://localhost:4000 to view profile statistics of your python program (even while its still running!)

Alternatively you can output view cprofile output using the -f flag:

# NOTE this is cProfile not cprofilev
$ python -m cProfile -o /path/to/save/output /path/to/python/program ...
$ cprofilev -f /path/to/save/output


usage: cprofilev.py [--version] [-a ADDRESS] [-p PORT] scriptfile [arg] ...

An easier way to use cProfile.

positional arguments:
  scriptfile            The python script file to run and profile.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -a ADDRESS, --address ADDRESS
                        The address to listen on. (defaults to
  -p PORT, --port PORT  The port to listen on. (defaults to 4000).
  -f FILE, --file FILE  cProfile output to view.
                        If specified, the scriptfile provided will be ignored.


bottle: used for serving the html page.


To quickly contribute to cprofilev, you can use this example as a means to profile things:

python -m cprofilev example_for_profiling.py