Commit 332ab0197e0117677d52e4db564d05fe3b6b4739
Exists in
master
Merge branch 'master' of https://git.ucsd.edu/ajmohan/rasperf
"Reviewed changes"
Showing 4 changed files Side-by-side Diff
cpu/loop_overhead_time.c
View file @
332ab01
1 | +#include <stdio.h> | |
2 | + | |
3 | +int main() | |
4 | +{ | |
5 | + int time1, time2, sum=0; | |
6 | + int i; | |
7 | + int avg = 0; | |
8 | + asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r" (i)); | |
9 | + | |
10 | + while(sum < 100) { | |
11 | + asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (time1)); | |
12 | + for (i = 0; i < 1000; i++); | |
13 | + asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (time2)); | |
14 | + avg = (time2 - time1 - 5); | |
15 | + printf("Loop overhead: %u\n", avg/(1000)); | |
16 | + sum++; | |
17 | + } | |
18 | +} |
cpu/loop_overhead_time.o
View file @
332ab01
cpu/reading_time.c
View file @
332ab01
1 | +#include <stdio.h> | |
2 | + | |
3 | +int main() | |
4 | +{ | |
5 | + unsigned int time; | |
6 | + unsigned int i; | |
7 | + unsigned int a, b; | |
8 | + float avg = 0.0; | |
9 | + asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r" (time)); | |
10 | + | |
11 | + time = 0; | |
12 | + for (i = 0; i < 1000; i++) { | |
13 | + asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (a)); | |
14 | + asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (b)); | |
15 | + time += b - a; | |
16 | + } | |
17 | + avg = time / 1000; | |
18 | + printf("Measurement overhead: %f\n", avg); | |
19 | + return 0; | |
20 | +} |
cpu/reading_time.out
View file @
332ab01