Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932540AbbEHT3a (ORCPT ); Fri, 8 May 2015 15:29:30 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42862 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932483AbbEHT3Y (ORCPT ); Fri, 8 May 2015 15:29:24 -0400 From: Josef Bacik To: , , Subject: [PATCH 4/5] trace-cmd: sort the events in the profile output Date: Fri, 8 May 2015 15:29:03 -0400 Message-ID: <1431113344-22579-5-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1431113344-22579-1-git-send-email-jbacik@fb.com> References: <1431113344-22579-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.52.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-05-08_07:2015-05-08,2015-05-08,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1115 Lines: 40 Currently we just spit out the events as they appear in the hash, which makes it hard to tell where we are spending our time. Instead order the output by type and total time spent. So you'll get something like this syscall 1: 100000ms syscall 2: 80000ms syscall 3: 4ms func 1: 10ms func 2: 1ms instead of them all jumbled up. Signed-off-by: Josef Bacik --- trace-profile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trace-profile.c b/trace-profile.c index 0b84c11..3a9a9f3 100644 --- a/trace-profile.c +++ b/trace-profile.c @@ -1961,6 +1961,10 @@ static int compare_events(const void *a, const void *b) return 1; if (event_data_a->id < event_data_b->id) return -1; + if ((*A)->time_total > (*B)->time_total) + return -1; + if ((*A)->time_total < (*B)->time_total) + return 1; return 0; } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/