-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapper.c
More file actions
46 lines (35 loc) · 709 Bytes
/
wrapper.c
File metadata and controls
46 lines (35 loc) · 709 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
36
37
38
39
40
41
42
43
44
45
46
#include <time.h>
#include <stdio.h>
#define loopCount 10000
#define testCount 10000
int wrapper_function() {
int a, b, c, d, e, f, g, h, i, j, k, l,
m, n, o, p, q, r, s, t, u, v, w, x, y, z;
a = i;
b = j;
c = k;
a = a * a;
b = b * b;
c = c * c;
d = a + b;
e = d + c;
return e;
}
int main () {
clock_t begin, end;
double time_spent, times;
int i;
int result;
for (i = 0; i < testCount; i++){
int j;
begin = clock();
for (j = 0; j < loopCount; j++) {
result = wrapper_function();
}
end = clock();
time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
times = times + time_spent;
}
printf("Average time spent: %f\n", times/testCount);
return result;
}