Revision: Thu, 25 Apr 2024 11:06:42 GMT
v1.0 – outdated
This version of the documentation is outdated. Consider upgrading your project to Spiral Framework 3.12
Edit this page

Application Profiling

Spiral does not provide deep profiling functionality for your application, use tools like xDebug or BlackFire for such purposes.

Instead, framework shipped with simple benchmark class used to capture information about time consuming tasks.

All SQL queries, Storage operations and view rendering/compilation utilizes benchmarking.

User Benchmarking

You can connect benchmark functionality to your controller or service by either requesting BenchmarkerInterface or via BenchmarkTrait:

php
use BenchmarkTrait;

public function indexAction()
{
    $b = $this->benchmark('long-operation');
    sleep(2);
    $this->benchmark($b);
}

Visualization

Visualization of collected benchmarks if specific to implementation you used, under default application such timeline can be rendered using profiler module:

Profiler

Note that running your application enabled profiling will slow down execution.