PHP code example of qafoolabs / xhprof-collector

1. Go to this page and download the library: Download qafoolabs/xhprof-collector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

qafoolabs / xhprof-collector example snippets



$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");



use Symfony\Component\HttpFoundation\Request;

filer = 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'));