Home > Backend Development > PHP Tutorial > Have you ever looked at Google's search? How much time did the search take? There is a class that can count script execution time. _PHP Tutorial

Have you ever looked at Google's search? How much time did the search take? There is a class that can count script execution time. _PHP Tutorial

WBOY
Release: 2016-07-13 17:29:06
Original
970 people have browsed it

addmarker("Start"); } // end function start() // Call this function at the end of the script function stop() { // Please see the addmarker function later $this->addmarker("Stop" ); } // end function stop() // This function is used to add a marker when the script is executed // It needs a name to describe function addmarker($name) { // Call the jointime() function and add microtime( ) is passed to $markertime = $this->jointime(microtime()); // $ae gets the size of the current array, which is the current insertion position // currently in the $points array $ae = count($ this->points); // Store timestamp and description in array $this->points[$ae][0] = $markertime; $this->points[$ae][1] = $name; } // end function addmarker() // This function will process the string returned from microtime() function jointime($mtime) { // Decompose the string $timeparts = explode(" ",$mtime); // Join two strings , and remove the 0 in the decimal part $finaltime = $timeparts[1].substr($timeparts[0],1); // Return the connected string return $finaltime; } // end function jointime() // This The function simply displays the time required from start to end function showtime() { echo bcsub($this->points[count($this->points)-1][0],$this->points[0][ 0],6); } // end function showtime() // This function displays all the information collected during the execution of the script function debug() { echo "Script execution debug information:"; echo " "; // This table has 3 columns Marker name, Timestamp, difference echo "MarkerTimeDiff "; // The first line is echo without running time difference " "; echo "".$this->points[0][1].""; echo "".$this->points[0][0].""; echo "- "; echo " "; // Loop display starting from element 1 of the array, 0 has been displayed in the first line for ($i = 1; $i points);$i++) { echo " "; echo "".$this->points[$i][1].""; echo "".$this->points[$i][0].""; echo ""; // Display up and down The time difference between the two lines echo bcsub($this->points[$i][0],$this->points[$i-1][0],6); echo ""; echo " "; } echo ""; } // end function debug() } // end class PHP_timer ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531715.htmlTechArticleaddmarker(Start); } // end function start() // Call this function at the end of the script stop() { // Please see the addmarker function later $this->addmarker(Stop); } // end function...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template