PHP Classes

PHP Profiler: Measure the elapsed time between PHP code sections

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 36 All time: 10,981 This week: 74Up
Version License PHP version Categories
profiler-php 1.0MIT/X Consortium ...7Time and Date, Performance and optimi..., P...
Description 

Author

This package can measure the elapsed time between PHP code sections.

It provides a class with function calls that note the current time in microseconds and associate with the named label of each checkpoint.

The class also provides functions that return arrays with the times of each checkpoint and also the times that passed between checkpoints.

Picture of Smoren  Freelight
  Performance   Level  
Name: Smoren Freelight <contact>
Classes: 38 packages by
Country: Russian Federation Russian Federation
Age: 35
All time rank: 280978 in Russian Federation Russian Federation
Week rank: 47 Up6 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 16x

Details

profiler

Packagist PHP Version Support Scrutinizer Code Quality Coverage Status Build and test License: MIT

Profiler helper

How to install to your project

composer require smoren/profiler

Unit testing

composer install
composer test-init
composer test

Usage

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
)
*/

  Files folder image Files (12)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (2 files)
Files folder imagetests (3 files, 2 directories)
Accessible without login Plain text file codeception.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (12)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (12)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file test_master.yml Data Auxiliary data

  Files folder image Files (12)  /  src  
File Role Description
  Plain text file Profiler.php Class Class source
  Plain text file ProfilerException.php Class Class source

  Files folder image Files (12)  /  tests  
File Role Description
Files folder imageunit (1 file)
Files folder image_support (1 file)
  Accessible without login Plain text file coding_standard.xml Data Auxiliary data
  Accessible without login Plain text file unit.suite.yml Data Auxiliary data
  Accessible without login Plain text file _bootstrap.php Aux. Auxiliary script

  Files folder image Files (12)  /  tests  /  unit  
File Role Description
  Plain text file ProfilerTest.php Class Class source

  Files folder image Files (12)  /  tests  /  _support  
File Role Description
  Plain text file UnitTester.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:36
This week:0
All time:10,981
This week:74Up