Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to calculate a webpage load time using perl? 1

Status
Not open for further replies.

rcsen

Programmer
Jan 11, 2001
51
US
Hi ,
I am new to perl. Could you please suggest me,how to find the the total time for a particular webpage to load?
Any help is appreciated. Thanks.

Sincerely,
Senthil
 
Hi,

I am sorry, I don't have permission to install Time::HiRes
So I thought of integrating a java code inside perl. Is it possible to do that? The code is:#!/usr/local/bin/perl

use LWP::Simple;

$url = '
# JAVA COMMAND LINE THAT I HAD DONE FOR GETTING TIME IN MILLISECONDS
$started = `java date`;

print "Started: $started\n";

$content = get($url);
print "Got content\n";

while ($content =~ /<IMG.*?SRC=&quot;(.*?)&quot;/gis)
{
print &quot;Getting $1\n&quot;;
get($1);
}

#######
$stopped = `java date`;
print &quot;Stopped: $stopped\n&quot;;
$elapsed = $stopped - $started;
print &quot;Elapsed: $elapsed\n&quot;;


Java Code:

class date
{
public static void main(String args[]) throws Exception
{
System.out.println((new java.util.Date()).getTime());
}
}


Could you please suggest me, how to go about?

Sincerely,
RCSEN
 
Hi,
Thanks all for spending your precious time for me. I got Time::HiRes installed and the result was really great wherein it gives upto microseconds.
But as usual I have a question. Can you integrate a JAVA CODE inside PERL.

Thanks.
RCSEN
 
not without compiling it.. you'd have to compile it then run it from your program via system() or ``. i'm sure there are other ways to run it also, but not from directly inside your perl code. adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top