PostNuke

Flexible Content Management System

News

How fast did that page load...?

Contributed by Anonymous on Jul 14, 2001 - 03:35 AM

Open your mainfile.php






Add this function :












function ss_timing_start ($name = 'default') {






global $ss_timing_start_times;






$ss_timing_start_times[$name] = explode(' ', microtime());






}












function ss_timing_stop ($name = 'default') {






global $ss_timing_stop_times;






$ss_timing_stop_times[$name] = explode(' ', microtime());






}












function ss_timing_current ($name = 'default') {






global $ss_timing_start_times, $ss_timing_stop_times;






if (!isset($ss_timing_start_times[$name])) {






return 0;






}






if (!isset($ss_timing_stop_times[$name])) {






$stop_time = explode(' ', microtime());






}






else {






$stop_time = $ss_timing_stop_times[$name];






}






$current = $stop_time[1] - $ss_timing_start_times[$name][1];






$current += $stop_time[0] - $ss_timing_start_times[$name][0];






return $current;






}


















and then open your footer.php






add this function:












$mtime2 = microtime();






$mtime2 = explode(" ",$mtime2);






$mtime2 = $mtime2[1] + $mtime2[0];






$endtime = $mtime2;






$totaltime = ($endtime - $starttime);












echo "This page was loaded in total time of $totaltime micro seconds
";












I know, I know, it's not so usefull, juz a fun hack for your postnuke site :)












I'll see what else i can do with php and post a new hacks , juz for fun, enjoy it guyz


704