473,899 Members | 3,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

timer in milliseconds


can anybody give me a piece of code , or a hint , how i can recieve the
time i need for connect() to another host in milliseconds.

My problem is i want test the performance of ipsec, so i need the
time in milliseconds, how long it takes to connect to another host
over ipsec.

1) i tried clock() but clock() don't work, because connect() don't use
cpu time like sleep(), so i always get 0 milliseconds, but the
connect takes about 2 seconds (i test this with a sniffer) .

is the any way to get the time in milliseconds ????

thanks a lot and best regards, stefan
Posted via http://dbforums.com
Nov 13 '05
11 14599

"Randy Howard" <ra**********@F OOmegapathdslBA R.net> wrote in message
news:MP******** *************** *@news.megapath dsl.net...
In article <2Unnb.46121$Tr 4.103510@attbi_ s03>, ga*@ugcs.caltec h.edu
Certainly it us up to the user to understand the system in use.

I have used rdtsc on a SMP system, without considering the problems that it might cause. As well as I remember it, it worked fine, but I can see that it could cause problems.

The problem is that the tsc data is not synched between CPUs, meaning that
your results are only accurate as long as your process (or thread) is
pinned to a specific CPU. That's usually not the case (nor ideal).

I have a post to comp.sys.intel to see if anyone there knows. I know TSC
is zero at reset, and if all leave reset at the same time, they may be
synchronized. I will see if anyone answers there.

The one time I did it on a four way SMP machine was in Java, using a JVM
native method, which means C. I took a simple C program, compiled it
with -S, modified the result with an RDTSC instruction, assembled it, and it
pretty much worked. I didn't need nanosecond resolution, but millisecond
may not have been good enough. There are enough problems with the way Java
native method calls not to worry too much about the SMP problem.

I will see what they say on comp.sys.intel, though. I have a dual 350MHz P2
system at home, but I never tried it on that one.

-- glen
Nov 13 '05 #11
In article <hyAnb.51086$Tr 4.105803@attbi_ s03>, ga*@ugcs.caltec h.edu
The problem is that the tsc data is not synched between CPUs, meaning that
your results are only accurate as long as your process (or thread) is
pinned to a specific CPU. That's usually not the case (nor ideal).

I have a post to comp.sys.intel to see if anyone there knows. I know TSC
is zero at reset, and if all leave reset at the same time, they may be
synchronized. I will see if anyone answers there.

Been there done that. The folks I asked at Intel admit that is the case.
It's probably documented as such formally. I believe it was discussed
recently on the threading forum at Intel's website and verified as
unreliable" by Intel employees there. It has certainly been discussed in
plenty of places. Please let me know if you get a different answer, but I
have seen it give erratic results (I.e. negative tsc differences inside of
wraparound times) due to TSC skew between processors. You may need to
have a lot of dynamic load on the box such that the scheduler is moving
processes around between CPUs before it becomes obvious.

Randy Howard _o
2reply remove FOOBAR \<,
_______________ _______()/ ()_____________ _______________ _______________ ___
SCO Spam-magnet: po********@sco. com
Nov 13 '05 #12

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

Similar topics

by: laurenq uantrell | last post by:
I have been using the following function to test the speed of various functions, however, quite often the return value is zero. I'm hoping someone can help improve on this. Function TimeIt() As Single On Error GoTo CodeErr 'PURPOSE: Times a process in seconds from start to finish 'USAGE: msgbox TimeIt Dim sngStart As Single
by: Jeroen CEuppens | last post by:
Hi, I want to have a timer that counts how long it takes to draw 2 bitmap files...... I use the compact framework, so I haven't got System.Timers Please help me... Greetz JC
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null; Let's declare a constant Int32 m_TimePeriod = 10000;
by: Noozer | last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is enabled, and that the interval is low (4000, which should be 4 seconds). To ensure the timer wasn't being inadvertantly reset I put some extra code in the subs that enable and disable the timer. They fire as expected. To test this I added a second timer with a 1 second interval. The event for this time would output the enabled status of the first timer and its...
by: Philip Wagenaar | last post by:
Hello, I am using a timer object in my Windows Forms Application. Does the code in ..elapsed event run in a diffrent thread? If the interval is set to 10 milliseconds and the time to execute the code in the .elapsed event takes 1 secocond to complete, what happens? 1) Timer starts. 10 milliseconds later the code is executed and timer stops. When code is done, 1 seconds later, the timer continues. 10 milliseconds later the code is...
by: martin1 | last post by:
Hi, All, My question is how to set up timer start 15 sec past minute. It always start 15 sec past minute. For example, if current time is 8:30:45, the timer starts on 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15; if current time is 8:55:15, the timer starts on 8:55:15, if current time is 8:59:00, the timer starts on 8:59:15 ..., so the timer always starts 15 seconds past minute, can anyone help this out?
by: igor | last post by:
I have recently discovered that the system.Timers.Timer from.Net Framework v1.1 is not reliable when used on Windows 2003 server. When incorporated into a Windows Service, the timer_elapsed event will stop executing after 30 to 40 days. After learning this, I found the same issue had been documented in the the System.Threading.Timer class as well. This limits my options for having a timer based windows service using the .net framework....
by: jeffbroodwar | last post by:
please help me get the system's time (with milliseconds) i need it to calculate the Soap request and response time in my SOAP project. i tried to use timer but the problem is, whenever i'm invoking a method.... the timer gets stuck along with the process, meaning it always returns .01 millisecond...... timer hangs with my pc..... i need to get the system time (with milliseconds) before and after calling the webservice then compute for the ...
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
1. What is a difference between System.Windows.Forms.Timer and System.Threading.Timer ? 2. How does it work? How is elpasing time counted? I.e interval is set to 10ms and a timer starts working - elapsing time is being counted. When it takes 10ms the tick event is raised. When the new time is being started to count? When the tick event starts or ends? I mean what is happening when the procedure raised on the tick event takes longer or...
by: missshaikh | last post by:
Hi all, i need the count down timer when button click the timer start and count down work on ASP.net :( i have one timer which is on JavaScript that run page onload . but i need the Button click my code is here... <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
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...
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,...
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...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.