diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2016-07-06 15:25:08 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-11-15 15:13:59 -0500 |
commit | fa32e8557b470f5ff90babc6cbacc61535a81a0f (patch) | |
tree | fa3fdc74436987c4832e2941659efa1b6f22d874 /kernel/trace/trace_output.c | |
parent | 9648dc15772d77b5431cd5c11675d90eee1a4c2f (diff) |
tracing: Add new trace_marker_raw
A new file is created:
/sys/kernel/debug/tracing/trace_marker_raw
This allows for appications to create data structures and write the binary
data directly into it, and then read the trace data out from trace_pipe_raw
into the same type of data structure. This saves on converting numbers into
ASCII that would be required by trace_marker.
Suggested-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 3fc20422c166..5d33a7352919 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -1288,6 +1288,35 @@ static struct trace_event trace_print_event = { | |||
1288 | .funcs = &trace_print_funcs, | 1288 | .funcs = &trace_print_funcs, |
1289 | }; | 1289 | }; |
1290 | 1290 | ||
1291 | static enum print_line_t trace_raw_data(struct trace_iterator *iter, int flags, | ||
1292 | struct trace_event *event) | ||
1293 | { | ||
1294 | struct raw_data_entry *field; | ||
1295 | int i; | ||
1296 | |||
1297 | trace_assign_type(field, iter->ent); | ||
1298 | |||
1299 | trace_seq_printf(&iter->seq, "# %x buf:", field->id); | ||
1300 | |||
1301 | for (i = 0; i < iter->ent_size - offsetof(struct raw_data_entry, buf); i++) | ||
1302 | trace_seq_printf(&iter->seq, " %02x", | ||
1303 | (unsigned char)field->buf[i]); | ||
1304 | |||
1305 | trace_seq_putc(&iter->seq, '\n'); | ||
1306 | |||
1307 | return trace_handle_return(&iter->seq); | ||
1308 | } | ||
1309 | |||
1310 | static struct trace_event_functions trace_raw_data_funcs = { | ||
1311 | .trace = trace_raw_data, | ||
1312 | .raw = trace_raw_data, | ||
1313 | }; | ||
1314 | |||
1315 | static struct trace_event trace_raw_data_event = { | ||
1316 | .type = TRACE_RAW_DATA, | ||
1317 | .funcs = &trace_raw_data_funcs, | ||
1318 | }; | ||
1319 | |||
1291 | 1320 | ||
1292 | static struct trace_event *events[] __initdata = { | 1321 | static struct trace_event *events[] __initdata = { |
1293 | &trace_fn_event, | 1322 | &trace_fn_event, |
@@ -1299,6 +1328,7 @@ static struct trace_event *events[] __initdata = { | |||
1299 | &trace_bprint_event, | 1328 | &trace_bprint_event, |
1300 | &trace_print_event, | 1329 | &trace_print_event, |
1301 | &trace_hwlat_event, | 1330 | &trace_hwlat_event, |
1331 | &trace_raw_data_event, | ||
1302 | NULL | 1332 | NULL |
1303 | }; | 1333 | }; |
1304 | 1334 | ||