Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned int crc;
- int SIZE=1000*1000;
- char *bigbuf;
- bigbuf = (char*)malloc(SIZE);
- for (int i = 0; i < SIZE; i++)
- bigbuf[i] = rand() % 256;
- long long timeStart,timeEnd;
- __asm {
- rdtsc
- mov dword ptr timeStart, eax
- mov dword ptr timeStart+4, edx
- }
- crc = Value(bigbuf, SIZE);
- __asm {
- rdtsc
- mov dword ptr timeEnd, eax
- mov dword ptr timeEnd+4, edx
- }
- printf("time = %f %d",double(timeEnd-timeStart-96)/SIZE,crc);//96 for Intel Celeron,11 for Athlon
- free(bigbuf);//3.4 ticks/byte on Celeron
Advertisement
Add Comment
Please, Sign In to add comment