Re: Timer with Micro seconds



On Nov 20, 2:26 pm, "Andrew at Plextek (www.plextek.co.uk)"
<a...@xxxxxxxxxxx> wrote:
I've successfully used the performance counter at application level.
Andrew.


Hi Andrew,

Thanks for quick reply. I am able to configure the Performance
Counter, but my application is hanging when i try to use it. The code
which i am using is as below.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

LARGE_INTEGER liDelay;
// Query number of ticks per second
if (QueryPerformanceFrequency(&liDelay))
{
// 1ms delay
liDelay.QuadPart /= 1000;

LARGE_INTEGER liTimeOut;
// Get current ticks
if (QueryPerformanceCounter(&liTimeOut))
{
// Create timeout value
liTimeOut.QuadPart += liDelay.QuadPart;
LARGE_INTEGER liCurrent;
do
{
// Get current ticks
QueryPerformanceCounter(&liCurrent);
// Delay until timeout
} while (liCurrent.QuadPart<liTimeOut.QuadPart);
}
}

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

liDelay.QuadPart /= 1000; // for milli seconds divide by 1000
liDelay.QuadPart /= 1000; // for second divide by 1

The statement i am varying according to my requirement. But only thig
is when i am trying to get microseconds delay with this code, my
application is getting hanged and it is terminating itself. Any
suggestion from you will be a great help to me. Hope you understand my
problem.

With warm regards,

Chandra.
.



Relevant Pages

  • Re: Timer with Micro seconds
    ... the implementation of the performance counter? ... // Query number of ticks per second ... // Create timeout value ... // Delay until timeout ...
    (microsoft.public.windowsce.platbuilder)
  • Re: OpenOffice ridiculously slow to start on FC3
    ... > it is hanging up. ... The delay in starting is caused by ... > the timeout on all the connections. ...
    (Fedora)
  • Re: How to ping in Python?
    ... > # Changed the struct.packcalls to pack the checksum and ID as ... > def receiveOnePing(mySocket, ID, timeout): ... > # Returns either the delay or none on timeout. ...
    (comp.lang.python)
  • Re: setTimeout only delays first time in loop
    ... I incremented the delay for each iteration and it worked. ... put it in a loop and set 20 timeouts - think about it: ... The way I figured, my original timeout said "delay 700ms, ... then execute the named function," then after funtest is ...
    (comp.lang.javascript)
  • Re: select & gettimeofday
    ... >> There is no bug, and in fact you cannot tell, in a user process, ... timeout is the approximate amount ... The measured delay was 1.00 milliseconds ...
    (comp.os.linux.development.system)