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/trace/trace.c | |
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/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 44 |
1 files changed, 44 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 | } |