in reply to Re^2: Using LWP: is there a way to get the server response time?
in thread Using LWP: is there a way to get the server response time?

OK, do a:
locate Protocol/http.pm
or similar to find where your LWP::Protocol::http module lives. Mine is in /usr/share/perl5/LWP/Protocol/http.pm. Search for the request() subroutine. Add these lines up at the top of it:
use Time::HiRes qw(time); my @times;
Add a line containing "push @times, time();" before the following three lines:
if ($has_content) { block, ... $response = $self->collect($arg, $response, sub { ... unless ($drop_connection) {
and then add this at the bottom:
warn "wrote-request read-headers read-content\n@times\n";
If this is anything but a quick hack, it might be better to subclass or otherwise hook into LWP::Protocol::http to make it more maintainable. Another approach would be to just do a HEAD and then a GET, with the difference in times being the content-transfer time.

Replies are listed 'Best First'.
Re^4: Using LWP: is there a way to get the server response time?
by ericsully (Initiate) on Apr 29, 2010 at 15:20 UTC