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:43:14 -0400 |
commit | f9896bf30928922a3913a3810a4ab7908da6cfe7 (patch) | |
tree | a27337d92d39dfb546cb40373e05b1d648478f46 /kernel/trace/trace.c | |
parent | 8c523a9d82dbc4f3f7d972df8c0f1eacd83d0d55 (diff) |
ftrace: add raw output
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 | 63 |
1 files changed, 55 insertions, 8 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 42f1926acf73..bebd263f582f 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -153,6 +153,7 @@ enum trace_iterator_flags { | |||
153 | TRACE_ITER_SYM_OFFSET = 0x02, | 153 | TRACE_ITER_SYM_OFFSET = 0x02, |
154 | TRACE_ITER_SYM_ADDR = 0x04, | 154 | TRACE_ITER_SYM_ADDR = 0x04, |
155 | TRACE_ITER_VERBOSE = 0x08, | 155 | TRACE_ITER_VERBOSE = 0x08, |
156 | TRACE_ITER_RAW = 0x10, | ||
156 | }; | 157 | }; |
157 | 158 | ||
158 | #define TRACE_ITER_SYM_MASK \ | 159 | #define TRACE_ITER_SYM_MASK \ |
@@ -164,6 +165,7 @@ static const char *trace_options[] = { | |||
164 | "sym-offset", | 165 | "sym-offset", |
165 | "sym-addr", | 166 | "sym-addr", |
166 | "verbose", | 167 | "verbose", |
168 | "raw", | ||
167 | NULL | 169 | NULL |
168 | }; | 170 | }; |
169 | 171 | ||
@@ -1099,7 +1101,7 @@ lat_print_timestamp(struct trace_seq *s, unsigned long long abs_usecs, | |||
1099 | 1101 | ||
1100 | static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; | 1102 | static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; |
1101 | 1103 | ||
1102 | static notrace void | 1104 | static notrace int |
1103 | print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) | 1105 | print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) |
1104 | { | 1106 | { |
1105 | struct trace_seq *s = &iter->seq; | 1107 | struct trace_seq *s = &iter->seq; |
@@ -1154,10 +1156,10 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) | |||
1154 | default: | 1156 | default: |
1155 | trace_seq_printf(s, "Unknown type %d\n", entry->type); | 1157 | trace_seq_printf(s, "Unknown type %d\n", entry->type); |
1156 | } | 1158 | } |
1159 | return 1; | ||
1157 | } | 1160 | } |
1158 | 1161 | ||
1159 | static notrace int | 1162 | static notrace int print_trace_fmt(struct trace_iterator *iter) |
1160 | print_trace_fmt(struct trace_iterator *iter) | ||
1161 | { | 1163 | { |
1162 | struct trace_seq *s = &iter->seq; | 1164 | struct trace_seq *s = &iter->seq; |
1163 | unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK); | 1165 | unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK); |
@@ -1222,6 +1224,43 @@ print_trace_fmt(struct trace_iterator *iter) | |||
1222 | return 1; | 1224 | return 1; |
1223 | } | 1225 | } |
1224 | 1226 | ||
1227 | static notrace int print_raw_fmt(struct trace_iterator *iter) | ||
1228 | { | ||
1229 | struct trace_seq *s = &iter->seq; | ||
1230 | struct trace_entry *entry; | ||
1231 | int ret; | ||
1232 | int S; | ||
1233 | |||
1234 | entry = iter->ent; | ||
1235 | |||
1236 | ret = trace_seq_printf(s, "%d %d %llu ", | ||
1237 | entry->pid, iter->cpu, entry->t); | ||
1238 | if (!ret) | ||
1239 | return 0; | ||
1240 | |||
1241 | switch (entry->type) { | ||
1242 | case TRACE_FN: | ||
1243 | ret = trace_seq_printf(s, "%x %x\n", | ||
1244 | entry->fn.ip, entry->fn.parent_ip); | ||
1245 | if (!ret) | ||
1246 | return 0; | ||
1247 | break; | ||
1248 | case TRACE_CTX: | ||
1249 | S = entry->ctx.prev_state < sizeof(state_to_char) ? | ||
1250 | state_to_char[entry->ctx.prev_state] : 'X'; | ||
1251 | ret = trace_seq_printf(s, "%d %d %c %d %d\n", | ||
1252 | entry->ctx.prev_pid, | ||
1253 | entry->ctx.prev_prio, | ||
1254 | S, | ||
1255 | entry->ctx.next_pid, | ||
1256 | entry->ctx.next_prio); | ||
1257 | if (!ret) | ||
1258 | return 0; | ||
1259 | break; | ||
1260 | } | ||
1261 | return 1; | ||
1262 | } | ||
1263 | |||
1225 | static int trace_empty(struct trace_iterator *iter) | 1264 | static int trace_empty(struct trace_iterator *iter) |
1226 | { | 1265 | { |
1227 | struct trace_array_cpu *data; | 1266 | struct trace_array_cpu *data; |
@@ -1238,6 +1277,17 @@ static int trace_empty(struct trace_iterator *iter) | |||
1238 | return 1; | 1277 | return 1; |
1239 | } | 1278 | } |
1240 | 1279 | ||
1280 | static int print_trace_line(struct trace_iterator *iter) | ||
1281 | { | ||
1282 | if (trace_flags & TRACE_ITER_RAW) | ||
1283 | return print_raw_fmt(iter); | ||
1284 | |||
1285 | if (iter->iter_flags & TRACE_FILE_LAT_FMT) | ||
1286 | return print_lat_fmt(iter, iter->idx, iter->cpu); | ||
1287 | |||
1288 | return print_trace_fmt(iter); | ||
1289 | } | ||
1290 | |||
1241 | static int s_show(struct seq_file *m, void *v) | 1291 | static int s_show(struct seq_file *m, void *v) |
1242 | { | 1292 | { |
1243 | struct trace_iterator *iter = v; | 1293 | struct trace_iterator *iter = v; |
@@ -1259,10 +1309,7 @@ static int s_show(struct seq_file *m, void *v) | |||
1259 | print_func_help_header(m); | 1309 | print_func_help_header(m); |
1260 | } | 1310 | } |
1261 | } else { | 1311 | } else { |
1262 | if (iter->iter_flags & TRACE_FILE_LAT_FMT) | 1312 | print_trace_line(iter); |
1263 | print_lat_fmt(iter, iter->idx, iter->cpu); | ||
1264 | else | ||
1265 | print_trace_fmt(iter); | ||
1266 | trace_print_seq(m, &iter->seq); | 1313 | trace_print_seq(m, &iter->seq); |
1267 | } | 1314 | } |
1268 | 1315 | ||
@@ -1870,7 +1917,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, | |||
1870 | } | 1917 | } |
1871 | 1918 | ||
1872 | while ((entry = find_next_entry_inc(iter)) != NULL) { | 1919 | while ((entry = find_next_entry_inc(iter)) != NULL) { |
1873 | ret = print_trace_fmt(iter); | 1920 | ret = print_trace_line(iter); |
1874 | if (!ret) | 1921 | if (!ret) |
1875 | break; | 1922 | break; |
1876 | 1923 | ||