Skip to content

Commit

Permalink
tracing: Be more clever when dumping hex in __print_hex()
Browse files Browse the repository at this point in the history
Hex dump as many as 16 bytes at once in trace_print_hex_seq()
instead of byte-by-byte approach.

Link: http://lkml.kernel.org/r/20190806151543.86061-1-andriy.shevchenko@linux.intel.com

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Andy Shevchenko authored and Steven Rostedt (VMware) committed Sep 17, 2019
1 parent 0846875 commit 119cdbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/trace/trace_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len,
{
int i;
const char *ret = trace_seq_buffer_ptr(p);
const char *fmt = concatenate ? "%*phN" : "%*ph";

for (i = 0; i < buf_len; i++)
trace_seq_printf(p, "%s%2.2x", concatenate || i == 0 ? "" : " ",
buf[i]);
for (i = 0; i < buf_len; i += 16)
trace_seq_printf(p, fmt, min(buf_len - i, 16), &buf[i]);
trace_seq_putc(p, 0);

return ret;
Expand Down

0 comments on commit 119cdbd

Please sign in to comment.