1 #include <linux/module.h>
2 #include <linux/kthread.h>
5 * Any file that uses trace points, must include the header.
6 * But only one file, must include the header by defining
7 * CREATE_TRACE_POINTS first. This will make the C code that
8 * creates the handles for the trace points.
10 #define CREATE_TRACE_POINTS
11 #include "trace-events-sample.h"
13 static const char *random_strings[] = {
18 "One ring to rule them all"
21 static void simple_thread_func(int cnt)
27 set_current_state(TASK_INTERRUPTIBLE);
30 for (i = 0; i < len; i++)
34 trace_foo_bar("hello", cnt, array, random_strings[len],
35 tsk_cpus_allowed(current));
38 static int simple_thread(void *arg)
42 while (!kthread_should_stop())
43 simple_thread_func(cnt++);
48 static struct task_struct *simple_tsk;
50 static int __init trace_event_init(void)
52 simple_tsk = kthread_run(simple_thread, NULL, "event-sample");
53 if (IS_ERR(simple_tsk))
59 static void __exit trace_event_exit(void)
61 kthread_stop(simple_tsk);
64 module_init(trace_event_init);
65 module_exit(trace_event_exit);
67 MODULE_AUTHOR("Steven Rostedt");
68 MODULE_DESCRIPTION("trace-events-sample");
69 MODULE_LICENSE("GPL");