From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751246AbbLUHzO (ORCPT ); Mon, 21 Dec 2015 02:55:14 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:33313 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988AbbLUHzM (ORCPT ); Mon, 21 Dec 2015 02:55:12 -0500 From: Namhyung Kim To: Steven Rostedt Cc: LKML , Joonsoo Kim , Namhyung Kim Subject: [PATCH] trace-cmd: Print relate stacktrace at once Date: Mon, 21 Dec 2015 16:54:26 +0900 Message-Id: <1450684466-4139-1-git-send-email-namhyung@gmail.com> X-Mailer: git-send-email 2.6.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim 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 Signed-off-by: Namhyung Kim --- 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