-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu.c
More file actions
35 lines (29 loc) · 722 Bytes
/
Copy pathcpu.c
File metadata and controls
35 lines (29 loc) · 722 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
29
30
31
32
33
34
35
#include <stdio.h>
void x86_ras_fill(void);
void bhb_scrub_short(void);
void bhb_scrub_long(void);
unsigned long now(void);
int main(int argc, char *argv[]) {
unsigned long a, b;
int i;
a = now();
for (i = 0; i < 1000; i++)
asm volatile("" ::: "memory");
b = now();
printf("No-op %lu %f\n", b-a, (1.0 * b-a)/1000);
a = now();
for (i = 0; i < 1000; i++)
x86_ras_fill();
b = now();
printf("x86_ras_fill %lu %f\n", b-a, (1.0 * b-a)/1000);
a = now();
for (i = 0; i < 1000; i++)
bhb_scrub_short();
b = now();
printf("bhb_scrub_short %lu %f\n", b-a, (1.0 * b-a)/1000);
a = now();
for (i = 0; i < 1000; i++)
bhb_scrub_long();
b = now();
printf("bhb_scrub_long %lu %f\n", b-a, (1.0 * b-a)/1000);
}