forked from AdvancedCompiler/AdvancedCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-1.c
More file actions
28 lines (28 loc) · 692 Bytes
/
Copy path2-1.c
File metadata and controls
28 lines (28 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<stdio.h>
#include<unistd.h>
#define n 100
#define m 10
int x,i,j;
unsigned long rpcc(){
unsigned long result;
unsigned hi,lo;
asm volatile("rdtsc":"=a"(lo),"=d"(hi));
result = ((unsigned long long)lo)|(((unsigned long long)hi)<<32);
return result;
}
void fun(int a){
for(i=0;i<n;i++)
x=(a/4)+i;
}
int main()
{
unsigned long b[m],start ,end,k;
for(j=0;j<10;j++){
start = rpcc();
fun(16);
end = rpcc();
b[j]=end -start;
k+=b[j];
}
printf("time = %ld\n",k/m);
}