PHP code example of irap / profiling

1. Go to this page and download the library: Download irap/profiling library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

irap / profiling example snippets




# Include the autoloader for packages.
nAnalyzer::start();
    sleep(3);
    \iRAP\Profiling\FunctionAnalyzer::stop();
}

function Foo()
{
    \iRAP\Profiling\FunctionAnalyzer::start();
    sleep(1);
    Bar();
    \iRAP\Profiling\FunctionAnalyzer::stop();
}

Foo();
print \iRAP\Profiling\FunctionAnalyzer::getResults();



# Include the autoloader for packages.
oo()
{
    \iRAP\Profiling\FunctionAnalyzer::start();
    sleep(1);
    Bar();
    \iRAP\Profiling\FunctionAnalyzer::stop();
}

Foo();
print \iRAP\Profiling\FunctionAnalyzer::getResults();



function Bar() { sleep(3); }
function Foo() { sleep(1); }

function main()
{
    \iRAP\Profiling\FunctionAnalyzer::start('part1');
    Foo();
    \iRAP\Profiling\FunctionAnalyzer::stop('part1');

    // Profiling part 2
    \iRAP\Profiling\FunctionAnalyzer::start('part2');
    Bar();
    Foo();
    \iRAP\Profiling\FunctionAnalyzer::stop('part2');
}

main();
print \iRAP\Profiling\FunctionAnalyzer::getResults();