Hi, can anybody tell me what do they mean with QueryPerformanceCounter and QueryPerformanceFrequency? And also, what are they implemented for? Thanks in advance.
Hi, can anybody tell me what do they mean with QueryPerformanceCounter and QueryPerformanceFrequency? And also, what are they implemented for? Thanks in advance.
Last edited by g4j31a5; 07-20-2008 at 09:55 PM. Reason: Typo
ERROR: Brain not found. Please insert a new brain!
“Do nothing which is of no use.” - Miyamoto Musashi.
I've read the MSDN but I still can't figure out the use of them in real application. I mean, it's basically similar to the "time.h" functions. So, what are they actually used for? As of now, the only time I use them is in some kind of timeout mechanism. I chose them because I figured it's from Microsoft and I'm programming for Windows so maybe it's better to use it than "time.h". Or maybe I'm wrong. CMIIW.
EDIT: BTW, I also didn't quite understand the part of MSDN that said: "high-resolution performance counter." It's so vague IMHO.
Last edited by g4j31a5; 07-21-2008 at 05:31 AM.
ERROR: Brain not found. Please insert a new brain!
“Do nothing which is of no use.” - Miyamoto Musashi.
Why do you ask? I'm sure there are HUNDREDS of Windows API calls that I've never heard of or used.
But to answer your question: It gives better precision than clock() or time(). The frequency would be at the very least above 1MHz, it may be as high as GHz. It is also different from clock() in that it counts wallclock time, not CPU time - this may be good or bad, depending on what you want to do.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Well, I'm working on Torque Game Engine right now and I see some calls of the functions in the source code. So I figured maybe I need them if I intend to make my own engine in the future. And I was just curious, that's all. I'm still new in the Windows programming myself.
Thanks a lot guys.
ERROR: Brain not found. Please insert a new brain!
“Do nothing which is of no use.” - Miyamoto Musashi.
Windows's buggy clock() actually measures wall time, if I remember correctly.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.