fix trace number for 64 bits
[lttv.git] / tests / kernel / test-compact.c
CommitLineData
c9a9c80f 1/* test-time-probe.c
2 *
3 * Test time spent in a LTTng instrumentation probe.
4 */
5
6
c9a9c80f 7#include <ltt/ltt-facility-select-compact.h>
c99ee580 8#include <ltt/ltt-facility-compact.h>
c9a9c80f 9
10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/ltt-core.h>
c99ee580 13#include <linux/timex.h>
c9a9c80f 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
22static 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();
c99ee580 34 trace_compact_event_c(get_cycles());
35 trace_compact_event_d(0xFF);
36 trace_compact_event_e(0xFF, 0xFAFAFA);
c9a9c80f 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
52static void ltt_test_exit(void)
53{
54 printk(KERN_ALERT "test exit\n");
55}
56
57module_init(ltt_test_init)
58module_exit(ltt_test_exit)
59
60MODULE_LICENSE("GPL");
61MODULE_AUTHOR("Mathieu Desnoyers");
62MODULE_DESCRIPTION("Linux Trace Toolkit Test");
63
This page took 0.024699 seconds and 4 git commands to generate.