diff options
author | Zhaolei <zhaolei@cn.fujitsu.com> | 2009-04-17 03:15:51 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-06-01 19:10:40 -0400 |
commit | fb39125fd79a25c5002f3b45cf4c80e3fa6b961b (patch) | |
tree | 96a9d274896f94306bc4d4972eca2153934f4814 /include/trace | |
parent | f2aebaee653a35b01c3665de2cbb1e31456b8ea8 (diff) |
ftrace, workqueuetrace: make workqueue tracepoints use TRACE_EVENT macro
v3: zhaolei@cn.fujitsu.com: Change TRACE_EVENT definition to new format
introduced by Steven Rostedt: consolidate trace and trace_event headers
v2: kosaki@jp.fujitsu.com: print the function names instead of addr, and zap
the work addr
v1: zhaolei@cn.fujitsu.com: Make workqueue tracepoints use TRACE_EVENT macro
TRACE_EVENT is a more generic way to define tracepoints.
Doing so adds these new capabilities to the tracepoints:
- zero-copy and per-cpu splice() tracing
- binary tracing without printf overhead
- structured logging records exposed under /debug/tracing/events
- trace events embedded in function tracer output and other plugins
- user-defined, per tracepoint filter expressions
Then, this patch converts DEFINE_TRACE to TRACE_EVENT in workqueue related
tracepoints.
[ Impact: expand workqueue tracer to events tracing ]
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/events/workqueue.h | 100 | ||||
-rw-r--r-- | include/trace/workqueue.h | 25 |
2 files changed, 100 insertions, 25 deletions
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h new file mode 100644 index 000000000000..035f1bff288e --- /dev/null +++ b/include/trace/events/workqueue.h | |||
@@ -0,0 +1,100 @@ | |||
1 | #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
2 | #define _TRACE_WORKQUEUE_H | ||
3 | |||
4 | #include <linux/workqueue.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/tracepoint.h> | ||
7 | |||
8 | #undef TRACE_SYSTEM | ||
9 | #define TRACE_SYSTEM workqueue | ||
10 | |||
11 | TRACE_EVENT(workqueue_insertion, | ||
12 | |||
13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
14 | |||
15 | TP_ARGS(wq_thread, work), | ||
16 | |||
17 | TP_STRUCT__entry( | ||
18 | __array(char, thread_comm, TASK_COMM_LEN) | ||
19 | __field(pid_t, thread_pid) | ||
20 | __field(work_func_t, func) | ||
21 | ), | ||
22 | |||
23 | TP_fast_assign( | ||
24 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
25 | __entry->thread_pid = wq_thread->pid; | ||
26 | __entry->func = work->func; | ||
27 | ), | ||
28 | |||
29 | TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, | ||
30 | __entry->thread_pid, __entry->func) | ||
31 | ); | ||
32 | |||
33 | TRACE_EVENT(workqueue_execution, | ||
34 | |||
35 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
36 | |||
37 | TP_ARGS(wq_thread, work), | ||
38 | |||
39 | TP_STRUCT__entry( | ||
40 | __array(char, thread_comm, TASK_COMM_LEN) | ||
41 | __field(pid_t, thread_pid) | ||
42 | __field(work_func_t, func) | ||
43 | ), | ||
44 | |||
45 | TP_fast_assign( | ||
46 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
47 | __entry->thread_pid = wq_thread->pid; | ||
48 | __entry->func = work->func; | ||
49 | ), | ||
50 | |||
51 | TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, | ||
52 | __entry->thread_pid, __entry->func) | ||
53 | ); | ||
54 | |||
55 | /* Trace the creation of one workqueue thread on a cpu */ | ||
56 | TRACE_EVENT(workqueue_creation, | ||
57 | |||
58 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
59 | |||
60 | TP_ARGS(wq_thread, cpu), | ||
61 | |||
62 | TP_STRUCT__entry( | ||
63 | __array(char, thread_comm, TASK_COMM_LEN) | ||
64 | __field(pid_t, thread_pid) | ||
65 | __field(int, cpu) | ||
66 | ), | ||
67 | |||
68 | TP_fast_assign( | ||
69 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
70 | __entry->thread_pid = wq_thread->pid; | ||
71 | __entry->cpu = cpu; | ||
72 | ), | ||
73 | |||
74 | TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm, | ||
75 | __entry->thread_pid, __entry->cpu) | ||
76 | ); | ||
77 | |||
78 | TRACE_EVENT(workqueue_destruction, | ||
79 | |||
80 | TP_PROTO(struct task_struct *wq_thread), | ||
81 | |||
82 | TP_ARGS(wq_thread), | ||
83 | |||
84 | TP_STRUCT__entry( | ||
85 | __array(char, thread_comm, TASK_COMM_LEN) | ||
86 | __field(pid_t, thread_pid) | ||
87 | ), | ||
88 | |||
89 | TP_fast_assign( | ||
90 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
91 | __entry->thread_pid = wq_thread->pid; | ||
92 | ), | ||
93 | |||
94 | TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid) | ||
95 | ); | ||
96 | |||
97 | #endif /* _TRACE_WORKQUEUE_H */ | ||
98 | |||
99 | /* This part must be outside protection */ | ||
100 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h deleted file mode 100644 index 7626523deeba..000000000000 --- a/include/trace/workqueue.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #ifndef __TRACE_WORKQUEUE_H | ||
2 | #define __TRACE_WORKQUEUE_H | ||
3 | |||
4 | #include <linux/tracepoint.h> | ||
5 | #include <linux/workqueue.h> | ||
6 | #include <linux/sched.h> | ||
7 | |||
8 | DECLARE_TRACE(workqueue_insertion, | ||
9 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
10 | TP_ARGS(wq_thread, work)); | ||
11 | |||
12 | DECLARE_TRACE(workqueue_execution, | ||
13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
14 | TP_ARGS(wq_thread, work)); | ||
15 | |||
16 | /* Trace the creation of one workqueue thread on a cpu */ | ||
17 | DECLARE_TRACE(workqueue_creation, | ||
18 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
19 | TP_ARGS(wq_thread, cpu)); | ||
20 | |||
21 | DECLARE_TRACE(workqueue_destruction, | ||
22 | TP_PROTO(struct task_struct *wq_thread), | ||
23 | TP_ARGS(wq_thread)); | ||
24 | |||
25 | #endif /* __TRACE_WORKQUEUE_H */ | ||