Free Trial
A FREE 7 Day trial of our VoIP Service on your Android or Apple mobile device.
- Free 084 number for people to call you
- 5 minutes of free calls to try calling UK mobiles and landlines
- Instant activation
- Free software download
- Minimal configuration
Sign up now! »
‹
›
PHP Profiler Manual Page
Profiler Manual
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.
Features
Perform profiling to provide the following information
- 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
Warning:
If a profile timer is started in a function, it must be stopped prior to exiting that function in order to ensure integrity of the output information.
Example Usage
include_once('profiler.inc');
$prof = new Profiler( true ); // Output the profile information but no trace
$prof->startTimer( "initialise" );
initialise_routine();
$prof->stopTimer( "initialise" );
$prof->startTimer( "main_loop" );
while( $record=get_record() ){
print_record( $record );
}
$prof->stopTimer( "main_loop" );
$prof->printTimers( true );
function get_record()
{
global $prof;
$prof->startTimer( "get_record" );
// Routine to get the record information
$prof->stopTimer( "get_record" );
}
function print_record( $record )
{
global $prof;
// print header information
$prof->startTimer( "main_print_record" );
// main print processing
$prof->stopTimer( "main_print_record" );
}
Feedback
If you make any improvements to the code, or just find it useful in helping you optimise the performance of your applications I would appreciate you dropping a note.
© Copyright 2002 Carl Taylor
Cath S, Bury, Manchester
What a fantastic service. Carl arrived, complete with programmed phone, and the installation was done in no time at all, with very little 'down time'. I would have no hesitation...
Read on...
Chris D, Tottington
I've used Adepteo's services for the past 6 years and am extremely happy with the quality and friendly nature of all Adepteo team members.
Read on...
David Gartside, Forest Finance
Recommended fax and email services to me and they are excellent.
Read on...
Dovid J, Altrincham
We love the care and dedication of Carl and his team. We love the adaptability, flexibility and price of the systems We love everything about this wonderful telecoms business. I...
Read on...
Gary K, Bury, Manchester
I have found Adepteo to be a professional, creative telecoms company who have provided us with a fantastic service. I cant recommend highly enough. Thanks to Carl and all his team.
Read on...
Geri B, Bolton
I have found Adepteo to be a professional, creative telecoms company who have provided us with a fantastic service. I cant recommend highly enough. Thanks to Carl and all his team
Read on...
Ian B, Altrincham
Adepteo provided a complete solution to our specific requirements and the whole process from analysing our current procedures and systems to the final roll out of the finished...
Read on...
Matthew G, Bury, Manchester
Adepteo manage our VOIP and broadband services for our office. They provide a fast and efficient service to meet the changing demands of their customers. They are flexible, and...
Read on...
Matt S, Manchester
My experience with Adepteo is a positive one, the service was set up quickly and efficiently. The service and phones themselves provide me with numerous flexible benefits that...
Read on...
Paul E, Spain
We have been a customer of Adepteo since early 2005. Initially we worked with them to help create our online business UKCarAds.co.uk then as our business grew there voip based...
Read on...
Pete R, Warrington
Following a re-launch of our website, the number of enquiries we were receiving began to grow beyond our expectations. Our 2 BT phone lines could simply not cope with the level...
Read on...
Ross M, Bury, Manchester
Very helpful and responsive. Jargon-free high-tech phone solution for business. Up and running same day. Absolutely A1 service and product!
Read on...
Stephen T, Bury, Manchester
I can't tell you just how impressed I am with the Adepteo VOIP telephone system Carl Taylor installed for me. To explain it in simple terms, the Telephone looks like a...
Read on...
Steve M, Altrincham
Adepteo provide us with a real 'can-do' service. I love the fact that nothing is too much trouble. Calls are dealt with swiftly and effectively and all staff I speak to are...
Read on...
Tony T, Bury, Manchester
Carl has implemented telecoms in office premises for my clients who could not wait three weeks from BT. Carl installed a system the same day and my client did not loose one day...
Read on...