All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Joonsoo Kim <js1304@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH] trace-cmd: Print relate stacktrace at once
Date: Mon, 21 Dec 2015 16:54:26 +0900	[thread overview]
Message-ID: <1450684466-4139-1-git-send-email-namhyung@gmail.com> (raw)

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


             reply	other threads:[~2015-12-21  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21  7:54 Namhyung Kim [this message]
2015-12-21 12:43 ` [PATCH] trace-cmd: Print relate stacktrace at once Joonsoo Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450684466-4139-1-git-send-email-namhyung@gmail.com \
    --to=namhyung@gmail.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.