Best technique to test webpage load times in a console or service application

I've tried using the httpwebrequest/response but that will only give me a TTFB response time.  What are the best object, or techniques to use to measure page load times?
Nobletucky2004Asked:
Who is Participating?
 
mjmarlowConnect With a Mentor Commented:
How about something like this-

System.Net.WebClient client = new System.Net.WebClient();
DateTime start = DateTime.Now;
stream = client.OpenRead("http://www.experts-exchange.com");
sr = new System.IO.StreamReader(stream);
sr.ReadToEnd()
DateTime end = DateTime.Now
sr.Close();
stream.Close();


If you need higher resolution timer see:
http://www.eggheadcafe.com/articles/20021111.asp

0
 
mjmarlowCommented:
Is this for ASP.Net page?
0
 
Nobletucky2004Author Commented:
No, I'm running a windows services to try and monitor sites storing results in a Db.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Nobletucky2004Author Commented:
I tried running the WebBrowser class in the service (currently a console app) but I ran into threading errors.
0
 
Nobletucky2004Author Commented:
I agree that would give me the TTFB but it doesn't take into account all references files (i.e. Image, css, js, etc).  I currently have the same logic you posted, looking for a way to actually get a more accurate load time based on full page & Ref items loaded.
0
 
mjmarlowCommented:
BTW - Actual browser page load time will vary based on HTML content and browser/ browser version used.  This is because different technologies parse and load the HTML/CSS/javascript etc.... differently.
0
 
Nobletucky2004Author Commented:
I totally agree with you, just looking for a relative load time by mimicing atleast one browser, namely IE v 5 or 6.  The only other approach I could think of was parsing the HTML for ref/link tags and making additional requests for the header information for the additional objects and just reading the byte size which I can than interpret at being a specific load time based on different connection speeds.  But if I had a way to mimic the total load of page like IE atleast I have some proof of time as opposed to completely derived values.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.