qafoolabs/xhprof-collector

该包已被弃用且不再维护。没有建议的替代包。

简单库,用于封装Xhprof配置收集。

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

This package is auto-updated.

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


README

围绕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集成示例

<?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'));