Introduce dbg_printf_pevent_info() for event debugging simplification. Events are printed to STDERR, one event per line. (pevent trace_seq_do_printf() uses STDOUT, making it difficult to read through mixed powertop and trace_seq outputs).
$ powertop 2>events $ less events prev_comm=ksoftirqd/0 prev_pid=3 prev_prio=120 prev_state=0x1 next_comm=swapper/0 next_pid=0 next_prio=120 prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=0x0 next_comm=ksoftirqd/0 next_pid=3 next_prio=120 prev_comm=ksoftirqd/0 prev_pid=3 prev_prio=120 prev_state=0x1 next_comm=swapper/0 next_pid=0 next_prio=120 prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=0x0 next_comm=X next_pid=2795 next_prio=119 [..] Signed-off-by: Sergey Senozhatsky <sergey.senozhat...@gmail.com> --- src/process/do_process.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp index c030d47..7c27e08 100644 --- a/src/process/do_process.cpp +++ b/src/process/do_process.cpp @@ -186,7 +186,18 @@ int dont_blame_me(char *comm) return 0; } - +static void dbg_printf_pevent_info(struct event_format *event, struct record *rec) +{ + static struct trace_seq s; + + event->pevent->print_raw = 1; + trace_seq_init(&s); + pevent_event_info(&s, event, rec); + trace_seq_putc(&s, '\n'); + trace_seq_terminate(&s); + fprintf(stderr, "%.*s", s.len, s.buffer); + trace_seq_destroy(&s); +} void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time) { _______________________________________________ Power mailing list Power@bughost.org https://bughost.org/mailman/listinfo/power