Code profiling and load testing Pressflow on CentOS 5

Profiling setup

  • Install xdebug (see Stack installation on CentOS 5)
    • Configure with the option:
      xdebug.profiler_enable_trigger = 1
      
    • Do not enable any other profiling option.
  • Install cg2dot.py (via xdebugtoolkit)
  • Install graphviz
  • Install ghostscript

Running load tests

  • Clear out CacheGrind results from /tmp.
  • Make a single request:
    ab  -n 1 -c 1 [url]&XDEBUG_PROFILE=1
    
  • CacheGrind output will be on /tmp.

Processing results

  1. Initial setup (do this once):
    svn co http://xdebugtoolkit.googlecode.com/svn/tags/0.1.5/xdebugtoolkit/ ~/xdebugtoolkit
    echo "export PATH=~/xdebugtoolkit:$PATH" >> ~/.bashrc
    
  2. Convert the cachegrind output to a .dot file:
    cg2dot.py cachegrind.out.XYZ > cg.dot
    
  3. Convert the .dot file into PDF-compatible PostScript:
    dot cg.dot -Tsvg -ocg.svg
    
  4. The SVG will be named cg.svg.