-
-
Notifications
You must be signed in to change notification settings - Fork 156
Profiling
tomkralidis edited this page Jun 21, 2012
·
1 revision
To analyze pycsw performance, the following approach can be used:
- Alter
csw.py
to run as a single function through cProfile:
from server import server
import cProfile
def foo():
# get runtime configuration
CSW = server.Csw('./default.cfg')
# go!
CSW.dispatch()
cProfile.run('foo()', '/tmp/pycsw.prof')
This will output the profiling report to /tmp/pycsw.prof
.
- Convert the profiling output to a dot graph with gprof2dot:
gprof2dot -f pstats /tmp/pycsw.prof |dot -Tpng -o /tmp/pycsw-prof.png
This will output a PNG graph of the entire process, which can help identify bottlenecks in a given process.