qafoolabs/xhprof-collector

This package is abandoned and no longer maintained. No replacement package was suggested.

Simple library that wraps Xhprof profile collection.

v0.1 2014-05-25 18:17 UTC

This package is auto-updated.

Last update: 2021-04-12 07:38:20 UTC


README

Wrapper around Xhprof API.

<?php
$profiler = new \Xhprof\ProfileCollector(
    new \Xhprof\FacebookBackend('/tmp', 'myapp'),
    new \Xhprof\StartDecisions\AlwaysStart()
);

$profiler->start();

// now all your application code here

$profiler->stop("name of operation that was performed");

Symfony Integration Example

<?php

use Symfony\Component\HttpFoundation\Request;

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../app/AppKernel.php";

$profiler = new \Xhprof\ProfileCollector(
    new \Xhprof\FacebookBackend('/tmp', 'myapp'),
    new \Xhprof\StartDecisions\AlwaysStart()
);
$profiler->start();

$request = Request::createFromGlobals();
$kernel = AppKernel::createFromBuildProperties();

$response = $kernel->handle($request);
$response->send();

$kernel->terminate($request, $response);

$profiler->stop($request->attributes->get('_controller', 'notfound'));