Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LARGE_INTEGER and QueryPerformanceCounter

This topic is 6608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!