Added a @plop decorator #1

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@robbyt
robbyt commented Jul 19, 2012

No description provided.

Owner

Sampling profilers take enough time (tens of seconds) to collect a useful amount of data that I'm not sure decorating a single function is a useful way to collect data. There are also thread-safety issues, etc since the collector uses signal handlers which are a process-wide state. You're welcome to use something like this in your own projects if it suits your needs, but for general use I'd recommend thinking about things in terms of sampling the entire process and then narrowing down to a single function by filtering at the viewer level.

robbyt commented Jul 30, 2012

I might be confused on how to use Plop,
Based on the example in your demo file, you instantiate a plop collector only in the get and subsequent callback. Should plop be added to the lowest level of the application? (the equivalent of the main() ) or can it be used for profiling single functions?

Owner

The collector is instantiated in the ProfileHandler, but it's collecting data on everything else that's happening at the same time (i.e. generate_traffic and HelloHandler). Plop is designed for profiling servers, where it can be switched on for a minute or so at a time during a long-running process, as seen in the demo. It's possible to profile a "single function" as long as that function runs for a long time, but in most cases it probably makes the most sense to profile the equivalent of main(), which can be done with "python -m plop.collector myscript.py".

@bdarnell bdarnell closed this Apr 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment