Skip to content

Instantly share code, notes, and snippets.

Created October 30, 2014 14:30
  • Star 15 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save msonnabaum/c8902d5000d892ba121b to your computer and use it in GitHub Desktop.
  1. Add to index.php

register_shutdown_function(function () {
  $namespace = "somename";
  $filename = '/tmp/' . uniqid() . '.' . $namespace . '.sample_xhprof';
  file_put_contents($filename, serialize(xhprof_sample_disable()));
  chmod($filename, 0777);
  1. Make a bunch of requests
  2. Move sample files into a directory
mkdir some-dir
mv /tmp/*.sample_xhprof some-dir/
  1. Get flamegraph scripts
git clone
git clone
  1. Create flamegraph from sample files
xhprof-flamegraphs/xhprof-sample-to-flamegraph-stacks test-samples | FlameGraph/ > result.svg
open result.svg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment