-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profiling #45
Comments
Here's how I experimented with profiling a method in Plone: Assumption: You want to do profiling yourself and not add it as a feature to your buildout. Install required packagesIn your virtualenv install the packages profilehooks (http://mg.pov.lt/profilehooks/) and snakeviz (https://jiffyclub.github.io/snakeviz/):
Prepare your code for profilingAdd a decorator to the method you want to profile::
Profile!Run the test like usual
That will produce results like this:
ncalls is relevant only to the extent that comparing the numbers against other counts such as number of chars/fields/lines in a file may highligh anomalies. tottime and cumtime is what really matters:
Visualize and analyzeThe test-run created a file called test_stuff.prof in parts/test/. Use snakeviz to to analyze it:
That will open your browser at http://127.0.0.1:8080/snakeviz/home/pbauer/workspace/foo/parts/test/test_stuff.prof and shows a diagram that show the time used by the functions the test and lets you drill down into the methods called by your code and see what takes how long. See https://jiffyclub.github.io/snakeviz/#interpreting-results on how to interpret results. It takes some time to get used to it but it gets really usefull after a while! |
Frist thanks for this amazing piece of work.
I have one question regarding profiling a Plone-Site in development.
Are there any tools which you recommend. Would it make sense to integrate it to
the local development environment.
Christian
The text was updated successfully, but these errors were encountered: