Solar_Debug_Timer::profile()

public array Solar_Debug_Timer::profile ( void )

Returns profiling information as an array.

Parameters

  • None.

Returns

  • (array) An array of profile information.

Description

Returns profiling information as an array.

This will return the internal profile of marks as an array. For example, given this code ...

<?php
require_once 'Solar.php';
Solar::start();

$timer = Solar::factory('Solar_Debug_Timer');
$timer->start();

for ($i = 0; $i < 3; $i++) {
    time_nanosleep(0, rand(1,999999999));
    $timer->mark("iteration_$i");
}

$timer->stop();

$profile = $timer->profile();
Solar::dump($profile);

... the profile output might look like this:

array(3) {
    [0] => array(4) {
        ["name"] => string(7) "__start"
        ["time"] => float(1121903570.8062)
        ["diff"] => int(0)
        ["total"] => int(0)
    }
    [1] => array(4) {
        ["name"] => string(11) "iteration_0"
        ["time"] => float(1121903571.1628)
        ["diff"] => float(0.35667991638184)
        ["total"] => float(0.35667991638184)
    }
    [2] => array(4) {
        ["name"] => string(11) "iteration_1"
        ["time"] => float(1121903571.6973)
        ["diff"] => float(0.53444910049438)
        ["total"] => float(0.89112901687622)
    }
}


Local