ff2341d9 |
1 | |
2 | #include <stdio.h> |
3 | #include <unistd.h> |
5ab6355c |
4 | #include <asm/timex.h> |
ff2341d9 |
5 | |
6 | #define LTT_TRACE |
7 | #define LTT_TRACE_FAST |
8 | #include <ltt/ltt-facility-user_tests.h> |
9 | |
10 | #define max(a,b) ((a)>(b)?(a):(b)) |
11 | #define min(a,b) ((a)<(b)?(a):(b)) |
12 | |
13 | /* Event logged : 4 bytes + 20 bytes header = 24 bytes. Let's use 1MB of |
14 | * buffers. 1MB / 24bytes = 43690. So, if we write 20000 event, we should not |
15 | * lose events. Check event lost count after tests. */ |
16 | |
17 | #define NR_LOOPS 20000 |
18 | |
19 | typedef unsigned long long cycles_t; |
20 | |
21 | int main(int argc, char **argv) |
22 | { |
23 | unsigned int i; |
24 | cycles_t time1, time2, time; |
25 | cycles_t max_time = 0, min_time = 18446744073709551615ULL; /* (2^64)-1 */ |
26 | cycles_t tot_time = 0; |
27 | |
28 | for(i=0; i<NR_LOOPS; i++) { |
29 | time1 = get_cycles(); |
30 | trace_user_tests_write_4bytes(5000); |
31 | time2 = get_cycles(); |
32 | time = time2 - time1; |
33 | max_time = max(max_time, time); |
34 | min_time = min(min_time, time); |
35 | tot_time += time; |
36 | } |
37 | |
38 | printf("test results : time per probe (in cycles)\n"); |
39 | printf("number of loops : %d\n", NR_LOOPS); |
40 | printf("total time : %llu\n", tot_time); |
41 | printf("average time : %g\n", tot_time/(double)NR_LOOPS); |
42 | printf("min : %llu\n", min_time); |
43 | printf("max : %llu\n", max_time); |
44 | |
45 | return 0; |
46 | } |
47 | |