📜 ⬆️ ⬇️

Twisted application profiling

Often I myself forget how to profile Twisted-applications easily and quickly (with some changes suitable for any Python-applications). In addition to Twisted, we also need KCachegrind .

We start our application with profiling enabled:
twistd -n --savestats --profile=myprog.hotshot myprog 

We give the load, the profile is going. Now, using the hotshot2cg utility from the KCachegrind distribution, we turn the hotshot profile into a calltree profile that KCachegrind can already eat.
 hotshot2cg myprog.hotshot > myprog.calltree 

Launch KCachegrind, open the resulting profile in it:
 kcachegrind myprog.calltree 

')

Source: https://habr.com/ru/post/92702/


All Articles