Skip to contentSkip to conversation

tools lib traceeveent: Allow for negative numbers in print format

PATCH Applied Steven Rostedt 4 participants 4 messages Aug 27, 2015 – Aug 31, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools lib traceeveent: Allow for negative numbers in print format

It was reported that "%-8s" does not parse well when used in the printk format. The '-' is what is throwing it off. Allow that to be included.

---
 tools/lib/traceevent/event-parse.c | 1 +
 1 file changed, 1 insertion(+)
tools/lib/traceevent/event-parse.c +1 -0
index cc25f059ab3d..3b01ae137d95 100644
@@ -4754,6 +4754,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 			case 'z':
 			case 'Z':
 			case '0' ... '9':
+			case '-':
 				goto cont_process;
 			case 'p':
 				if (pevent->long_size == 4)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · Steven Rostedt

It was reported that "%-8s" does not parse well when used in the printk format. The '-' is what is throwing it off. Allow that to be included.

Example before:
transhuge-stres-10730 [004] 5897.713989: mm_compaction_finished: node=0 zone=>-<8s order=-2119871790 ret=

Example after:
transhuge-stres-4235 [000] 453.149280: mm_compaction_finished: node=0 zone=ffffffff81815d7a order=9 ret=

(I will send patches to fix the string handling in the tracepoints so it's on par with in-kernel printing via trace_pipe:)

transhuge-stres-10921 [007] ...1 6307.140205: mm_compaction_finished: node=0 zone=Normal order=9 ret=partial

Quoted 18 lines
---
  tools/lib/traceevent/event-parse.c | 1 +
  1 file changed, 1 insertion(+)
tools/lib/traceevent/event-parse.c +1 -0
index cc25f059ab3d..3b01ae137d95 100644
@@ -4754,6 +4754,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
  			case 'z':
  			case 'Z':
  			case '0' ... '9':
+			case '-':
  				goto cont_process;
  			case 'p':
  				if (pevent->long_size == 4)
#2 lore raw

Em Thu, Aug 27, 2015 at 03:55:56PM +0200, Vlastimil Babka escreveu:

Quoted 17 lines · Steven Rostedt
Quoted 5 lines

It was reported that "%-8s" does not parse well when used in the printk format. The '-' is what is throwing it off. Allow that to be included.

Example before:
transhuge-stres-10730 [004] 5897.713989: mm_compaction_finished: node=0 zone=>-<8s order=-2119871790 ret=

Example after:
transhuge-stres-4235 [000] 453.149280: mm_compaction_finished: node=0
zone=ffffffff81815d7a order=9 ret=

Quoted 5 lines

(I will send patches to fix the string handling in the tracepoints so it's on par with in-kernel printing via trace_pipe:)

transhuge-stres-10921 [007] ...1 6307.140205: mm_compaction_finished:
node=0 zone=Normal order=9 ret=partial

Thanks, applied and added the before/after reporter notes. It is now in my perf/core branch.

- Arnaldo

Quoted 18 lines
Quoted 18 lines
---
 tools/lib/traceevent/event-parse.c | 1 +
 1 file changed, 1 insertion(+)
tools/lib/traceevent/event-parse.c +1 -0
index cc25f059ab3d..3b01ae137d95 100644
@@ -4754,6 +4754,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 			case 'z':
 			case 'Z':
 			case '0' ... '9':
+			case '-':
 				goto cont_process;
 			case 'p':
 				if (pevent->long_size == 4)
#3 lore raw
In reply to Steven Rostedt
tools lib traceeveent: Allow for negative numbers in print format
Commit-ID:  1d945012d1381f0232ea2d66e32b06182eedb476
Gitweb:     http://git.kernel.org/tip/1d945012d1381f0232ea2d66e32b06182eedb476
Author:     Steven Rostedt <[email protected]>
AuthorDate: Thu, 27 Aug 2015 09:46:01 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 28 Aug 2015 11:47:40 -0300

tools lib traceeveent: Allow for negative numbers in print format

It was reported that "%-8s" does not parse well when used in the printk format. The '-' is what is throwing it off. Allow that to be included.

Reporter note:

Example before:

transhuge-stres-10730 [004] 5897.713989: mm_compaction_finished: node=0 zone=>-<8s order=-2119871790 ret=

Example after:

transhuge-stres-4235 [000] 453.149280: mm_compaction_finished: node=0
zone=ffffffff81815d7a order=9 ret=

(I will send patches to fix the string handling in the tracepoints so it's on par with in-kernel printing via trace_pipe:)

transhuge-stres-10921 [007] ...1 6307.140205: mm_compaction_finished: node=0
zone=Normal order=9 ret=partial

---
 tools/lib/traceevent/event-parse.c | 1 +
 1 file changed, 1 insertion(+)
tools/lib/traceevent/event-parse.c +1 -0
index 5c1867a..4d88593 100644
@@ -4828,6 +4828,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 			case 'z':
 			case 'Z':
 			case '0' ... '9':
+			case '-':
 				goto cont_process;
 			case 'p':
 				if (pevent->long_size == 4)