Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Python Low-Overhead Profiler
Python JavaScript HTML Shell Other
Branch: master

Remove __package__ from the script being run.

This prevents imports from incorrectly being interpreted as
relative to the 'plop' package, which would make the standard
'platform' module unimportable.

Fixes #21.
latest commit 854b1afca4
@bdarnell authored


Plop: Python Low-Overhead Profiler

Plop is a stack-sampling profiler for Python. Profile collection can be turned on and off in a live process with minimal performance impact.

Plop is currently a work in progress and pretty rough around the edges, so be prepared to run into bugs and extremely unrefined interfaces (which are likely to change in backwards-incompatible ways in future releases).


pip install plop


The plop.collector module runs on Python 2.7 on Unixy platforms including Linux, BSD and Mac OS X (must support the setitimer system call). The plop.viewer module requires Python 2.7 and Tornado 2.x or newer. The viewer can be (and usually is) run separately from the collector.


In the application to be profiled, create a plop.collector.Collector, call start(), wait, then stop(). Write repr(dict(collector.stack_counts)) to a file. See ProfileHandler in demo/ for an example of how to trigger profiling via an HTTP interface.

To profile an entire Python script, run:

python -m plop.collector

This will write the profile to /tmp/plop.out

To use the viewer, run:

python -m plop.viewer --datadir=demo/profiles

and go to http://localhost:8888


Circle size is based on the amount of time that function was at the top of the stack (i.e. time in that function, not any of its descendants). Arrow thickness is based on how often that call was present anywhere in the stack.

In other words, the circle size corresponds to "time", and the arrow size roughly corresponds to "cumulative time".


An end-to-end demo is available in the demo directory. will run a server (which talks to itself to generate load), generate a profile, and shut it down. will run the viewer app.

More info

The source code is hosted at

Something went wrong with that request. Please try again.