diff options
author | Josef Bacik <jbacik@fb.com> | 2015-05-08 15:29:03 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-06-10 15:11:58 -0400 |
commit | 86a3d04c2eeb2d66a78fd4c3ddfb424b6891bbc8 (patch) | |
tree | cf94e2e09cc8f2d15e48551dbe3e9ee61441a71f | |
parent | b9f9bbc7300d582d4aa4c646fb49069c02bf0411 (diff) | |
download | trace-cmd-86a3d04c2eeb2d66a78fd4c3ddfb424b6891bbc8.tar.gz |
trace-cmd: Sort the events in the profile output
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.
Link: http://lkml.kernel.org/r/1431113344-22579-5-git-send-email-jbacik@fb.com
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-profile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/trace-profile.c b/trace-profile.c index 640dca82..2cb9e582 100644 --- a/trace-profile.c +++ b/trace-profile.c @@ -1883,6 +1883,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; } |