Re: Timer with Micro seconds
- From: "Andrew at Plextek (www.plextek.co.uk)" <ams@xxxxxxxxxxx>
- Date: Wed, 21 Nov 2007 08:10:27 -0800 (PST)
I can't see anything glaringly wrong with your code. Have you checked
the implementation of the performance counter? Why not try a simple
loop to see that it's running properly and generating sensible
values....
for( int i=0; i<10; i++ )
{
LARGE_INTEGER perfCntVal;
QueryPerformanceCounter( &perfCntVal );
printf("perfCntVal = 0x%08X%08X\n", perfCntVal.HighPart,
perfCntVal.LowPart);
Sleep(100);
}
Andrew.
On Nov 20, 10:25 am, Chandra <forquer...@xxxxxxxxx> wrote:
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.
.
- Follow-Ups:
- Re: Timer with Micro seconds
- From: Helge Kruse
- Re: Timer with Micro seconds
- References:
- Timer with Micro seconds
- From: Chandra
- Re: Timer with Micro seconds
- From: Andrew at Plextek (www.plextek.co.uk)
- Re: Timer with Micro seconds
- From: Chandra
- Timer with Micro seconds
- Prev by Date: Re: ClearCase + WINCE 5.0 = headache
- Next by Date: Re: ClearCase + WINCE 5.0 = headache
- Previous by thread: Re: Timer with Micro seconds
- Next by thread: Re: Timer with Micro seconds
- Index(es):
Relevant Pages
|
Loading