lkml.org 
[lkml]   [2015]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/5] trace-cmd: sort the events in the profile output
Date
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


\
 
 \ /
  Last update: 2015-05-08 21:41    [W:0.117 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site