diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-09-07 02:19:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-07 02:19:51 -0400 |
commit | a1922ed661ab2c1637d0b10cde933bd9cd33d965 (patch) | |
tree | 0f1777542b385ebefd30b3586d830fd8ed6fda5b /samples | |
parent | 75e33751ca8bbb72dd6f1a74d2810ddc8cbe4bdf (diff) | |
parent | d28daf923ac5e4a0d7cecebae56f3e339189366b (diff) |
Merge branch 'tracing/core' into tracing/hw-breakpoints
Conflicts:
arch/Kconfig
kernel/trace/trace.h
Merge reason: resolve the conflicts, plus adopt to the new
ring-buffer APIs.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/trace_events/Makefile | 8 | ||||
-rw-r--r-- | samples/trace_events/trace-events-sample.h | 56 |
2 files changed, 40 insertions, 24 deletions
diff --git a/samples/trace_events/Makefile b/samples/trace_events/Makefile index 0d428dc67283..0f8d92120c4e 100644 --- a/samples/trace_events/Makefile +++ b/samples/trace_events/Makefile | |||
@@ -1,6 +1,14 @@ | |||
1 | # builds the trace events example kernel modules; | 1 | # builds the trace events example kernel modules; |
2 | # then to use one (as root): insmod <module_name.ko> | 2 | # then to use one (as root): insmod <module_name.ko> |
3 | 3 | ||
4 | # If you include a trace header outside of include/trace/events | ||
5 | # then the file that does the #define CREATE_TRACE_POINTS must | ||
6 | # have that tracer file in its main search path. This is because | ||
7 | # define_trace.h will include it, and must be able to find it from | ||
8 | # the include/trace directory. | ||
9 | # | ||
10 | # Here trace-events-sample.c does the CREATE_TRACE_POINTS. | ||
11 | # | ||
4 | CFLAGS_trace-events-sample.o := -I$(src) | 12 | CFLAGS_trace-events-sample.o := -I$(src) |
5 | 13 | ||
6 | obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace-events-sample.o | 14 | obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace-events-sample.o |
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 128a897687c5..f24ae370e514 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h | |||
@@ -1,4 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | * If TRACE_SYSTEM is defined, that will be the directory created | ||
3 | * in the ftrace directory under /debugfs/tracing/events/<system> | ||
4 | * | ||
5 | * The define_trace.h below will also look for a file name of | ||
6 | * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here. | ||
7 | * In this case, it would look for sample.h | ||
8 | * | ||
9 | * If the header name will be different than the system name | ||
10 | * (as in this case), then you can override the header name that | ||
11 | * define_trace.h will look up by defining TRACE_INCLUDE_FILE | ||
12 | * | ||
13 | * This file is called trace-events-sample.h but we want the system | ||
14 | * to be called "sample". Therefore we must define the name of this | ||
15 | * file: | ||
16 | * | ||
17 | * #define TRACE_INCLUDE_FILE trace-events-sample | ||
18 | * | ||
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. | ||
23 | */ | ||
24 | #undef TRACE_SYSTEM | ||
25 | #define TRACE_SYSTEM sample | ||
26 | |||
27 | /* | ||
2 | * Notice that this file is not protected like a normal header. | 28 | * Notice that this file is not protected like a normal header. |
3 | * We also must allow for rereading of this file. The | 29 | * We also must allow for rereading of this file. The |
4 | * | 30 | * |
@@ -16,24 +42,6 @@ | |||
16 | #include <linux/tracepoint.h> | 42 | #include <linux/tracepoint.h> |
17 | 43 | ||
18 | /* | 44 | /* |
19 | * If TRACE_SYSTEM is defined, that will be the directory created | ||
20 | * in the ftrace directory under /debugfs/tracing/events/<system> | ||
21 | * | ||
22 | * The define_trace.h belowe will also look for a file name of | ||
23 | * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here. | ||
24 | * | ||
25 | * If you want a different system than file name, you can override | ||
26 | * the header name by defining TRACE_INCLUDE_FILE | ||
27 | * | ||
28 | * If this file was called, goofy.h, then we would define: | ||
29 | * | ||
30 | * #define TRACE_INCLUDE_FILE goofy | ||
31 | * | ||
32 | */ | ||
33 | #undef TRACE_SYSTEM | ||
34 | #define TRACE_SYSTEM sample | ||
35 | |||
36 | /* | ||
37 | * The TRACE_EVENT macro is broken up into 5 parts. | 45 | * The TRACE_EVENT macro is broken up into 5 parts. |
38 | * | 46 | * |
39 | * 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. |
@@ -99,13 +107,13 @@ TRACE_EVENT(foo_bar, | |||
99 | * | 107 | * |
100 | * #define TRACE_INCLUDE_PATH ../../samples/trace_events | 108 | * #define TRACE_INCLUDE_PATH ../../samples/trace_events |
101 | * | 109 | * |
102 | * But I chose to simply make it use the current directory and then in | 110 | * But the safest and easiest way to simply make it use the directory |
103 | * the Makefile I added: | 111 | * that the file is in is to add in the Makefile: |
104 | * | 112 | * |
105 | * CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/ | 113 | * CFLAGS_trace-events-sample.o := -I$(src) |
106 | * | 114 | * |
107 | * This will make sure the current path is part of the include | 115 | * This will make sure the current path is part of the include |
108 | * structure for our file so that we can find it. | 116 | * structure for our file so that define_trace.h can find it. |
109 | * | 117 | * |
110 | * I could have made only the top level directory the include: | 118 | * I could have made only the top level directory the include: |
111 | * | 119 | * |
@@ -115,8 +123,8 @@ TRACE_EVENT(foo_bar, | |||
115 | * | 123 | * |
116 | * #define TRACE_INCLUDE_PATH samples/trace_events | 124 | * #define TRACE_INCLUDE_PATH samples/trace_events |
117 | * | 125 | * |
118 | * But then if something defines "samples" or "trace_events" then we | 126 | * But then if something defines "samples" or "trace_events" as a macro |
119 | * could risk that being converted too, and give us an unexpected | 127 | * then we could risk that being converted too, and give us an unexpected |
120 | * result. | 128 | * result. |
121 | */ | 129 | */ |
122 | #undef TRACE_INCLUDE_PATH | 130 | #undef TRACE_INCLUDE_PATH |