Skip to contentSkip to conversation

perf script: format regression due to libtraceevent

PATCH In review David Ahern 2 participants 3 messages Jun 14, 2012 – Jul 6, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf script: format regression due to libtraceevent

Consider the commands:
perf record -e sched:sched_switch -fo /tmp/perf.data -a -- sleep 1 perf script -i /tmp/perf.data

In v3.4 the output has the form (lines wrapped here)

    perf 29214 [005] 821043.582596: sched_switch:

prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

In 3.5 that same line has become:

    perf 29214 [005] 821043.582596: sched_switch:

<...>-29214 [005] 0.000000000: sched_switch:
prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

Note the duplicates in the output -- pid, cpu, event name. With this patch the v3.4 output is restored:

    perf 29214 [005] 821043.582596: sched_switch:

prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

v3:
Remove that pesky newline too. Output now matches v3.4 (pre-libtracevent).

v2:
Change print_trace_event function local to perf per Steve's comments.

CC Arnaldo Carvalho de Melo <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/trace-event-parse.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/trace-event-parse.c +1 -2
index df2fddb..5dd3b5e 100644
@@ -198,9 +198,8 @@ void print_trace_event(int cpu, void *data, int size)
 	record.data = data;
 
 	trace_seq_init(&s);
-	pevent_print_event(pevent, &s, &record);
+	pevent_event_info(&s, event, &record);
 	trace_seq_do_printf(&s);
-	printf("\n");
 }
 
 void print_event(int cpu, void *data, int size, unsigned long long nsecs,
Signature · 1 line
1.7.10.1
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · David Ahern

Consider the commands:
perf record -e sched:sched_switch -fo /tmp/perf.data -a -- sleep 1 perf script -i /tmp/perf.data

In v3.4 the output has the form (lines wrapped here)

    perf 29214 [005] 821043.582596: sched_switch:

prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

In 3.5 that same line has become:

    perf 29214 [005] 821043.582596: sched_switch:

<...>-29214 [005] 0.000000000: sched_switch:
prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

Note the duplicates in the output -- pid, cpu, event name. With this patch the v3.4 output is restored:

    perf 29214 [005] 821043.582596: sched_switch:

prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

Quoted 8 lines

v3:
Remove that pesky newline too. Output now matches v3.4 (pre-libtracevent).

v2:
Change print_trace_event function local to perf per Steve's comments.

CC Arnaldo Carvalho de Melo <[email protected]>
Cc Steven Rostedt <[email protected]>

-- Steve

Quoted 24 lines
Cc Namhyung Kim <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/trace-event-parse.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/trace-event-parse.c +1 -2
index df2fddb..5dd3b5e 100644
@@ -198,9 +198,8 @@ void print_trace_event(int cpu, void *data, int size)
 	record.data = data;
 
 	trace_seq_init(&s);
-	pevent_print_event(pevent, &s, &record);
+	pevent_event_info(&s, event, &record);
 	trace_seq_do_printf(&s);
-	printf("\n");
 }
 
 void print_event(int cpu, void *data, int size, unsigned long long nsecs,
#2 lore raw

[tip:perf/urgent] perf script: Fix format regression due to libtraceevent merge

In reply to David Ahern
Commit-ID:  76a8349dfdb775d387e9767db3092e410403138a
Gitweb:     http://git.kernel.org/tip/76a8349dfdb775d387e9767db3092e410403138a
Author:     David Ahern <[email protected]>
AuthorDate: Thu, 14 Jun 2012 12:36:17 -0600
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 2 Jul 2012 11:08:11 -0300

perf script: Fix format regression due to libtraceevent merge

Consider the commands:
perf record -e sched:sched_switch -fo /tmp/perf.data -a -- sleep 1 perf script -i /tmp/perf.data

In v3.4 the output has the form (lines wrapped here)

    perf 29214 [005] 821043.582596: sched_switch:

prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

In 3.5 that same line has become:

    perf 29214 [005] 821043.582596: sched_switch:

<...>-29214 [005] 0.000000000: sched_switch:
prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

Note the duplicates in the output -- pid, cpu, event name. With this patch the v3.4 output is restored:

    perf 29214 [005] 821043.582596: sched_switch:

prev_comm=perf prev_pid=29214 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120

v3:
Remove that pesky newline too. Output now matches v3.4 (pre-libtracevent).

v2:
Change print_trace_event function local to perf per Steve's comments.

---
 tools/perf/util/trace-event-parse.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
tools/perf/util/trace-event-parse.c +1 -2
index df2fddb..5dd3b5e 100644
@@ -198,9 +198,8 @@ void print_trace_event(int cpu, void *data, int size)
 	record.data = data;
 
 	trace_seq_init(&s);
-	pevent_print_event(pevent, &s, &record);
+	pevent_event_info(&s, event, &record);
 	trace_seq_do_printf(&s);
-	printf("\n");
 }
 
 void print_event(int cpu, void *data, int size, unsigned long long nsecs,