×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to Measure the Time to Load a Page?

How to Measure the Time to Load a Page?

How to Measure the Time to Load a Page?

(OP)
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.

RE: How to Measure the Time to Load a Page?

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.

RE: How to Measure the Time to Load a Page?

(OP)
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?

RE: How to Measure the Time to Load a Page?

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.
http://www.oac-design.com

RE: How to Measure the Time to Load a Page?

(OP)
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

RE: How to Measure the Time to Load a Page?

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.
http://www.oac-design.com

RE: How to Measure the Time to Load a Page?

(OP)
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

RE: How to Measure the Time to Load a Page?

That sounds very useful.  Can I get a copy?


Sincerely,
 
Tom Anderson
CEO, Order amid Chaos, Inc.
http://www.oac-design.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close