2017 © Pedro Peláez
 

project xtrace2fg

Converts XDebug TRACE files to https://github.com/brendangregg/FlameGraph compatible input

image

pounard/xtrace2fg

Converts XDebug TRACE files to https://github.com/brendangregg/FlameGraph compatible input

  • Thursday, October 5, 2017
  • by pounard
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 33 % Grown

The README.md

XDebug TRACE files to FlameGraph converter

From a given Xdebug generated trace file, outputs text suitable for https://github.com/brendangregg/FlameGraph flamegraph generator., (*1)

This requires xdebug.trace_format setting to be set to 1., (*2)

Prerequisites

  • You need https://github.com/brendangregg/FlameGraph to be installed somewhere.
  • xdebug.trace_format setting must be 1 in PHP configuration.

Usage

This will output a trace file using time relative cost for each function:, (*3)

xtrace2fg TRACE_FILE | flamegraph.pl > OUTPUT.svg

And this will output a trace file using memory relative cost for each function:, (*4)

xtrace2fg memory TRACE_FILE | flamegraph.pl --color=mem > OUTPUT.svg

Where:, (*5)

  • FILE is the Xdebug TRACE file (generated using xdebug.trace_format=1), (*6)

  • OUTPUT.svg if the output filename, (*7)

You can load the SVG output file into any recent browser to benefit from browsing capabilities in the flame graph., (*8)

Warning, memory support is experimental, and is NOT doing what you'd expect because it will revert all functions that actually free memory to 0. You will see functions that consume memory without freeing it, but it not necessarily mean it's a leak, since it could be garbage collected somewhere else., (*9)

Generated sample trace file

XDEBUG_MODE=trace XDEBUG_TRIGGER=1 php -d'xdebug.trace_format=1' -f samples/test.php
cp /tmp/trace.XXXXXX.xt samples/test.xt

./xtrace2fg samples/test.xt > samples/test.cost.output
cat samples/test.cost.output | ~/FlameGraph/flamegraph.pl > samples/test.cost.svg

./xtrace2fg memory samples/test.xt > samples/test.memory.output
cat samples/test.memory.output | ~/FlameGraph/flamegraph.pl --color=mem > samples/test.memory.svg

The Versions

05/10 2017

dev-master

9999999-dev

Converts XDebug TRACE files to https://github.com/brendangregg/FlameGraph compatible input

  Sources   Download

MIT

05/10 2017

1.0.0

1.0.0.0

Converts XDebug TRACE files to https://github.com/brendangregg/FlameGraph compatible input

  Sources   Download

MIT