04 Feb
by: Matt in Development, PHP
tags: execution time, microtime, php, profiling
Had to quickly get the execution time of certain segments of code so I whipped up this basic profiling class below.
Usage would go something like:
<?php
$profiler = new cProfiler;
$profiler->start();
// … long block of code …
$et = $profiler->end();
echo ‘longBlock et = ‘.$et.’<br>’;
?>
Class listing cProfiler.php:
<?php
class cProfiler
{
public $_i;
public $stamps;
public $ets;
function __construct()
{
$this->_i = 0;
$this->stamps = array();
$this->ets = array();
}
function __destruct() {}
function [...]
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.