Cpu speed without rdtsc



Hi there!
I'm new here, so sorry if the question has appeared once :-)
I have to chceck speed of my CPU without using rdtsc. I wrote such code:
int _tmain(int argc, _TCHAR* argv[])
{
long long ile_operacji = 1000000000;
SYSTEMTIME st;
SYSTEMTIME st2;
GetSystemTime(&st);

// for(long i = 0; i < 1000; i++)
__asm{
mov ebx, 1000
start1:
mov ecx, 10000
start2: //jest 100!
nop
nop
nop
.
. //100 times
.
nop
dec ecx
cmp ecx,0
jne start2

dec ebx
cmp ebx, 0
jne start1
}


GetSystemTime(&st2);
long long beg = st.wMilliseconds + 1000*(st.wSecond + 60*(st.wMinute+60*st.wHour));
long long end = st2.wMilliseconds + 1000*(st2.wSecond + 60*(st2.wMinute+60*st2.wHour));
printf("%1I64d\n",ile_operacji*1000);
printf("%1I64d\n",(end-beg));
printf("%1I64d",ile_operacji*1000/(end-beg));
system("PAUSE");
return 0;
}

but it shows far to high results (about 3,8GHz while I have only 2,4Ghz). Moreover i think that it should show far less than 2GHz because nop's can't be pipelined (as I think). Mayby You could improve my code or show me another tests tahat omit all such things as pipeline, 3dNow! SSE, SSE2 etc. I need "blank" timer frequency, not being darkened by all the stuff since Pentium. I hope that someone can help me.
Thanks,
Wojtek

.



Relevant Pages

  • Re: stricmp
    ... > begin stricmp; ... > push(ebx); ... > rdtsc(); ...
    (alt.lang.asm)
  • [TOOL] Simple EGG (Example)
    ... add EBX, 104 // avoid NULL ... mov ECX, FPUTS ... int main(int argc, char* argv) ...
    (Securiteam)
  • CPU speed without rdtsc
    ... mov ebx, 1000 ... Mayby You could improve my code or show me another tests tahat omit all such things as pipeline, ...
    (comp.lang.asm.x86)
  • Re: ellusive consing with multiple-values
    ... 59: MOV EBP, EBX ... 65: MOV EBX, ESP ... 9A: NOP ...
    (comp.lang.lisp)
  • Re: ARM926EJ-S MMU Problem in WinCE5.0
    ... I am no sure how deep the prefetch piece fo rthe pipeline is - I think 3 instructions but I put an extra NOP to be safe. ... grab it now in case multiple instructions are used ... mov pc, r0 ...
    (microsoft.public.windowsce.platbuilder)