Have you seen the google search? how long has it taken to search? here is a class that can count the script execution time.

Source: Internet
Author: User
SyntaxHighlighter. all (); news & nbsp; | & nbsp; Security & nbsp; | & nbsp; Forum & nbsp; | & nbsp; download & nb

Addmarker ("Start");} // end function start () // call this function stop () at the end of the script () {// See the addmarker function $ this-> addmarker ("Stop");} // end function stop () // This function is used to add a flag when the script is executed. // you need a name called function addmarker ($ name) {// call the jointime () function and set the microtime () $ markertime = $ this-> jointime (microtime (); // $ AE returns the size of the current array, that is, the current insert position // currently in the $ points array $ AE = count ($ this-> points ); // store timestamp and description in the array $ this-> points [$ AE] [0] = $ markertime; $ this-> points [$ AE] [1] = $ name;} // end function addmarker () // this function will process () returned string function jointime ($ mtime) {// decomposition string $ timeparts = explode ("", $ mtime); // connects two strings, and remove the decimal part 0 $ finaltime = $ timeparts [1]. substr ($ timeparts [0], 1); // return the connected string return $ finaltime;} // end function jointime () // this function simply displays the time required from the start to the end function showtime () {echo bcsub ($ this-> points [count ($ this-> points) -1] [0], $ this-> points [0] [0], 6);} // end function showtime () // This function displays all information collected during Script running. function debug () {echo "Script execution debug information:"; echo ""; // This table has three columns: Marker name, Timestamp, and difference echo"MarkerTimeDiff"; // The first line is the echo without running time difference" "; echo "". $ this-> points [0] [1]. ""; echo "". $ this-> points [0] [0]. ""; echo "-"; echo ""; // it is displayed cyclically starting from element 1 of the array, and 0 has been displayed for ($ I = 1; $ I <count ($ this-> points); $ I ++) {echo ""; echo "". $ this-> points [$ I] [1]. ""; echo "". $ this-> points [$ I] [0]. ""; echo ""; // display the time difference between the upper and lower rows echo bcsub ($ this-> points [$ I] [0], $ this-> points [$ i-1] [0], 6); echo ""; echo "";} echo "" ;}// end function debug ()} // End class PHP_timer?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.