There is only one script, that's in the zip file attached above here is the readme:
Installation:
To install BenchmarkIt on your website simply upload the benchmark.php file to any location on your web server.
Usage:
Append this code:
include_once(‘<path to benchmark.php>/benchmark.php’);
$bench = new benchmark(‘<full path to logs directory>/logName.extension’,’prgVer’,’program Name’);
$bench->startMark();
to the very top of your php script
For screen output append this code:
if(!$bench->endMark()) {echo $bench->get(‘error’);}
if(!$bench->runTime()) {echo $bench->get(‘error’);}
if(!$bench->reportTime()) {echo $bench->get(‘error’);}
to the end of your script
For log file output append this code:
if(!$bench->endMark()) {echo $bench->get(‘error’);}
if(!$bench->runTime()) {echo $bench->get(‘error’);}
if(!$bench->logTime()) {echo $bench->get(‘error’);}
to the end of your script
For screen and log file output append this code:
if(!$bench->endMark()) {echo $bench->get(‘error’);}
if(!$bench->runTime()) {echo $bench->get(‘error’);}
if(!$bench->logTime()) {echo $bench->get(‘error’);}
if(!$bench->reportTime()) {echo $bench->get(‘error’);}
to the end of your script
Turning BenchmarkIt on and off
There is a flag in benchmark.php that will turn benchmarking on and off. Line 30 includes this code:
define("IS_ON",1);
If you turn the 1 to a 0 then BenchmarkIt will not report any results to the screen or the log file and all functions will return true to fool any error trapping you may have done. Except for reportTime which returns the null string when benchmarking is turned off.
Functions
startMark - starts the bench mark clock
endMark - turns the bench mark clock off
runTime - calculate the number of microseconds it took a program to run.
logTime - records the benchmark in a log file for later use
reportTime - echo the benchmark to the screen
help - print the help screen for the user
about - print the about screen for the user
get - safely retrieves a class variable for the user
Parameters:
$What - the name of the class variable to return
Acceptable Values:
startTime, endTime, runLength, fileName, programName, pragramVer, error
Credits:
BenchmarkIt v1.0
Written By: J. Thomas Enders – Freelance Web Developer
[mailto]tomender@ptd.net[/mailto]