diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:20:47 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 14:52:33 -0400 |
commit | f0a920d5752e1788c0cba2add103076bcc0f7a49 (patch) | |
tree | db9c5383c3464808570b1121e44f80b817f7f263 /kernel | |
parent | cb0f12aae8d085140d37ada351aa5a8e76c3f9b0 (diff) |
ftrace: add trace_special()
for ad-hoc tracing.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 44 | ||||
-rw-r--r-- | kernel/trace/trace.h | 15 |
2 files changed, 59 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d78cbc4fc519..fa13059eb462 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -137,6 +137,7 @@ enum trace_type { | |||
137 | 137 | ||
138 | TRACE_FN, | 138 | TRACE_FN, |
139 | TRACE_CTX, | 139 | TRACE_CTX, |
140 | TRACE_SPECIAL, | ||
140 | 141 | ||
141 | __TRACE_LAST_TYPE | 142 | __TRACE_LAST_TYPE |
142 | }; | 143 | }; |
@@ -701,6 +702,22 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data, | |||
701 | } | 702 | } |
702 | 703 | ||
703 | notrace void | 704 | notrace void |
705 | trace_special(struct trace_array *tr, struct trace_array_cpu *data, | ||
706 | unsigned long arg1, unsigned long arg2, unsigned long arg3) | ||
707 | { | ||
708 | struct trace_entry *entry; | ||
709 | |||
710 | spin_lock(&data->lock); | ||
711 | entry = tracing_get_trace_entry(tr, data); | ||
712 | tracing_generic_entry_update(entry, 0); | ||
713 | entry->type = TRACE_SPECIAL; | ||
714 | entry->special.arg1 = arg1; | ||
715 | entry->special.arg2 = arg2; | ||
716 | entry->special.arg3 = arg3; | ||
717 | spin_unlock(&data->lock); | ||
718 | } | ||
719 | |||
720 | notrace void | ||
704 | tracing_sched_switch_trace(struct trace_array *tr, | 721 | tracing_sched_switch_trace(struct trace_array *tr, |
705 | struct trace_array_cpu *data, | 722 | struct trace_array_cpu *data, |
706 | struct task_struct *prev, struct task_struct *next, | 723 | struct task_struct *prev, struct task_struct *next, |
@@ -1167,6 +1184,12 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) | |||
1167 | entry->ctx.next_prio, | 1184 | entry->ctx.next_prio, |
1168 | comm); | 1185 | comm); |
1169 | break; | 1186 | break; |
1187 | case TRACE_SPECIAL: | ||
1188 | trace_seq_printf(s, " %lx %lx %lx\n", | ||
1189 | entry->special.arg1, | ||
1190 | entry->special.arg2, | ||
1191 | entry->special.arg3); | ||
1192 | break; | ||
1170 | default: | 1193 | default: |
1171 | trace_seq_printf(s, "Unknown type %d\n", entry->type); | 1194 | trace_seq_printf(s, "Unknown type %d\n", entry->type); |
1172 | } | 1195 | } |
@@ -1234,6 +1257,14 @@ static notrace int print_trace_fmt(struct trace_iterator *iter) | |||
1234 | if (!ret) | 1257 | if (!ret) |
1235 | return 0; | 1258 | return 0; |
1236 | break; | 1259 | break; |
1260 | case TRACE_SPECIAL: | ||
1261 | ret = trace_seq_printf(s, " %lx %lx %lx\n", | ||
1262 | entry->special.arg1, | ||
1263 | entry->special.arg2, | ||
1264 | entry->special.arg3); | ||
1265 | if (!ret) | ||
1266 | return 0; | ||
1267 | break; | ||
1237 | } | 1268 | } |
1238 | return 1; | 1269 | return 1; |
1239 | } | 1270 | } |
@@ -1271,6 +1302,14 @@ static notrace int print_raw_fmt(struct trace_iterator *iter) | |||
1271 | if (!ret) | 1302 | if (!ret) |
1272 | return 0; | 1303 | return 0; |
1273 | break; | 1304 | break; |
1305 | case TRACE_SPECIAL: | ||
1306 | ret = trace_seq_printf(s, " %lx %lx %lx\n", | ||
1307 | entry->special.arg1, | ||
1308 | entry->special.arg2, | ||
1309 | entry->special.arg3); | ||
1310 | if (!ret) | ||
1311 | return 0; | ||
1312 | break; | ||
1274 | } | 1313 | } |
1275 | return 1; | 1314 | return 1; |
1276 | } | 1315 | } |
@@ -1304,6 +1343,11 @@ static notrace int print_bin_fmt(struct trace_iterator *iter) | |||
1304 | SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid); | 1343 | SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid); |
1305 | SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio); | 1344 | SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio); |
1306 | break; | 1345 | break; |
1346 | case TRACE_SPECIAL: | ||
1347 | SEQ_PUT_FIELD_RET(s, entry->special.arg1); | ||
1348 | SEQ_PUT_FIELD_RET(s, entry->special.arg2); | ||
1349 | SEQ_PUT_FIELD_RET(s, entry->special.arg3); | ||
1350 | break; | ||
1307 | } | 1351 | } |
1308 | return 1; | 1352 | return 1; |
1309 | } | 1353 | } |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 27fa2d06f499..7bdfef35c05a 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -26,6 +26,15 @@ struct ctx_switch_entry { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Special (free-form) trace entry: | ||
30 | */ | ||
31 | struct special_entry { | ||
32 | unsigned long arg1; | ||
33 | unsigned long arg2; | ||
34 | unsigned long arg3; | ||
35 | }; | ||
36 | |||
37 | /* | ||
29 | * The trace entry - the most basic unit of tracing. This is what | 38 | * The trace entry - the most basic unit of tracing. This is what |
30 | * is printed in the end as a single line in the trace output, such as: | 39 | * is printed in the end as a single line in the trace output, such as: |
31 | * | 40 | * |
@@ -41,6 +50,7 @@ struct trace_entry { | |||
41 | union { | 50 | union { |
42 | struct ftrace_entry fn; | 51 | struct ftrace_entry fn; |
43 | struct ctx_switch_entry ctx; | 52 | struct ctx_switch_entry ctx; |
53 | struct special_entry special; | ||
44 | }; | 54 | }; |
45 | }; | 55 | }; |
46 | 56 | ||
@@ -154,6 +164,11 @@ void tracing_sched_switch_trace(struct trace_array *tr, | |||
154 | struct task_struct *next, | 164 | struct task_struct *next, |
155 | unsigned long flags); | 165 | unsigned long flags); |
156 | void tracing_record_cmdline(struct task_struct *tsk); | 166 | void tracing_record_cmdline(struct task_struct *tsk); |
167 | void trace_special(struct trace_array *tr, | ||
168 | struct trace_array_cpu *data, | ||
169 | unsigned long arg1, | ||
170 | unsigned long arg2, | ||
171 | unsigned long arg3); | ||
157 | 172 | ||
158 | void tracing_start_function_trace(void); | 173 | void tracing_start_function_trace(void); |
159 | void tracing_stop_function_trace(void); | 174 | void tracing_stop_function_trace(void); |