mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <rostedt@goodmis.org>, <linux-kernel@vger.kernel.org>,
	<kernel-team@fb.com>
Subject: [PATCH 4/5] trace-cmd: sort the events in the profile output
Date: Fri, 8 May 2015 15:29:03 -0400	[thread overview]
Message-ID: <1431113344-22579-5-git-send-email-jbacik@fb.com> (raw)
In-Reply-To: <1431113344-22579-1-git-send-email-jbacik@fb.com>

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 <jbacik@fb.com>
---
 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


  parent reply	other threads:[~2015-05-08 19:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 19:28 [PATCH 0/5] trace-cmd profile enhancements Josef Bacik
2015-05-08 19:29 ` [PATCH 1/5] trace-cmd: add option to group like comms for profile Josef Bacik
2015-05-20 17:31   ` Steven Rostedt
2015-05-20 17:51     ` Josef Bacik
2015-05-08 19:29 ` [PATCH 2/5] trace-cmd: group schedule stacktraces together with --merge Josef Bacik
2015-05-20 17:36   ` Steven Rostedt
2015-05-20 17:54     ` Josef Bacik
2015-05-08 19:29 ` [PATCH 3/5] trace-cmd: lookup syscall names in profile Josef Bacik
2015-05-20 18:00   ` Steven Rostedt
2015-05-20 18:22     ` Josef Bacik
2015-05-20 18:56       ` Steven Rostedt
2015-05-20 19:01         ` Steven Rostedt
2015-05-20 19:06           ` Josef Bacik
2015-05-08 19:29 ` Josef Bacik [this message]
2015-05-08 19:29 ` [PATCH 5/5] trace-cmd: make trace-hist work with instances Josef Bacik
2015-05-08 20:13 ` [PATCH 0/5] trace-cmd profile enhancements Steven Rostedt

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=1431113344-22579-5-git-send-email-jbacik@fb.com \
    --to=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome