LWP::Parallel is not giving me the accesstime for each request

Discussion in 'Perl Misc' started by Leif Wessman, Jun 16, 2004.

  1. Leif Wessman

    Leif Wessman Guest

    Hi,

    I'm using the LWP::parallel package to connect to several websites at
    the same time. Now I would like to know how long time each request
    takes (inluding redirects). How can I find that information?

    I've tried the following but I can't get it to work. One problem is
    that I don't know how to access the variable from my main script. One
    other problem is that the accesstime is counted once per request, and
    it doesn't take into account the redirects:

    package MyUA;

    use Exporter();
    use LWP::parallel::UserAgent qw:)CALLBACK);
    @ISA = qw(LWP::parallel::UserAgent Exporter);
    @EXPORT = @LWP::parallel::UserAgent::EXPORT_OK;

    use Time::HiRes qw(gettimeofday tv_interval);

    my $start_time;
    my $end_time;
    my $accesstime;

    sub on_connect {
    my ($self, $request, $response, $entry) = @_;
    $start_time = [ gettimeofday ];
    }

    sub on_return {
    my ($self, $request, $response, $entry) = @_;
    $end_time = [ gettimeofday ];
    my $accesstime = tv_interval($start_time,$end_time);
    }

    1;
    Leif Wessman, Jun 16, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    523
  2. sixteenmillion

    The giving that keeps on giving

    sixteenmillion, Nov 19, 2007, in forum: C Programming
    Replies:
    0
    Views:
    425
    sixteenmillion
    Nov 19, 2007
  3. Zeke Koos
    Replies:
    0
    Views:
    195
    Zeke Koos
    Sep 15, 2003
  4. Alex
    Replies:
    0
    Views:
    202
  5. Leif Wessman
    Replies:
    0
    Views:
    63
    Leif Wessman
    Dec 2, 2004
Loading...

Share This Page