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

L

Leif Wessman

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;
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top