| Recommend this page to a friend! | 
| Info | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 36 | All time:  11,013 This week: 74 | ||||
| Version | License | PHP version | Categories | |||
| profiler-php 1.0 | MIT/X Consortium ... | 7 | Time and Date, Performance and optimi..., P... | 
| Description | Author  | |
This package can measure the elapsed time between PHP code sections.  | 
Profiler helper
composer require smoren/profiler
composer install
composer test-init
composer test
use Smoren\Profiler\Profiler;
function someTask()
{
    Profiler::start('first');
    usleep(10000);
    Profiler::stop('first');
    Profiler::start('second');
    usleep(20000);
    Profiler::stop('second');
}
for($i=0; $i<10; ++$i) {
    someTask();
}
Profiler::profile('third', function() {
    usleep(30000);
});
print_r(Profiler::getStatTime());
/*
Array
(
    [second] => 0.2015209197998
    [third] => 0.20024418830872
    [first] => 0.10135746002197
)
*/
print_r(Profiler::getStatCalls());
/*
Array
(
    [first] => 10
    [second] => 10
    [third] => 1
)
*/
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Lic. | License text | |||
| Doc. | Documentation | |||
| / | src | 
| File | Role | Description | 
|---|---|---|
|    | 
Class | Class source | 
|    | 
Class | Class source | 
| / | tests | 
| File | Role | Description | ||
|---|---|---|---|---|
|    | 
Data | Auxiliary data | ||
|    | 
Data | Auxiliary data | ||
|    | 
Aux. | Auxiliary script | ||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% | 
  | 
  | 
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.