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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Measure the Time to Load a Page?

Status
Not open for further replies.

survivorjoe

Technical User
Dec 6, 2000
26
US
I have the need to test how long it takes to load a page and the related graphics and java apps that may be included. Think of it as measuring how long it takes for the "Done" message to appear on a browser. I can take time measurements at the stop and start of the process using the perl "time" command, but I need a tool to do the process. I have used "URL2FILE" but it only grabs the HTML of the page and not the graphics. Also, if it is a frames page, it only loads the main fraim page and not the subframes, like a browser would.

Does anyone know of a tool that can accept a URL and go through the motions of loading the page and providing a response code so I can measure the time it took to load?

Thanks.
 
once you grab the file, you could parse through it looking for src attributes:

foreach $file (@file)
{
if($file =~ /src="?(.+?)"?/)
{
grab that file also.
}
}

which would give you approximately the same amount of time it would take for the page to load.
 
Yes, but graphics don't load in series necessarily. If you look at the sample chart at keynote.com, a service that does this for a whopping fee, some of the graphics start loading ad different times, with overlap.

Any other ideas?
 
Use JavaScript. Set a variable to the time at the very beginning, then document.onload take the difference. Pass it back to your Perl script if necessary by setting the document.location variable.

You can't do it entirely server-side unless you fork to a browser on your server. Also, it will be very different depending on many variables including bandwidth, processor speed, ram, browser version, et cetera.

The client-side script is the best way. Try that forum for more info on how to do that.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
For comparison purposes, I need to also measure the load times for a few of our competitors' pages, so I can't put javascript on them. I assume this is what you meant - to put some code on my page being tested. Correct?

Any other suggestions?
-Joe
 
So put your javascript code in one frame and open the external page in another. In frame1, set your time variable, then launch the other frame. frame2.document.onload, compare the difference. Then set top.document.location=yourscript.pl?time=difference.

Go to the JavaScript forum for more details on how to make this work.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
I used the idea of the "onload" function to make my application work. I now have the app running that grabs one of 6 test pages (4 of our own, plus 2 of our competitor's), measures the load time, then passes the time and a file ID to a perl script that writes it to a file and generates the html for the next frame set to test the next URL. After it tests the 6 pages, the perl script goes to sleep for 10 minutes, then starts over. A companion script takes the daily data file and generates a timeline graph of the hourly load time averages of the 6 URLs, a historgram of the load times of our main site, and a bar chart comparing the average load times of the 6 URLs.

Even though my final result is different from what you suggested, you did send me in the right direction! Thanks for taking your time to read about my problem.

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top