PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 361 All time: 6,897 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  
Name: Jacob Fogg <contact>
Classes: 7 packages by
Country: United States United States
Age: 44
All time rank: 1049149 in United States United States
Week rank: 416 Up46 in United States United States Up
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  
File Role Description
Files folder imageFogg (1 directory)

  Files folder image Files  /  Fogg  
File Role Description
Files folder imageUtil (1 directory)

  Files folder image Files  /  Fogg  /  Util  
File Role Description
Files folder imageTimer (1 directory)

  Files folder image Files  /  Fogg  /  Util  /  Timer  
File Role Description
Files folder imageProfiler (2 files)

  Files folder image Files  /  Fogg  /  Util  /  Timer  /  Profiler  
File Role Description
  Accessible without login Plain text file Example.php Example An example class for the Profiler
  Plain text file Profiler.php Class The Profiler class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:361
This week:0
All time:6,897
This week:555Up
User Comments (1)