Develop VMProf

VMProf consists of several projects working together:

  • vmprof-python: The PyPI package providing the command line interface to enable vmprof.
  • vmprof-server: Webservice hosted at vmprof.com. Hosts and visualizes data uploaded by vmprof-python package.
  • vmprof-integration: Test suite for pulling together all different projects and ensuring that all play together nicely.
  • PyPy: A virtual machine for the Python programming language. Most notably it contains an implementation for the logging facility vmprof-server can display.

The following description helps you to set up a development environment on Linux. For Windows and MacOSX the instructions might be similar.

Develop VMProf on Linux

It is recommended to use Python 3.x for development. Here is a list of requirements on your system:

  • python
  • sqlite3
  • virtualenv

Please move you shell to the location you store your source code in and setup a virtual environment:

$ virtualenv -p /usr/bin/python3 vmprof3
$ source vmprof3/bin/activate

All commands from now on assume you have the vmprof3 virutal environment enabled.

Clone the repositories

$ git clone git@github.com:vmprof/vmprof-integration.git
$ git clone git@github.com:vmprof/vmprof-server.git
$ git clone git@github.com:vmprof/vmprof-python.git
# on old mercurial version the following command takes ages. please use a recent version
$ hg clone ssh://hg@bitbucket.org/pypy/pypy # optional, only if you want to hack on pypy as well

VMProf Server

# setup django service
$ cd vmprof-server
$ pip install -r requirements/development.txt
$ python manage.py migrate
# to run the service
$ python manage.py runserver -v 3

VMProf Python

An optional stage. It is only necessary if you want to co develop vmprof-python with vmprof-server:

# install vmprof for development (only needed if you want to co develop vmprof-python)
$ cd vmprof-python
$ python setup.py develop

Now you are able to change both the python package and the server and see the results. Here are some more hints on how to develop this platform

Smaller Profiles

Some times it is tedious to generate a big log file and develop a new feature with it. Both for VMProf and JitLog you can generate small log files that ease development.

There are small logs generated by a python script in vmprof-server/vmlog/test/data/loggen.py. Use the following command to load those:

$ ./manage.py loaddata vmlog/test/fixtures.yaml

Now open your browser and redirect them to the jitlog. E.g. http://localhost:8000/#/1v1/traces

Integration Tests

This is a very important test suite to ensure that all packages work together. It is automatically run every day by travis. You can run them locally. If you happen not to run a Debian base distribution, you can provide the following shell variable to prevent the tests from downloading a Debian PyPy:

$ TEST_PYPY_EXEC=/path/to/pypy py.test testvmprof/