Murcia has asked for the wisdom of the Perl Monks concerning the following question:

Hi Confreres,

I have a CGI script that needs some time to generate the output. I want to follow the process time in the html output the program needs in each module or subroutines to later improve the code.

What is the best way to do so?

Yours

Murcia

Replies are listed 'Best First'.
Re: cgi process time
by marto (Cardinal) on Oct 31, 2005 at 09:00 UTC
Re: cgi process time
by Delusional (Beadle) on Oct 31, 2005 at 10:30 UTC
    You could use the Time module. How you actually use it, is your choice. Here is a generic example:
    use Time::Local; my $StartTime = time(); print "Doing nothing but waisting time....\n"; for ($i = 0; $i < 10000000; $i++) { } $EndTime = time(); print "Waisted: ". ($EndTime - $StartTime) ."s\n";
      granular time is better for web app benchmarking:
      use Time::HiRes qw(time); my $bench = time; handle_request(); printf 'Code took %.4f seconds', time - $bench;
Re: cgi process time
by stonecolddevin (Parson) on Oct 31, 2005 at 21:54 UTC
A reply falls below the community's threshold of quality. You may see it by logging in.