1 // Some work exercising the cache simulator
2 // with a simple call graph
4 #include "../callgrind.h"
16 for(i
= 0; i
< SIZE
; i
++) a
[i
] = b
[i
] = 1.0;
22 for(i
= 0; i
< SIZE
; i
++) {
34 for(i
= 0; i
< SIZE
; i
++) sum
+= c
[i
];
39 double do_some_work(int iter
)
43 if (iter
> 0) sum
+= do_some_work(iter
-1);
54 a
= (double*) malloc(SIZE
* sizeof(double));
55 b
= (double*) malloc(SIZE
* sizeof(double));
56 c
= (double*) malloc(SIZE
* sizeof(double));
60 res
= do_some_work(1);
63 printf("Sum: %.0f\n", res
);
64 return RUNNING_ON_VALGRIND
;