#include #include /*asm volatile("cpuid" : : : "eax", "ebx", "ecx", "edx");\*/ #define rdtscll(high, low) \ do { \ asm volatile("rdtsc\n" \ "movl %%edx, %0\n" \ "movl %%eax, %1\n" \ : "=r" (high), "=r" (low) \ : \ : "%eax", "%edx");\ } while (0) int a[32768][32]; main() { int temp1, temp2, temp3, temp4; int first_time = 1; struct timespec ts = {0, 0x20000000}; int i, j; int index; unsigned int cycles_begin_hi, cycles_begin_low; unsigned int cycles_end_hi, cycles_end_low; unsigned char b[16384]; //unsigned char b[8192]; for (i=0; i<32768; i++) for (j=0; j<32; j++) a[i][j] = 0; //memset(b, 5, 8192); memset(b, 5, 16384); for (i=0; i< 32768; i++) { /* if (i==0) { if (fork()==0) { execl("/usr/bin/openssl", "rsautl", "-in", "zzz_test", "-out","zzz_out_z", "-inkey", "priv_10k.key", "-sign", (char *)0 ); exit(0); } } */ for (j=0; j<32; j++) { rdtscll(cycles_begin_hi, cycles_begin_low); index = j*64; /* temp1 = b[index]*3; temp2 = b[index + 4096]*3; temp3 = b[index + 8192]*3; temp4 = b[index + 12288]*3; */ b[index] = b[index]*3; b[index + 0x800] = b[index + 0x800]*3; b[index + 0x1000] = b[index + 0x1000]*3; b[index + 0x1800] = b[index + 0x1800]*3; b[index + 0x2000] = b[index + 0x2000]*3; b[index + 0x2800] = b[index + 0x2800]*3; b[index + 0x3000] = b[index + 0x3000]*3; b[index + 0x3800] = b[index + 0x3800]*3; rdtscll(cycles_end_hi, cycles_end_low); a[i][j] = cycles_end_low - cycles_begin_low; } /* if (first_time) { nanosleep(&ts, 0); first_time = 0; } */ } for (i=0; i< 32768; i++) { printf("\n"); for (j=0; j<32; j++) printf("%d\t", a[i][j]); } }