#native_company# #native_desc#
#native_cta#

Timing Script Execution Page 3

By Allan Kent
on September 26, 2000

My PHP script to use this object now looks like this:

<?php

include ('phptimer.inc');

$timer = new PHP_timer;

$timer->start();

$timer->addmarker('marker 1');

$timer->stop();

$timer->debug();

$timer->showtime();

?>



and will return to me something like:

Script execution debug information:
Marker Time Diff
Start 968594548.36899100
here be marker 1 968594548.36970100 0.000710
Stop 968594548.37014500 0.000444

0.001154


Last Word

I’ve intended this script to be a quick and easy way for programmers to debug lock ups
and timing problems in their scripts. Therefore I haven’t included any error checking
code. Also use a bit of common sense about where you put markers in your code – inside
a loop that is iterating through a database is probably not a good idea. Once before
and one after the loop would be a better idea.
I have started working on some ways of improving the debug information and output with
graphs and being able to nest or group markers, but this should be a start on debugging your scripts.
-Allan