Cpu speed without rdtsc
- From: Wojtek <spamtrap@xxxxxxxxxx>
- Date: Sat, 11 Nov 2006 13:34:24 +0100
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
.
- Follow-Ups:
- Re: Cpu speed without rdtsc
- From: Sebastian Biallas
- Re: Cpu speed without rdtsc
- From: Mark Jones
- Re: Cpu speed without rdtsc
- Prev by Date: CPU speed without rdtsc
- Next by Date: Re: Convert 8 bytes to 8 bits?
- Previous by thread: Re: CPU speed without rdtsc
- Next by thread: Re: Cpu speed without rdtsc
- Index(es):
Relevant Pages
|
|