Need help with vprof?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

nvdv
3.7K Stars 167 Forks BSD 2-Clause "Simplified" License 619 Commits 24 Opened issues

Description

Visual profiler for Python

Services available

!
?

Need anything else?

Contributors list

# 28,369
Shell
Erlang
Elixir
Python
567 commits
# 3,530
Python
pandas
scikit-...
cython
3 commits
# 86,765
python3
jira
CSS
gelf
2 commits
# 40,438
seleniu...
nginx-p...
nginx
python3
2 commits
# 1,929
penetra...
phantom...
svd
python-...
1 commit
# 142,409
Shell
GraphQL
websock...
C
1 commit
# 198,005
visuali...
CSS
HTML
d3
1 commit
# 52,930
Webpack
React
Firefox
C
1 commit
# 399,477
HTML
CSS
Keras
artific...
1 commit
# 104,760
cython
graphql...
Shell
unit-te...
1 commit
# 37,004
functio...
functio...
cpluspl...
Tensorf...
1 commit
# 148,212
PHP
magento...
CSS
magento...
1 commit
# 120,046
CSS
C
Flask
openvpn
1 commit
# 199,796
CSS
robot-f...
udemy
robotfr...
1 commit
# 19,761
Rust
Django
ecmascr...
dos
1 commit
# 85,486
Django
django-...
CSS
PHP
1 commit

PyPI

vprof

vprof is a Python package providing rich and interactive visualizations for various Python program characteristics such as running time and memory usage. It supports Python 3.4+ and distributed under BSD license.

The project is in active development and some of its features might not work as expected.

Screenshots

vprof-gif

Contributing

All contributions are highly encouraged! You can add new features, report and fix existing bugs and write docs and tutorials. Feel free to open an issue or send a pull request!

Prerequisites

Dependencies to build

vprof
from source code: * Python 3.4+ *
pip
*
npm
>= 3.3.12

npm
is required to build
vprof
from sources only.

Dependencies

All Python and

npm
module dependencies are listed in
package.json
and
requirements.txt
.

Installation

vprof
can be installed from PyPI
pip install vprof

To build

vprof
from sources, clone this repository and execute
python3 setup.py deps_install && python3 setup.py build_ui && python3 setup.py install

To install just

vprof
dependencies, run
python3 setup.py deps_install

Usage

vprof -c  

 is a combination of supported modes:

  • c
    - CPU flame graph ⚠️ Not available for windows #62

Shows CPU flame graph for

.

  • p
    - profiler

Runs built-in Python profiler on

 and displays results.

  • m
    - memory graph

Shows objects that are tracked by CPython GC and left in memory after code execution. Also shows process memory usage after execution of each line of

.

  • h
    - code heatmap

Displays all executed code of

 with line run times and execution counts.

 can be Python source file (e.g. 
testscript.py
) or path to package (e.g.
myproject/test_package
).

To run scripts with arguments use double quotes

vprof -c cmh "testscript.py --foo --bar"

Modes can be combined

vprof -c cm testscript.py

vprof
can also profile functions. In order to do this, launch
vprof
in remote mode:
vprof -r

vprof
will open new tab in default web browser and then wait for stats.

To profile a function run

from vprof import runner

def foo(arg1, arg2): ...

runner.run(foo, 'cmhp', args=(arg1, arg2), host='localhost', port=8000)

where

cmhp
is profiling mode,
host
and
port
are hostname and port of
vprof
server launched in remote mode. Obtained stats will be rendered in new tab of default web browser, opened by
vprof -r
command.

vprof
can save profile stats to file and render visualizations from previously saved file.
vprof -c cmh src.py --output-file profile.json

writes profile to file and

vprof --input-file profile.json

renders visualizations from previously saved file.

Check

vprof -h
for full list of supported parameters.

To show UI help, press

h
when visualizations are displayed.

Also you can check

examples
directory for more profiling examples.

Testing

python3 setup.py test_python && python3 setup.py test_javascript && python3 setup.py e2e_test

License

BSD

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.