3 * Test time spent in a LTTng instrumentation probe.
7 #include "ltt-facility-tests.h"
9 #include <linux/init.h>
10 #include <linux/module.h>
11 #include <linux/ltt-core.h>
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. */
17 #define NR_LOOPS 20000
19 static int ltt_test_init(void)
22 cycles_t time1
, time2
, time
;
23 cycles_t max_time
= 0, min_time
= 18446744073709551615ULL; /* (2^64)-1 */
24 cycles_t tot_time
= 0;
26 printk(KERN_ALERT
"test init\n");
28 local_irq_save(flags
);
29 for(i
=0; i
<NR_LOOPS
; i
++) {
31 trace_tests_write_4bytes(5000);
34 max_time
= max(max_time
, time
);
35 min_time
= min(min_time
, time
);
38 local_irq_restore(flags
);
40 printk(KERN_ALERT
"test results : time per probe\n");
41 printk(KERN_ALERT
"number of loops : %d\n", NR_LOOPS
);
42 printk(KERN_ALERT
"total time : %llu\n", tot_time
);
43 printk(KERN_ALERT
"min : %llu\n", min_time
);
44 printk(KERN_ALERT
"max : %llu\n", max_time
);
46 printk(KERN_ALERT
"test end\n");
48 return -EAGAIN
; /* Fail will directly unload the module */
51 static void ltt_test_exit(void)
53 printk(KERN_ALERT
"test exit\n");
56 module_init(ltt_test_init
)
57 module_exit(ltt_test_exit
)
59 MODULE_LICENSE("GPL");
60 MODULE_AUTHOR("Mathieu Desnoyers");
61 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
This page took 0.073776 seconds and 5 git commands to generate.