PHP Script Timer

Filed Under (Tools) by einchi on 20-06-2008

Tagged Under :

Today, I try to search some tools to count PHP script execution time. After Googling for a moment I found some script that i want. ^^

There are 3 site that have tutorial how to count PHP script execution time. One of them is http://www.ars-informatica.ca/article.php?article=37. There are any script to count PHP script execution time and written with PHP too. You can look the script or download it for free..

Or I’ll give you link to DOWNLOAD (Just click save as). Then extract it.. How to use it?

Just read usage inside PHP_script_timer.php

USAGE

First, the calling code must reference the PHP_script_timer script:

include ‘PHP_script_timer.php’;

Call the timing script at the start of the code to be timed with:

$timing_loops = 1;
for ($current_loop = 0; $current_loop < $timing_loops; $current_loop++) {
$time_start = microtime_float();

To end the timing sequence, follow the code to be timed with:

$timing[] = microtime_float() - $time_start;
}
timing($timing);

To run more the timing loop more then once, and calculate fastest, slowest and
average execution times, simply specify 2 or more $timing_loops.

note: don’t forget to put PHP_script_timer.php to the same folder with PHP script that you want to test.

Read the rest of this entry »