QueryPerformanceCounter not working properly - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


QueryPerformanceCounter not working properly


QueryPerformanceCounter isn't counting properly under WindowsXp.
under windows98 seems to work well.


  • AsmGuru62AsmGuru62 Posts: 6,519Member
    [color=Blue]So... where is the code?[/color]
  • jcpascal27jcpascal27 Posts: 30Member

    int main() {
    LARGE_INTEGER start,

    if (!QueryPerformanceFrequency(&cps)){printf("Err 1
    if (!QueryPerformanceCounter(&start)){printf("Err 2
    /* .
    . here comes the main program
    . */

    if (!QueryPerformanceCounter(&end)) printf("Err 3
    printf ("%.9f sec
    ",((float)(end.QuadPart-start.QuadPart)/(float) cps.QuadPart));

    return 0;

    according to QueryPerformanceCounter the program runs at the same speed on an Intel Celeron 333Mhz (running Win98) and on a Intel Peintum 4 3.0Mhz (running WinXp)

    if i test the program under DOS (not using QueryPerformanceCounter of course) it meassures 0.0004 Sec (on the intel pentium 4 processor)
    and on the other machine under DOS it measures 0.003 Sec while on the intel pentium 4 processor running windows XP it meassures 0.002Sec approximately the same time measured on the slower machine under win98

Sign In or Register to comment.