Reduce Stack Frame Depth from XDebug Trace Output
Earlier, I’ve written about how to dump code trace from your PHP application using XDebug, however, more often that not, you get lengthy results and you simply want to get an overview up to certain depth. I’ve created a simple PHP for that which you can find here.
It’s fairly easy to use, simply feed in the path to the trace file and the stack frame depth you desire i.e.
php process-xdebug-trace.php -f /path/to/trace.file -d frame-depth
And you get an update like this:
[root@thriller ~]# php /home/revin/process-xdebug-trace.php -f /var/www/sites/default/xdebug-trace-outputs/trace.2043925204.xt -d 3 Processing /var/www/sites/default/xdebug-trace-outputs/trace.2043925204.xt with stack frame depth of 3 0.0013 652920 0.0013 652920 -> {main}() /var/www/sites/default/index.php:0 0.0003 176 0.0016 653096 -> define() /var/www/sites/default/index.php:2 0.0002 0 0.0018 653096 -> define() /var/www/sites/default/index.php:3 0.0001 0 0.0019 653096 -> define() /var/www/sites/default/index.php:4 0.0001 72 0.0020 653168 -> dirname() /var/www/sites/default/index.php:5 0.0000 -8 0.0020 653160 -> define() /var/www/sites/default/index.php:5 ...
The first and second column are relative changes of execution time and memory usage respectively.
Comments
Leave a Comment