dev-master
9999999-dev
The Requires
The Development Requires
v1.3
1.3.0.0
The Requires
The Development Requires
v1.2.1
1.2.1.0
The Requires
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Allows you to tag your code with profiler frames. It will calculate inclusive and exclusive durations for each tag and output with selected strategies., (*1)
composer require ob-ivan/sd-profiler
To start profiling and select output strategies:, (*2)
profiler()->init([
'append' => true,
// or:
'firephp' => true,
);
register_shutdown_function(function () {
profiler()->dispatch();
});
Example from WordPress functions.php:, (*3)
if (isset($_COOKIE['secretcookie']) && $_COOKIE['secretcookie'] === 'secretvalue') {
profiler()->init([
'firephp' => true,
]);
// Dispatch profiling result before WP forcefully closes all output buffers.
add_action(
'shutdown',
function () {
profiler()->dispatch();
},
0
);
}
To put profiler frame tags:, (*4)
profiler()->in('my_function', $vars);
my_function($vars);
profiler()->out('my_function');
You can add arbitrary debug info with log method:, (*5)
function my_function($vars) {
profiler()->log('my_function', $vars);
// useful stuff here...
}