PHPBuilder - Timing Script Execution Page 3



RSS Twitter
Articles Tricks And Hacks

Timing Script Execution - Page 3

by: Allan Kent
|
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:
MarkerTimeDiff
Start968594548.36899100-
here be marker 1968594548.369701000.000710
Stop968594548.370145000.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

« Previous Page
1
|
2
|
3

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Allan Kent

Comment:



Comment:

(Maximum characters: 1200). You have characters left.