diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2017-11-08 11:28:54 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-02 14:42:33 +0000 |
commit | 2f6fa8a5ed177b5b342c5c2ad6abd517e1d6495a (patch) | |
tree | 1c9778594f0c82f6668a0e7b8cec25ab54a2b877 /app | |
parent | 9f2dd7f252d29de549fa1b6236a04312286adfc8 (diff) |
Prevent useless cache invalidation
Sometimes we encounter mmap events from perf that span a larger
region than dwfl will parse. In these situations, we would invalidate
the cache and then rebuild it exactly as before - i.e. we would
just waste time for no gain.
This patch checks whether this is happening and prevents the
cache invalidation to speed up the parse process. In one of my
cases this helps significantly:
Before:
Performance counter stats for './perfparser --input perf.data --output /dev/null':
19553.281950 task-clock:u (msec) # 0.998 CPUs utilized
0 context-switches:u # 0.000 K/sec
0 cpu-migrations:u # 0.000 K/sec
59,997 page-faults:u # 0.003 M/sec
58,567,488,383 cycles:u # 2.995 GHz
158,503,674,356 instructions:u # 2.71 insn per cycle
38,712,268,219 branches:u # 1979.835 M/sec
193,851,125 branch-misses:u # 0.50% of all branches
19.593726259 seconds time elapsed
After:
Performance counter stats for './perfparser --input perf.data --output /dev/null':
11775.076614 task-clock:u (msec) # 0.997 CPUs utilized
0 context-switches:u # 0.000 K/sec
0 cpu-migrations:u # 0.000 K/sec
22,747 page-faults:u # 0.002 M/sec
35,463,053,591 cycles:u # 3.012 GHz
94,541,494,541 instructions:u # 2.67 insn per cycle
23,038,811,370 branches:u # 1956.574 M/sec
120,291,747 branch-misses:u # 0.52% of all branches
11.807795955 seconds time elapsed
Change-Id: I3efdf5941c5f66cb2d38fecc8ef824c6aef245da
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/perfsymboltable.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp index 0c1a7b3..0bd45b7 100644 --- a/app/perfsymboltable.cpp +++ b/app/perfsymboltable.cpp @@ -509,6 +509,14 @@ Dwfl_Module *PerfSymbolTable::module(quint64 addr, const PerfElfMap::ElfInfo &el Dwfl_Module *mod = dwfl_addrmodule(m_dwfl, addr); + if (!mod) { + // check whether we queried for an address outside the elf range parsed + // by dwfl. If that is the case, then we would invalidate the cache and + // re-report the library again - essentially recreating the current state + // for no gain, except wasting time + mod = dwfl_addrmodule(m_dwfl, elf.addr); + } + if (mod) { // If dwfl has a module and it's not the same as what we want, report the module // we want. Many modules overlap ld.so, so if we've reported even one sample from |