I think they are time to generate page not load it.
easy
get system time at start of script.
do script
get system time at end
minus one from the other
print page generation .....ms
code depends on the language you use
Hi all,
I was wondering if there is a script that would show loading times. You know how some webpages/scripts show at the bottom "Loaded in 0.0512 secs" or something like that. How would I go about implementing something like that?
Thanks![]()
This would work for Perl and PHP:
Code:$start_time=time(); # script here $end_time=time(); print "Generated in ".($end_time-$start_time)." seconds";
thanks very much for your help...
I've added it too!Originally posted by Dusty
This would work for Perl and PHP:
Code:$start_time=time(); # script here $end_time=time(); print "Generated in ".($end_time-$start_time)." seconds";
But how about 3 decimals? is it something with printf?
If so,.. could you please give an example
This is for perl:
There are more options for Benchmark, this is just one way of using it.Code:use Benchmark; my $startBenchmark = new Benchmark; ... your regular code here ... my $endBenchmark = new Benchmark; my $timeDiff = timediff($endBenchmark,$startBenchmark); print "Took:" . timestr($timeDiff) . "\n\n";
-mk
atlascgi.com
I tested it,.. got info about CPU too!
I only want time with 3 decimals
please
yes I would like to know how to do this too...
thanks again for all the help..
- fury
anybody ?
That's what I already posted before. Could you please give an example?Originally posted by findftp
I've added it too!
But how about 3 decimals? is it something with printf?
If so,.. could you please give an example
you mean it's giving you like 3.4680723723572345?
well make an integer $n = $timeseek * 1000 % 1000
then make a float $f = $n / 1000 + 0.000
the poster formerly known as needcgispace - NOTHING!
Obsidian Hosting Networks - Head Admin - Changing the way you play the game.
URL: http://www.obhost.net/
IRC: irc.gamesurge.net/obhost
but is there a builtin way or function to do this?
- fury
i wouldn't know. i'm an idiot.
the poster formerly known as needcgispace - NOTHING!
Obsidian Hosting Networks - Head Admin - Changing the way you play the game.
URL: http://www.obhost.net/
IRC: irc.gamesurge.net/obhost
This is what I use now. But the script tells me everytime that it took 0.295 seconds.
What's wrong?
This is the code
Code:use Benchmark; my $startBenchmark = new Benchmark; ##### rest of the script ##### my $endBenchmark = new Benchmark; my $timeDiff = timediff($endBenchmark,$startBenchmark); $n = ($timeDiff * 1000 % 1000); $f = ($n / 1000 + 0.000); $gtime = "<font size=\"-2\">Searched for: $f seconds</font>\n\n";
Bookmarks