3 * Test time spent in a LTTng instrumentation probe.
7 #include <ltt/ltt-facility-select-compact.h>
8 #include <ltt/ltt-facility-compact.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/ltt-core.h>
13 #include <linux/timex.h>
16 /* Event logged : 4 bytes. Let's use 1MB of
17 * buffers. 1MB / 4bytes = 262144 (plus heartbeats). So, if we write 20000
18 * event, we should not lose events. Check event lost count after tests. */
20 #define NR_LOOPS 20000
22 static int ltt_test_init(void)
25 cycles_t time1
, time2
, time
;
26 cycles_t tot_time
= 0;
28 printk(KERN_ALERT
"test init\n");
30 local_irq_save(flags
);
32 for(i
=0; i
<NR_LOOPS
; i
++) {
33 trace_compact_event_a();
34 trace_compact_event_c(get_cycles());
35 trace_compact_event_d(0xFF);
36 trace_compact_event_e(0xFF, 0xFAFAFA);
41 local_irq_restore(flags
);
43 printk(KERN_ALERT
"test results : time per probe\n");
44 printk(KERN_ALERT
"number of loops : %d\n", NR_LOOPS
);
45 printk(KERN_ALERT
"total time : %llu\n", tot_time
);
47 printk(KERN_ALERT
"test end\n");
49 return -EAGAIN
; /* Fail will directly unload the module */
52 static void ltt_test_exit(void)
54 printk(KERN_ALERT
"test exit\n");
57 module_init(ltt_test_init
)
58 module_exit(ltt_test_exit
)
60 MODULE_LICENSE("GPL");
61 MODULE_AUTHOR("Mathieu Desnoyers");
62 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
This page took 0.032285 seconds and 5 git commands to generate.