Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

An addon to csa/xhprof-persister, enabling creation of call graphs from an XhProf trace

License

Notifications You must be signed in to change notification settings

quadrilatere/xhprof-grapher

Repository files navigation

XhProf grapher

Latest Stable Version Latest Unstable Version SensioLabs Insight Scrutinizer Quality Score Code Coverage

Installation

composer require csa/xhprof-grapher:dev-master

Usage

Create any type of PHP web or console application, then use the following in your code

<?php

require_once __DIR__ . '/vendor/autoload.php';

use XhProf\Storage\FileStorage;
use XhProf\Graph\Loader\XhProfDataLoader as Loader;
use XhProf\Graph\Dumper\GraphvizDumper as Dumper;

$storage = new FileStorage();
$trace = $storage->fetch('1234567890abcdef');
$loader = new Loader();
$graph = $loader->load($trace);
$dumper = new Dumper();

if ('cli' !== php_sapi_name()) {
    header('Content-type: image/png');
}

echo $dumper->dump($graph);

You can either use this script in your browser or using the command line

$ php ./script.php > output.png

Todo

  • Add support for loading exclusive metrics
  • Add support for aggregating metrics
  • Improve graphviz callgraph
  • Add support for other graphing outputs (graphdracula, arborjs, flare, js-graph-it, etc.)

License

This library is under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

Bitdeli Badge

About

An addon to csa/xhprof-persister, enabling creation of call graphs from an XhProf trace

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages