Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Re: [backdream] How to add a sub that can show forum load time?

Quote Reply
Re: [backdream] How to add a sub that can show forum load time? In reply to
Hi backdream,

You'll need to install the Time::HiRes module in order to do this - otherwise the best you can get is whole seconds - and even if you see "1 second" it could be anywhere from 0.00001 seconds to 1.999999 seconds. Hence, doing this without Time::HiRes is almost pointless.

You'll need to make the changes in gforum.cgi (I've done this from time to time for development/optimization purposes). Basically, add this line immediately after all the "use" statements in the file:

Code:
use Time::HiRes;


Then add this line immediately after "sub main {":

Code:
$GForum::Start::Time = Time::HiRes::time();


After that, you're going to have to add a global - called "time_elapsed", perhaps. Its contents will be:

Code:
sub { $GForum::Start::Time - Time::HiRes::time() }


Then, wherever you want to display the time, just put:

Code:
Time to load: <%time_elapsed%> s

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Subject Author Views Date
Thread How to add a sub that can show forum load time? backdream 14381 Oct 17, 2002, 5:01 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
Jagerman 13938 Oct 30, 2002, 11:51 AM
Thread Re: [Jagerman] How to add a sub that can show forum load time?
backdream 13980 Oct 30, 2002, 4:16 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
backdream 13979 Oct 30, 2002, 4:25 PM
Post Re: [backdream] How to add a sub that can show forum load time?
yogi 13956 Oct 30, 2002, 11:56 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
Alex 13964 Oct 31, 2002, 9:20 AM
Thread Re: [Alex] How to add a sub that can show forum load time?
backdream 13941 Oct 31, 2002, 4:00 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
Alex 13938 Oct 31, 2002, 4:01 PM
Thread Re: [Alex] How to add a sub that can show forum load time?
backdream 13912 Nov 3, 2002, 4:04 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
Paul 13934 Nov 3, 2002, 5:38 PM
Thread Re: [Paul] How to add a sub that can show forum load time?
backdream 13922 Nov 3, 2002, 8:28 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
Paul 13891 Nov 4, 2002, 2:52 AM
Thread Re: [Paul] How to add a sub that can show forum load time?
backdream 13926 Nov 4, 2002, 3:49 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
backdream 13941 Nov 4, 2002, 8:31 PM
Thread Re: [backdream] How to add a sub that can show forum load time?
Jagerman 13887 Nov 5, 2002, 4:58 PM
Thread Re: [Jagerman] How to add a sub that can show forum load time?
Franco 13824 Apr 2, 2003, 8:55 PM
Thread Re: [Franco] How to add a sub that can show forum load time?
Paul 13746 Apr 3, 2003, 12:35 AM
Thread Re: [Paul] How to add a sub that can show forum load time?
carfac 13727 Apr 3, 2003, 11:27 AM
Thread Re: [carfac] How to add a sub that can show forum load time?
Paul 13729 Apr 3, 2003, 11:42 AM
Thread Re: [Paul] How to add a sub that can show forum load time?
carfac 13771 Apr 3, 2003, 11:52 AM
Thread Re: [carfac] How to add a sub that can show forum load time?
Paul 13714 Apr 3, 2003, 1:41 PM
Thread Re: [Paul] How to add a sub that can show forum load time?
carfac 13622 May 24, 2003, 7:44 AM
Thread Re: [carfac] How to add a sub that can show forum load time?
Jagerman 13657 May 24, 2003, 2:35 PM
Post Re: [Jagerman] How to add a sub that can show forum load time?
carfac 1899 May 26, 2003, 3:29 PM
Post Re: [Franco] How to add a sub that can show forum load time?
Jagerman 13739 Apr 3, 2003, 11:14 AM
Post Re: [backdream] How to add a sub that can show forum load time?
CRUZN8R 13777 Apr 2, 2003, 12:20 PM