Advertisement

LARGE_INTEGER and QueryPerformanceCounter

Started by April 16, 2000 10:50 PM
2 comments, last by paulcoz 24 years, 8 months ago
Is this process for getting the number of frames per second with QueryPerformanceCounter correct: QueryPerformanceFrequency(&timerfreq) main loop ( QueryPerformanceCounter(&start) ...put all loop code here... QueryPerformanceCounter(&end) framespersec = timerfreq.QuadPart / (end.QuadPart - start.QuadPart) ) (I know this will only give the fps for one frame but I can fix that later). The reason I would like to know is that I couldn''t find any information on the LARGE_INTEGER structure and don''t know exactly what the QuadPart value is or why it is used (or why the other parts of the LARGE_INTEGER are ignored!!). I got the QuadPart bits from other posts on this site. An explanation of LARGE_INTEGER would be helpful. Paulcoz.
Heres some MSDN stuff:

quote: The QueryPerformanceCounter function retrieves the current value of the high-resolution performance counter, if one exists.

BOOL QueryPerformanceCounter( LARGE_INTEGER *lpPerformanceCount
// address of current counter value

);



Parameters
lpPerformanceCount

Points to a variable that the function sets, in counts, to the current performance-counter value. If the installed hardware does not support a high-resolution performance counter, this parameter can be to zero.

Return Values
If the installed hardware supports a high-resolution performance counter, the return value is nonzero.

If the installed hardware does not support a high-resolution performance counter, the return value is zero.


quote: The LARGE_INTEGER structure is used to represent a 64-bit signed integer value.

typedef union _LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
};
LONGLONG QuadPart;
} LARGE_INTEGER;

Members
LowPart

Specifies the low-order 32 bits.

HighPart

Specifies the high-order 32 bits.

QuadPart

Specifies a 64-bit signed integer.

Remarks
The LARGE_INTEGER structure is actually a union. If your compiler has built-in support for 64-bit integers, use the QuadPart member to store the 64-bit integer. Otherwise, use the LowPart and HighPart members to store the 64-bit integer.
Advertisement
Thanks Zipster,

I don''t suppose you know what a LONGLONG is? Is it like a __int64 type or something?

Paulcoz.
Yeah, LONGLONG is 64-bit, kinda what youd expect if a LONG is 32-bit

This topic is closed to new replies.

Advertisement