diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-07-12 22:33:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-13 04:59:55 -0400 |
commit | d0b6e04a4cd8360e3c9c419f7c30a3081a0c142a (patch) | |
tree | 621a99cac5fdc0c90a3bcdab60d5896daba04a00 | |
parent | 7638d5322bd89d49e013a03fe2afaeb6d214fabd (diff) |
tracing/events: Move TRACE_SYSTEM outside of include guard
If TRACE_INCLDUE_FILE is defined, <trace/events/TRACE_INCLUDE_FILE.h>
will be included and compiled, otherwise it will be
<trace/events/TRACE_SYSTEM.h>
So TRACE_SYSTEM should be defined outside of #if proctection,
just like TRACE_INCLUDE_FILE.
Imaging this scenario:
#include <trace/events/foo.h>
-> TRACE_SYSTEM == foo
...
#include <trace/events/bar.h>
-> TRACE_SYSTEM == bar
...
#define CREATE_TRACE_POINTS
#include <trace/events/foo.h>
-> TRACE_SYSTEM == bar !!!
and then bar.h will be included and compiled.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A5A9CF1.2010007@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | fs/gfs2/trace_gfs2.h | 8 | ||||
-rw-r--r-- | include/trace/events/block.h | 6 | ||||
-rw-r--r-- | include/trace/events/ext4.h | 6 | ||||
-rw-r--r-- | include/trace/events/irq.h | 6 | ||||
-rw-r--r-- | include/trace/events/jbd2.h | 6 | ||||
-rw-r--r-- | include/trace/events/kmem.h | 6 | ||||
-rw-r--r-- | include/trace/events/lockdep.h | 6 | ||||
-rw-r--r-- | include/trace/events/sched.h | 6 | ||||
-rw-r--r-- | include/trace/events/skb.h | 6 | ||||
-rw-r--r-- | include/trace/events/workqueue.h | 6 | ||||
-rw-r--r-- | samples/trace_events/trace-events-sample.h | 37 |
11 files changed, 51 insertions, 48 deletions
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h index 98d6ef1c1dc..148d55c1417 100644 --- a/fs/gfs2/trace_gfs2.h +++ b/fs/gfs2/trace_gfs2.h | |||
@@ -1,12 +1,11 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM gfs2 | ||
3 | |||
1 | #if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_GFS2_H | 5 | #define _TRACE_GFS2_H |
3 | 6 | ||
4 | #include <linux/tracepoint.h> | 7 | #include <linux/tracepoint.h> |
5 | 8 | ||
6 | #undef TRACE_SYSTEM | ||
7 | #define TRACE_SYSTEM gfs2 | ||
8 | #define TRACE_INCLUDE_FILE trace_gfs2 | ||
9 | |||
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include <linux/buffer_head.h> | 10 | #include <linux/buffer_head.h> |
12 | #include <linux/dlmconstants.h> | 11 | #include <linux/dlmconstants.h> |
@@ -403,5 +402,6 @@ TRACE_EVENT(gfs2_block_alloc, | |||
403 | /* This part must be outside protection */ | 402 | /* This part must be outside protection */ |
404 | #undef TRACE_INCLUDE_PATH | 403 | #undef TRACE_INCLUDE_PATH |
405 | #define TRACE_INCLUDE_PATH . | 404 | #define TRACE_INCLUDE_PATH . |
405 | #define TRACE_INCLUDE_FILE trace_gfs2 | ||
406 | #include <trace/define_trace.h> | 406 | #include <trace/define_trace.h> |
407 | 407 | ||
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index d6b05f42dd4..9a74b468a22 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM block | ||
3 | |||
1 | #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_BLOCK_H | 5 | #define _TRACE_BLOCK_H |
3 | 6 | ||
@@ -5,9 +8,6 @@ | |||
5 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
6 | #include <linux/tracepoint.h> | 9 | #include <linux/tracepoint.h> |
7 | 10 | ||
8 | #undef TRACE_SYSTEM | ||
9 | #define TRACE_SYSTEM block | ||
10 | |||
11 | TRACE_EVENT(block_rq_abort, | 11 | TRACE_EVENT(block_rq_abort, |
12 | 12 | ||
13 | TP_PROTO(struct request_queue *q, struct request *rq), | 13 | TP_PROTO(struct request_queue *q, struct request *rq), |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index acf4cc9cd36..8eb82cc8d14 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ) | ||
2 | #define _TRACE_EXT4_H | ||
3 | |||
4 | #undef TRACE_SYSTEM | 1 | #undef TRACE_SYSTEM |
5 | #define TRACE_SYSTEM ext4 | 2 | #define TRACE_SYSTEM ext4 |
6 | 3 | ||
4 | #if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_EXT4_H | ||
6 | |||
7 | #include <linux/writeback.h> | 7 | #include <linux/writeback.h> |
8 | #include "../../../fs/ext4/ext4.h" | 8 | #include "../../../fs/ext4/ext4.h" |
9 | #include "../../../fs/ext4/mballoc.h" | 9 | #include "../../../fs/ext4/mballoc.h" |
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h index b0c7ede55eb..1cb0c3aa11e 100644 --- a/include/trace/events/irq.h +++ b/include/trace/events/irq.h | |||
@@ -1,12 +1,12 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM irq | ||
3 | |||
1 | #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_IRQ_H | 5 | #define _TRACE_IRQ_H |
3 | 6 | ||
4 | #include <linux/tracepoint.h> | 7 | #include <linux/tracepoint.h> |
5 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
6 | 9 | ||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM irq | ||
9 | |||
10 | #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } | 10 | #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } |
11 | #define show_softirq_name(val) \ | 11 | #define show_softirq_name(val) \ |
12 | __print_symbolic(val, \ | 12 | __print_symbolic(val, \ |
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index 845b0b4b48f..10813fa0c8d 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h | |||
@@ -1,12 +1,12 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM jbd2 | ||
3 | |||
1 | #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_JBD2_H | 5 | #define _TRACE_JBD2_H |
3 | 6 | ||
4 | #include <linux/jbd2.h> | 7 | #include <linux/jbd2.h> |
5 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
6 | 9 | ||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM jbd2 | ||
9 | |||
10 | TRACE_EVENT(jbd2_checkpoint, | 10 | TRACE_EVENT(jbd2_checkpoint, |
11 | 11 | ||
12 | TP_PROTO(journal_t *journal, int result), | 12 | TP_PROTO(journal_t *journal, int result), |
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index 9baba50d651..1493c541f9c 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h | |||
@@ -1,12 +1,12 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM kmem | ||
3 | |||
1 | #if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_KMEM_H | 5 | #define _TRACE_KMEM_H |
3 | 6 | ||
4 | #include <linux/types.h> | 7 | #include <linux/types.h> |
5 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
6 | 9 | ||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM kmem | ||
9 | |||
10 | /* | 10 | /* |
11 | * The order of these masks is important. Matching masks will be seen | 11 | * The order of these masks is important. Matching masks will be seen |
12 | * first and the left over flags will end up showing by themselves. | 12 | * first and the left over flags will end up showing by themselves. |
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lockdep.h index 0e956c9dfd7..bcf1d209a00 100644 --- a/include/trace/events/lockdep.h +++ b/include/trace/events/lockdep.h | |||
@@ -1,12 +1,12 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM lockdep | ||
3 | |||
1 | #if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_LOCKDEP_H | 5 | #define _TRACE_LOCKDEP_H |
3 | 6 | ||
4 | #include <linux/lockdep.h> | 7 | #include <linux/lockdep.h> |
5 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
6 | 9 | ||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM lockdep | ||
9 | |||
10 | #ifdef CONFIG_LOCKDEP | 10 | #ifdef CONFIG_LOCKDEP |
11 | 11 | ||
12 | TRACE_EVENT(lock_acquire, | 12 | TRACE_EVENT(lock_acquire, |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 24ab5bcff7b..8949bb7eb08 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
@@ -1,12 +1,12 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM sched | ||
3 | |||
1 | #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_SCHED_H | 5 | #define _TRACE_SCHED_H |
3 | 6 | ||
4 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
5 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
6 | 9 | ||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM sched | ||
9 | |||
10 | /* | 10 | /* |
11 | * Tracepoint for calling kthread_stop, performed to end a kthread: | 11 | * Tracepoint for calling kthread_stop, performed to end a kthread: |
12 | */ | 12 | */ |
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 1e8fabb57c0..e499863b966 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h | |||
@@ -1,12 +1,12 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM skb | ||
3 | |||
1 | #if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_SKB_H | 5 | #define _TRACE_SKB_H |
3 | 6 | ||
4 | #include <linux/skbuff.h> | 7 | #include <linux/skbuff.h> |
5 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
6 | 9 | ||
7 | #undef TRACE_SYSTEM | ||
8 | #define TRACE_SYSTEM skb | ||
9 | |||
10 | /* | 10 | /* |
11 | * Tracepoint for free an sk_buff: | 11 | * Tracepoint for free an sk_buff: |
12 | */ | 12 | */ |
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index 035f1bff288..fcfd9a1e4b9 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM workqueue | ||
3 | |||
1 | #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_WORKQUEUE_H | 5 | #define _TRACE_WORKQUEUE_H |
3 | 6 | ||
@@ -5,9 +8,6 @@ | |||
5 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
6 | #include <linux/tracepoint.h> | 9 | #include <linux/tracepoint.h> |
7 | 10 | ||
8 | #undef TRACE_SYSTEM | ||
9 | #define TRACE_SYSTEM workqueue | ||
10 | |||
11 | TRACE_EVENT(workqueue_insertion, | 11 | TRACE_EVENT(workqueue_insertion, |
12 | 12 | ||
13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | 13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), |
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 9977a756fb3..f24ae370e51 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h | |||
@@ -1,21 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Notice that this file is not protected like a normal header. | ||
3 | * We also must allow for rereading of this file. The | ||
4 | * | ||
5 | * || defined(TRACE_HEADER_MULTI_READ) | ||
6 | * | ||
7 | * serves this purpose. | ||
8 | */ | ||
9 | #if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
10 | #define _TRACE_EVENT_SAMPLE_H | ||
11 | |||
12 | /* | ||
13 | * All trace headers should include tracepoint.h, until we finally | ||
14 | * make it into a standard header. | ||
15 | */ | ||
16 | #include <linux/tracepoint.h> | ||
17 | |||
18 | /* | ||
19 | * If TRACE_SYSTEM is defined, that will be the directory created | 2 | * If TRACE_SYSTEM is defined, that will be the directory created |
20 | * in the ftrace directory under /debugfs/tracing/events/<system> | 3 | * in the ftrace directory under /debugfs/tracing/events/<system> |
21 | * | 4 | * |
@@ -34,11 +17,31 @@ | |||
34 | * #define TRACE_INCLUDE_FILE trace-events-sample | 17 | * #define TRACE_INCLUDE_FILE trace-events-sample |
35 | * | 18 | * |
36 | * As we do an the bottom of this file. | 19 | * As we do an the bottom of this file. |
20 | * | ||
21 | * Notice that TRACE_SYSTEM should be defined outside of #if | ||
22 | * protection, just like TRACE_INCLUDE_FILE. | ||
37 | */ | 23 | */ |
38 | #undef TRACE_SYSTEM | 24 | #undef TRACE_SYSTEM |
39 | #define TRACE_SYSTEM sample | 25 | #define TRACE_SYSTEM sample |
40 | 26 | ||
41 | /* | 27 | /* |
28 | * Notice that this file is not protected like a normal header. | ||
29 | * We also must allow for rereading of this file. The | ||
30 | * | ||
31 | * || defined(TRACE_HEADER_MULTI_READ) | ||
32 | * | ||
33 | * serves this purpose. | ||
34 | */ | ||
35 | #if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
36 | #define _TRACE_EVENT_SAMPLE_H | ||
37 | |||
38 | /* | ||
39 | * All trace headers should include tracepoint.h, until we finally | ||
40 | * make it into a standard header. | ||
41 | */ | ||
42 | #include <linux/tracepoint.h> | ||
43 | |||
44 | /* | ||
42 | * The TRACE_EVENT macro is broken up into 5 parts. | 45 | * The TRACE_EVENT macro is broken up into 5 parts. |
43 | * | 46 | * |
44 | * name: name of the trace point. This is also how to enable the tracepoint. | 47 | * name: name of the trace point. This is also how to enable the tracepoint. |