PHP Profiler Class review

Download
by rbytes.net on

This profiler is intended to be used to identify areas of code that could be optimised in order to improve overall performance of an

License: GPL (GNU General Public License)
File size: 3K
Developer: Carl Taylor
0 stars award from rbytes.net

This profiler is intended to be used to identify areas of code that could be optimised in order to improve overall performance of an application. Typically I identify the areas of concern in an application and place profile timers around those sections and focus down to add timers around the areas that are taking the most time and look for ways to optimise those particular areas.

The items with the highest percentage time spent are usually the ones that can give the biggest improvements.

PHP Class to perform code profiling in order to aid locating areas of code that consume most processing time.

Provides information on number of calls to a code section, percentage and total of time spent on a section. Timing of nested code sections is possible.

Here are some key features of "PHP Profiler Class":
Count the number of times a section of code is executed
Calculate the total ammount of time spent executing a section of code
Permit multiple timers to be set
Allow nested timers to such that the parent timers are suspended whilst a child section of code is running.
Output a report at the end of execution to show the percentage of time spent on an operation,
the number of times the section was run, the overall time spent on the section.


Usage:

# include_once( 'profiler.inc');
$prof = new Profiler( profile_flag, trace_flag );

# Profile_flag = true enables output of the statistical information
# trace_flag = true enables output of the trace information

$prof->startTimer( "timer_name", "Description" );

# timer_name is a simple string to name the timer
# description is an optional string to describe the purpose of the timer in more detail

$prof->stopTimer( "timer_name" );

$prof->printTimers( flag );

Output the final report of the processing operation being run. Normally this would be called as one of the last statements on a page.
If flag=true is set then the output will be forced even if the profile_flag was set false when the profiler was initialised

PHP Profiler Class search tags