add compact test
[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
7#define CONFIG_LTT_FACILITY_COMPACT
8#include <ltt/ltt-facility-select-compact.h>
9#include "ltt-facility-compact.h"
10
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/ltt-core.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
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();
34 }
35 time2 = get_cycles();
36 time = time2 - time1;
37 tot_time += time;
38 local_irq_restore(flags);
39
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
44 printk(KERN_ALERT "test end\n");
45
46 return -EAGAIN; /* Fail will directly unload the module */
47}
48
49static void ltt_test_exit(void)
50{
51 printk(KERN_ALERT "test exit\n");
52}
53
54module_init(ltt_test_init)
55module_exit(ltt_test_exit)
56
57MODULE_LICENSE("GPL");
58MODULE_AUTHOR("Mathieu Desnoyers");
59MODULE_DESCRIPTION("Linux Trace Toolkit Test");
60
This page took 0.03007 seconds and 4 git commands to generate.