All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: Print relate stacktrace at once
@ 2015-12-21  7:54 Namhyung Kim
  2015-12-21 12:43 ` Joonsoo Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2015-12-21  7:54 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Joonsoo Kim, Namhyung Kim

From: Namhyung Kim <namhyung@kernel.org>

Currently trace-cmd prints ring buffer events in a strict time order.
But it sometimes annoying that stacktrace from the same cpu can be
intermixed with events from other cpu.  This patch looks next event when
print last record and prints it also if it's a stacktrace (from the same
cpu).

Requested-by: Joonsoo Kim <js1304@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 trace-read.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/trace-read.c b/trace-read.c
index aec8532..10edf5d 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -1155,9 +1155,20 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
 			}
 		}
 		if (last_record) {
+			int last_cpu = last_record->cpu;
+
 			print_handle_file(last_handle);
 			trace_show_data(last_handle->handle, last_record, profile);
 			free_handle_record(last_handle);
+
+			/* print related stacktrace at once */
+			record = tracecmd_peek_data(last_handle->handle, last_cpu);
+			if (record && pevent_data_type(pevent, record) == stacktrace_id &&
+			    test_stacktrace(last_handle, record, 1)) {
+				print_handle_file(last_handle);
+				trace_show_data(last_handle->handle, record, profile);
+				tracecmd_read_data(last_handle->handle, last_cpu);
+			}
 		}
 	} while (last_record);
 
-- 
2.6.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] trace-cmd: Print relate stacktrace at once
  2015-12-21  7:54 [PATCH] trace-cmd: Print relate stacktrace at once Namhyung Kim
@ 2015-12-21 12:43 ` Joonsoo Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Joonsoo Kim @ 2015-12-21 12:43 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Steven Rostedt, LKML, Namhyung Kim

2015-12-21 16:54 GMT+09:00 Namhyung Kim <namhyung@gmail.com>:
> From: Namhyung Kim <namhyung@kernel.org>
>
> Currently trace-cmd prints ring buffer events in a strict time order.
> But it sometimes annoying that stacktrace from the same cpu can be
> intermixed with events from other cpu.  This patch looks next event when
> print last record and prints it also if it's a stacktrace (from the same
> cpu).
>
> Requested-by: Joonsoo Kim <js1304@gmail.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Good Job!
I tested it and it seems that it works well for me.

Thanks!!!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-21 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21  7:54 [PATCH] trace-cmd: Print relate stacktrace at once Namhyung Kim
2015-12-21 12:43 ` Joonsoo Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.