Messages in this thread Patch in this message | | | From | Josef Bacik <> | Subject | [PATCH 4/5] trace-cmd: sort the events in the profile output | Date | Fri, 8 May 2015 15:29:03 -0400 |
| |
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
| |