add lttng-xenomai
[lttv.git] / tests / kernel / test-compact.c
1 /* test-time-probe.c
2 *
3 * Test time spent in a LTTng instrumentation probe.
4 */
5
6
7 #include <ltt/ltt-facility-select-compact.h>
8 #include <ltt/ltt-facility-compact.h>
9
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/ltt-core.h>
13 #include <linux/timex.h>
14
15
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. */
19
20 #define NR_LOOPS 20000
21
22 static int ltt_test_init(void)
23 {
24 unsigned int i;
25 cycles_t time1, time2, time;
26 cycles_t tot_time = 0;
27 unsigned long flags;
28 printk(KERN_ALERT "test init\n");
29
30 local_irq_save(flags);
31 time1 = get_cycles();
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);
37 }
38 time2 = get_cycles();
39 time = time2 - time1;
40 tot_time += time;
41 local_irq_restore(flags);
42
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);
46
47 printk(KERN_ALERT "test end\n");
48
49 return -EAGAIN; /* Fail will directly unload the module */
50 }
51
52 static void ltt_test_exit(void)
53 {
54 printk(KERN_ALERT "test exit\n");
55 }
56
57 module_init(ltt_test_init)
58 module_exit(ltt_test_exit)
59
60 MODULE_LICENSE("GPL");
61 MODULE_AUTHOR("Mathieu Desnoyers");
62 MODULE_DESCRIPTION("Linux Trace Toolkit Test");
63
This page took 0.031394 seconds and 5 git commands to generate.