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 Member Posts: 6,519
    [color=Blue]So... where is the code?[/color]
  • jcpascal27jcpascal27 Member Posts: 30

    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.