As I didn't want to setup my apache just for a little profiling session, I did the following:
to settings.py I've added
import hotshotevery view-method that should be profiled got:
PROF = hotshot.Profile("plik.prof")
from settings import PROF
PROF.start()
(...)
PROF.stop()
and finally this came to my 'viewstat'-view:
import hotshot.stats
stats = hotshot.stats.load("plik.prof")
stats.strip_dirs()
stats.sort_stats('time', 'calls')
stats.print_stats(20)
And that's how I've become happy today. Wish me good luck for my cold.
- baum
It's fair to say that this probably won't run in a production-setup because of multithreading.
Keine Kommentare:
Kommentar veröffentlichen