[PATCH 4/5] trace-cmd: sort the events in the profile output

From: Josef Bacik
Date: Fri May 08 2015 - 15:29:34 EST


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@xxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/