perf session: Fix list sort algorithm

The homebrewn sort algorithm fails to sort in time order. One of the problem
spots is that it fails to deal with equal timestamps correctly.

My first gut reaction was to replace the fancy list with an rbtree, but the
performance is 3 times worse.

Rewrite it so it works.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20101130163819.908482530@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Thomas Gleixner
2010-11-30 17:49:33 +00:00
committed by Arnaldo Carvalho de Melo
parent c320c7b7d3
commit a1225decc4
2 changed files with 49 additions and 68 deletions

View File

@@ -17,8 +17,8 @@ struct ordered_samples {
u64 last_flush;
u64 next_flush;
u64 max_timestamp;
struct list_head samples_head;
struct sample_queue *last_inserted;
struct list_head samples;
struct sample_queue *last_sample;
};
struct perf_session {