No project description provided
Project description
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).
Installation
pip install plop
Prerequisites
Plop runs on Python 2.7 and 3.x. The plop.collector module runs on Unixy platforms including Linux, BSD and Mac OS X (must support the setitimer system call). The plop.viewer module requires Tornado 2.x or newer. The viewer can be (and usually is) run separately from the collector.
Usage
In the application to be profiled, create a plop.collector.Collector, call start(), wait, then stop(). Create a Formatter (either PlopFormatter or FlamegraphFormatter) and call its save() method to write the output to a file. See ProfileHandler in demo/busy_server.py for an example of how to trigger profiling via an HTTP interface.
To profile an entire Python script, run:
python -m plop.collector myscript.py
This will write the profile to ./profiles/[timestamp]. Add -f flamegraph for flamegraph output.
To use the viewer for the default .plop output format, , run:
python -m plop.viewer --datadir=demo/profiles
and go to http://localhost:8888. For .flame format, see https://github.com/brendangregg/FlameGraph
Interpretation
In the default viewer, 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”.
Example
An end-to-end demo is available in the demo directory. create_profile.sh will run a server (which talks to itself to generate load), generate a profile, and shut it down. view_profile.sh will run the viewer app.
More info
The source code is hosted at https://github.com/bdarnell/plop
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file plop-0.3.0.tar.gz
.
File metadata
- Download URL: plop-0.3.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 603f87d82448f919d74a29da87d5fb68612f1e9c6ef75cfc9f6d184b53b7dbaf |
|
MD5 | 4a313d6a8dd59ac48cfa3af426d197fc |
|
BLAKE2b-256 | 08a89ee4b7dfe88a7a416cc4a7ec077a2495a5e222cf3fa2d3a011bdb7960fbe |