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 (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 ~/xdebugtoolkit
    echo "export PATH=~/xdebugtoolkit:$PATH" >> ~/.bashrc
  2. Convert the cachegrind output to a .dot file: cachegrind.out.XYZ >
  3. Convert the .dot file into PDF-compatible PostScript:
    dot -Tsvg -ocg.svg
  4. The SVG will be named cg.svg.