Calculating average time

GregM gregm at
Thu Jul 7 22:31:34 CEST 2005

I'm hoping that someone can point me in the right direction with this.
What I would like to do is calculate the average time it takes to load
a page. I've been searching the net and reading lots but I haven't
found anything that helps too much. I'm testing our web site and hiting
+6000 urls per test. Here is a subset of what I'm doing.

import IEC
#IE controller from
from win32com.client import Dispatch
import time
import datetime
from sys import exc_info, stdout, argv, exit
failedlinks = []
links = open(testfile).readlines()
totalNumberTests = len(links)
ie = IEC.IEController()
start =
# asctime() returns a human readable time stamp whereas time() doesn't
startTimeStr = time.asctime()
for link in links:
        start =
        end =
        pagetext = ie.GetDocumentText()
        #check the returned web page for some things
        if not (, pagetext):
finised =
finishedTimeStr = time.asctime()
# then I print out results, times and etc.

1. Is there a better time function to use?

2. To calculate the average times do I need to split up min, sec, and
msec and then just do a standard average calculation or is there a
better way?

3. is there a more efficient way to do this?

4. kind of OT but is there any control like this for Mozilla or

This is not intended to be any sort of load tester just a url
validation and page check.

Thanks in advance.

More information about the Python-list mailing list