PHP Classes

PHP Multi Profiler Class: Measure the performance of functions and classes

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 46%Total: 361 All time: 6,904 This week: 555Up
Version License PHP version Categories
multi-profiler 2GNU General Publi...5.4PHP 5, Performance and optimization
Description 

Author

This class can measure the performance of functions and classes.

It can call given functions a number of times and measure the elapsed time.

The class can also measure the time that it takes to create objects or call functions of a given class.

Innovation Award
PHP Programming Innovation award winner
September 2014
Winner


Prize: One subscription to the PDF edition of the PHP Architect magazine
Benchmarking is an useful process used to determine the performance of of a given piece of code.

This class can automate the benchmarking of global PHP functions, as well object creation and class function calls.

Manuel Lemos
Picture of Jacob Fogg
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

 

Example

<?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());


  Files folder image Files (2)  
File Role Description
Files folder imageFogg (1 directory)

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  
 0%
Total:361
This week:0
All time:6,904
This week:555Up
User Ratings User Comments (1)
 All time
Utility:66%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:-
Examples:66%StarStarStarStar
Tests:-
Videos:-
Overall:46%StarStarStar
Rank:3221