So I lay in bed last night after posting this and I guess putting my question out there made me think more about doing timing analysis. I browse through the perl cookbook often and wasn't there a module on hi-res timing? And I know there's a web user agent module...

So, I got up browsed through the cookbook and yes, what I thought would be non-trivial was actually kind of trivial:

#!/usr/local/bin/perl use strict; use LWP::Simple; use Time::HiRes; my $totalTime = 0; my $i; for ($i=0; $i < 20; $i++) { my $before = Time::HiRes::gettimeofday(); if ( !defined( my $content = LWP::Simple::get('http://chicodigita +l.com/cgi-bin/temp/webtool.cgi'))) { print "failed get\n"; } my $elapsed = Time::HiRes::gettimeofday() - $before; print "get $i in $elapsed seconds.\n"; $totalTime = $totalTime + $elapsed; } $totalTime = $totalTime / 20; print "Average response time for 20 requests was: $totalTime seconds.\ +n";

Hey, it works! Well, it's more a measure of the internet speed, but averaged, at least that would be a speed difference as perceived by the user. So I'll keep you posted on my finding here.

Thank you perlmonks, for making me think.

-alan


In reply to Re: CGI speed: one script versus many modules by alanraetz
in thread CGI speed: one script versus many modules by alanraetz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.