Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Search Timer

Quote Reply
Search Timer
Well I had what I thought was a good idea but I am having a bit of trouble (as usual) so some tips would be appreciated....

I am trying to time searches and then show the time taken on the search results page.

So...I thought Id start by adding this code to search.cgi...

sub _time_start {
# ------------------------------------------------------------------
# Start a timer.
#
BEGIN { local $@; eval { require Time::HiRes; import Time::HiRes qw/time/; }; }
$TIME_START = time;
}


...then I thought I'd add _time_start(); in sub main. I then gave it a test by searching for anything but it gave me an internal server error. So I removed _time_start(); from sub main and tested again but I still got the error.

If that had worked I was planning on adding...

sub _time_display {
# ------------------------------------------------------------------
# Return time results.
#
my $end = time;
my $elapsed = sprintf ("%.2f", $end - $TIME_START);
return $elapsed;
}


...as a global called <%time%>, so that when I added <%time%> to search_results.html, it would tell me how long the search had taken.

What am I doing wrong?...both chunks of code are taken straight from nph_build.cgi so the syntax is correct!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Subject Author Views Date
Thread Search Timer Paul 7003 Dec 26, 2000, 5:45 PM
Thread Re: Search Timer
pugdog 6885 Dec 26, 2000, 9:35 PM
Thread Re: Search Timer
Paul 6866 Dec 27, 2000, 4:32 AM
Thread Re: Search Timer
pugdog 6867 Dec 27, 2000, 4:54 AM
Thread Re: Search Timer
Paul 6855 Dec 27, 2000, 5:00 AM
Thread Re: Search Timer
pugdog 6869 Dec 27, 2000, 5:02 AM
Thread Re: Search Timer
Paul 6866 Dec 27, 2000, 5:05 AM
Thread Re: Search Timer
Alex 6854 Dec 27, 2000, 12:46 PM
Post Re: Search Timer
Paul 6828 Dec 27, 2000, 12:51 PM
Thread Re: Search Timer
Paul 6853 Dec 27, 2000, 12:57 PM
Thread Re: Search Timer
Alex 6831 Dec 27, 2000, 1:05 PM
Thread Re: Search Timer
Paul 6904 Dec 27, 2000, 1:37 PM
Thread Re: Search Timer
Alex 6851 Dec 27, 2000, 2:52 PM
Thread Re: Search Timer
Paul 6882 Dec 27, 2000, 2:56 PM
Thread Re: Search Timer
Alex 6855 Dec 27, 2000, 3:04 PM
Post Re: Search Timer
Paul 6832 Dec 27, 2000, 3:08 PM
Post Re: Search Timer
Paul 6812 Dec 27, 2000, 3:13 PM
Thread Re: Search Timer
Paul 6834 Dec 27, 2000, 3:37 PM
Post Re: Search Timer
Paul 6843 Dec 27, 2000, 3:51 PM
Post Re: Search Timer
Paul 6838 Dec 27, 2000, 4:25 PM
Post Re: Search Timer
Paul 6835 Dec 27, 2000, 5:13 PM
Post Re: Search Timer
Paul 6863 Dec 27, 2000, 3:29 PM