JavaScript Editor Javascript validator     Web page editor 


Benchmark_Timer -- About Benchmark_Timer

About Benchmark_Timer

As mentioned before, this class simply records the time taken for a particular snippet of code to execute. In the automatic mode, this means the code remaining after the class's instantiation. In manual mode, the snippet of code to be timed is specified between calls to the start() and stop() methods of the class.

Additionally, you may specify markers between the snippet of code to be timed. The timing information is recorded wherever markers are defined.

An example will make this clear.

The example above will generate an output as shown below when run with the PHP CLI SAPI. Running it with the Apache SAPI will produce the same results, but formatted as HTML.

In most cases however, you would like to do something with that information. When you run the timer in manual mode, you can obtain the results as an associative array using the getProfiling() method. To display the information (as shown above) use the display() method. More information on the methods that Benchmark_Timer implements is available in the API Documentation.

JavaScript Editor Javascript validator     Web page editor