473,811 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.G etResponse();
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 1351
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 QueryPerformanc eCounter ?

Joannes
"Joannes Vermorel" <fi*******@last name.com> wrote in message
news:eB******** ******@tk2msftn gp13.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.G etResponse();
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
2208
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 String whoami(MyPrincipal principal) My .NET client is unable to access the results of that array. The odd thing is that the very same client was able to access the results when the same service was deloyed in Axis 1.1. I've asked the Axis folks...
2
9710
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); WebResponse webResponse = webRequest.GetResponse(); beginStr = new StreamReader(webResponse.GetResponseStream(),
74
7773
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 to output (time elapsed since program start would do just fine) - it should be as precise as possible, as there may be only differences in milliseconds between two measurements.
9
2059
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 here AND in a service with a 30 minute interval. 1. Am I doing this correclty? Is there a better way to go to a URI and pass a couple of variables?
7
1170
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. Here are the snippets: def timer1(): timer = time.time func = lambda : None itr = * 1000000
74
4615
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
1047
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 has been under load for a few hours, and put each object into a bucket marked with the number of bytes it is allocated, and maybe labeled with object type, say dict, list, other). Does anyone know of any research on this? I would do this myself,...
1
1126
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 http://groups.google.com. When trying the Google site, iContentLength is -1 after it is set to myResponse.ContentLength. Any ideas why? If I uncomment the lines in Button2's event handler then that part of it will work with Google's site, using the same...
4
3079
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 computing and graphics. R is designed with matrix manipulation in mind, and it's very easy to do regression and time series modeling, and to plot the results and test hypotheses. The kinds of functionality we rely on the most are standard and...
0
9728
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9205
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.