From c658045197814b7d762662f9aa9f652379121a03 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Wed, 30 Apr 2014 15:47:27 +0200 Subject: perf tools: Cache dso data file descriptor Caching dso data file descriptors to avoid expensive re-opens especially during DWARF unwind. We keep dsos data file descriptors open until their count reaches the half of the current fd open limit (RLIMIT_NOFILE). In this case we close file descriptor of the first opened dso object. We've got overall speedup (~27% for my workload) of report: 'perf report --stdio -i perf-test.data' (3 runs) (perf-test.data size was around 12GB) current code: 545,640,944,228 cycles ( +- 0.53% ) 785,255,798,320 instructions ( +- 0.03% ) 366.340910010 seconds time elapsed ( +- 3.65% ) after change: 435,895,036,114 cycles ( +- 0.26% ) 636,790,271,176 instructions ( +- 0.04% ) 266.481463387 seconds time elapsed ( +- 0.13% ) Acked-by: Namhyung Kim Cc: Arnaldo Carvalho de Melo Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jean Pihet Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1401892622-30848-7-git-send-email-jolsa@kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/unwind-libunwind.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools/perf/util/unwind-libunwind.c') diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 4f8dd9ee3899..25578b98f5c5 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c @@ -250,7 +250,6 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, /* Check the .eh_frame section for unwinding info */ offset = elf_section_offset(fd, ".eh_frame_hdr"); - dso__data_close(dso); if (offset) ret = unwind_spec_ehframe(dso, machine, offset, @@ -271,7 +270,6 @@ static int read_unwind_spec_debug_frame(struct dso *dso, /* Check the .debug_frame section for unwinding info */ *offset = elf_section_offset(fd, ".debug_frame"); - dso__data_close(dso); if (*offset) return 0; -- cgit v1.2.3-59-g8ed1b