]> git.baikalelectronics.ru Git - kernel.git/commit
perf session: Keep file mmaped instead of malloc/memcpy
authorThomas Gleixner <tglx@linutronix.de>
Tue, 30 Nov 2010 17:49:49 +0000 (17:49 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 30 Nov 2010 22:01:08 +0000 (20:01 -0200)
commit2c10c7e86e49f83ce318ee4ee527174ee4f11a86
tree7c55a62a093b6c640114c07dd18f634a17073b97
parent683594b2db218347d41ce0f7d5ae5fb17fb74174
perf session: Keep file mmaped instead of malloc/memcpy

Profiling perf with perf revealed that a large part of the processing time is
spent in malloc/memcpy/free in the sample ordering code. That code copies the
data from the mmap into malloc'ed memory. That's silly. We can keep the mmap
and just store the pointer in the queuing data structure. For 64 bit this is
not a problem as we map the whole file anyway. On 32bit we keep 8 maps around
and unmap the oldest before mmaping the next chunk of the file.

Performance gain: 2.95s -> 1.23s (Faktor 2.4)

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20101130163820.278787719@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/session.c