<?php
require('Profiler.php');
use Fogg\Util\Timer\Profiler\Profiler;
//Instantiate a profiler object
echo "Start the profiler.<br>\n";
$profiler = new Profiler();
//Profile a function
$profiler->profileFunction('rand',[0,9999]);
//profile a class instantiation
$profiler->profileClass('mysqli',['localhost', 'my_user', 'my_password', 'world']);
//profile a namespaced class
$profiler->profileClass('Fogg\Util\Timer\Profiler\Profiler',[100]);
//profile a method
$profiler->profileMethod(new mysqli(),'query',['select count(*) from users;']);
//print out the results
echo "<h1>Profile Results as array</h1>";
print_r($profiler->getResults());
|