4 // gives access to the Pentium's (secret) cycle counter
6 // This software was written by Leonard Janke (janke@unixg.ubc.ca)
7 // in 1996-7 and is entered, by him, into the public domain.
9 #if defined(__WATCOMC__)
10 void GetTSC(unsigned long&);
11 #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12 #elif defined(__GNUC__)
14 void GetTSC(unsigned long& tsc)
16 asm volatile(".byte 15, 49\n\t"
21 #elif defined(_MSC_VER)
23 void GetTSC(unsigned long& tsc)
35 #include <openssl/md5.h>
38 void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num);
41 void main(int argc,char *argv[])
43 unsigned char buffer[64*256];
45 unsigned long s1,s2,e1,e2;
47 unsigned long data[2];
56 if (num > 250) num=16;
63 for (i=0; i<10; i++) /**/
65 md5_block_x86(&ctx,buffer,numm);
67 md5_block_x86(&ctx,buffer,numm);
70 md5_block_x86(&ctx,buffer,num);
72 md5_block_x86(&ctx,buffer,num);
74 printf("md5 (%d bytes) %d %d (%.2f)\n",num,
75 e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);