Request-level sampling
The entry class wraps the request, samples business logic and stops in finally to persist.
XHProf / PHP
Capture function timings and memory into Redis, then open the browser for a flame graph.
The entry class checks the path before a request starts and takes over report pages or static assets; business requests are profiled by the xhprof extension for function timings and memory.
Core reaches frameworks through five contracts, twelve integrations each provide adapters, samples land in Redis, and the report page renders from that one store.
A small orange-red flame on a light gray circular background, its tip tilted and forked, with a smiling face and rosy cheeks.
A flicker reveals slow functions.Reports, comparison, export and auth all ship in the package.
The entry class wraps the request, samples business logic and stops in finally to persist.
Render by time, CPU or memory, and click a function to drill into its calls.
Tick exactly two runs and compare improvements and regressions in time order.
Lists suspicious functions by self time, call count, recursion and memory concentration.
auth_token, HTTP Basic, IP allowlist and trusted proxies add layered limits.
Export three views as JSON or CSV, and POST slow requests to a webhook.
Versions and dates come from the CHANGELOG and git tags.
Mascot::forms() lists the pet and twelve expressions; the report page also fixes invalid assets_url and empty-metric runs.
xhprof:profile registers automatically; four Laravel queue events start and stop per message, covering non-HTTP entry points.
Adds triggered sampling, Basic auth, IP allowlist, per-minute budget, slow-request webhook and JSON/CSV export.
The report page gets a little flame icon, a two-run comparison entry and proportional sampling.
Click an image to enlarge.
Install first, then mount the middleware for your first report.
composer require aaron-dev/xhprof-webman// config/middleware.php
use ErikWang2013\Xhprof\Webman\XhprofMiddleware;
return [
'' => [
XhprofMiddleware::class,
],
];
// 产生一次请求后访问 /xhprof 查看报告Hover for a moment and its mood changes.