Root/
1 | #include <linux/module.h> |
2 | #include <linux/kthread.h> |
3 | |
4 | /* |
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. |
9 | */ |
10 | #define CREATE_TRACE_POINTS |
11 | #include "trace-events-sample.h" |
12 | |
13 | |
14 | static void simple_thread_func(int cnt) |
15 | { |
16 | set_current_state(TASK_INTERRUPTIBLE); |
17 | schedule_timeout(HZ); |
18 | trace_foo_bar("hello", cnt); |
19 | } |
20 | |
21 | static int simple_thread(void *arg) |
22 | { |
23 | int cnt = 0; |
24 | |
25 | while (!kthread_should_stop()) |
26 | simple_thread_func(cnt++); |
27 | |
28 | return 0; |
29 | } |
30 | |
31 | static struct task_struct *simple_tsk; |
32 | |
33 | static int __init trace_event_init(void) |
34 | { |
35 | simple_tsk = kthread_run(simple_thread, NULL, "event-sample"); |
36 | if (IS_ERR(simple_tsk)) |
37 | return -1; |
38 | |
39 | return 0; |
40 | } |
41 | |
42 | static void __exit trace_event_exit(void) |
43 | { |
44 | kthread_stop(simple_tsk); |
45 | } |
46 | |
47 | module_init(trace_event_init); |
48 | module_exit(trace_event_exit); |
49 | |
50 | MODULE_AUTHOR("Steven Rostedt"); |
51 | MODULE_DESCRIPTION("trace-events-sample"); |
52 | MODULE_LICENSE("GPL"); |
53 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9