473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Odd statistical results when measuring time to get a WebResponse

I am currently doing some CS research that requires to collect some "web
page retrieval latency" statistical data. Basically I have a list of URLs,
and I want to measure the retrieval time of those URLs. So far, it seems
very simple to do :

<code>
DateTime beforeCall = DateTime.Now;
myHttpRequest.GetResponse();
DateTime afterCall = DateTime.Now;
</code>

At the end, the delays are measured in millesecond, and my code is working
(both on .Net and with Mono). What is bothering me are the results : 80% of
the millisecond time measures with .Net ends up with zeros (like 80ms, 90ms
....). With Mono, the results are more "randomly" distributed.

My question is "Why 80% of the time do I get a rounded result with .Net ?".
I would understand a 100% case (always rounding), a 10% case (uniform
probability), but this 80% is very weird.

Do anyone has an idea about it ?

Thanks,
Joannes
Nov 16 '05 #1
1 1335
Ok I think I figured out the problem, looking at
http://www.eggheadcafe.com/articles/20021111.asp

" The reason is because of the thread context switch process, the
DateTime.Now value has a resolution of 16 milliseconds or thereabouts on
most machines." (citation)

My next question is how do I manage to get a precise counter from within
..Net without having to pass through QueryPerformanceCounter ?

Joannes
"Joannes Vermorel" <fi*******@lastname.com> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
I am currently doing some CS research that requires to collect some "web
page retrieval latency" statistical data. Basically I have a list of URLs,
and I want to measure the retrieval time of those URLs. So far, it seems
very simple to do :

<code>
DateTime beforeCall = DateTime.Now;
myHttpRequest.GetResponse();
DateTime afterCall = DateTime.Now;
</code>

At the end, the delays are measured in millesecond, and my code is working
(both on .Net and with Mono). What is bothering me are the results : 80% of the millisecond time measures with .Net ends up with zeros (like 80ms, 90ms ...). With Mono, the results are more "randomly" distributed.

My question is "Why 80% of the time do I get a rounded result with .Net ?". I would understand a 100% case (always rounding), a 10% case (uniform
probability), but this 80% is very weird.

Do anyone has an idea about it ?

Thanks,
Joannes

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Anand Natrajan | last post by:
Hi! I have a VB .NET client that is accessing an rpc/encoded service deployed in Axis 1.2. One of the operations, whoami, returns a string array. The server-side Java signature of this method is...
2
by: gizmo | last post by:
Hi, I'm using the following code to request the html source from the quoted site. ...... string url = "http://www1.soccerstand.com/"; WebRequest webRequest = WebRequest.Create(url);...
74
by: Dominik Wallner | last post by:
Hi! I'm currently implementing a program which measures voltages through an external USB-AD-converter. It should output those values as time/voltage pairs. My problem is to measure the time...
9
by: Tim Cowan | last post by:
Hi, I put this code in a windows forms app for testing. The IP values are both correct. It works the first time, the second time but at the third time it fails with timeout... I have it running...
7
by: Steven D'Aprano | last post by:
I have two code snippets to time a function object being executed. I expected that they should give roughly the same result, but one is more than an order of magnitude slower than the other. ...
74
by: aruna.mysore | last post by:
Hi all, I have a simple definitioin in a C file something like this. main() { char a; ....... int k; }
1
by: dbpokorny | last post by:
Hi, In a typical heavy-use python application (say running Zope for dukehealth.org) what is the (statistical) distribution of the the size of objects? (i.e. start up server, stop time when it...
1
by: David | last post by:
I have the following two button click procedures to retrieve html code from web sites. The code for Button1 seems to work fine. Button2 works fine for http://yahoo.com but not for...
4
by: Talbot Katz | last post by:
Greetings Pythoners! I hope you'll indulge an ignorant outsider. I work at a financial software firm, and the tool I currently use for my research is R, a software environment for statistical...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.