Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gevent profiler for long running code

Are there any profilers that can be used on a gevent based daemon(code that loops forever)? It is not a HTTP based daemon, it is used for back end purposes. I looked at few different potential profilers for gevent based code however they all look like they run only for code that runs for a while and exits.

like image 526
opensourcegeek Avatar asked Jun 08 '14 15:06

opensourcegeek


1 Answers

you can use GreenletProfiler, it provides a simple way to get detailed profiling information about a Python process that uses the gevent.

GreenletProfiler.set_clock_type('cpu')
GreenletProfiler.start()
my_function()
GreenletProfiler.stop()
stats = GreenletProfiler.get_func_stats()
stats.print_all()
stats.save('profile.callgrind', type='callgrind')

Here's a link!:

like image 52
Eran Avatar answered Oct 23 '22 05:10

Eran