Borneq

CRC-32c from levelDB measure

Apr 19th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. unsigned int crc;
  2.   int SIZE=1000*1000;
  3.   char *bigbuf;
  4.   bigbuf = (char*)malloc(SIZE);
  5.   for (int i = 0; i < SIZE; i++)
  6.     bigbuf[i] = rand() % 256;
  7.   long long timeStart,timeEnd;
  8.   __asm {
  9.        rdtsc
  10.        mov dword ptr timeStart, eax
  11.        mov dword ptr timeStart+4, edx
  12.   }
  13.   crc = Value(bigbuf, SIZE);
  14.   __asm {
  15.        rdtsc
  16.        mov dword ptr timeEnd, eax
  17.        mov dword ptr timeEnd+4, edx
  18.   }
  19.   printf("time = %f %d",double(timeEnd-timeStart-96)/SIZE,crc);//96 for Intel Celeron,11 for Athlon
  20.   free(bigbuf);//3.4 ticks/byte on Celeron
Advertisement
Add Comment
Please, Sign In to add comment