Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Do not waste time calling libunwind get_proc_name in the hot spots
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 18 Feb 2014 10:38:14 +0000 (11:38 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 18 Feb 2014 15:00:10 +0000 (16:00 +0100)
In typical executions, nearly 50% of the time was spent in libunwind
get_proc_name.

The algorithm to find the function for a given IP (instruction
pointer) was:

  (proc_name, offset) = get_proc_name(ip) // Slow!
  dwarf_ip = ip - offset
  function = functions_by_name[proc_name]

We added a structure mapping IP ranges to functions and the algorithm
is now:

  function = functions_by_ip[ip]

Instead of relying on libunwind, we use the DWARF information to find
the corresponding DWARF TAG_subprogram DIEs directly.

The secution time on some MPICH tests is nearly halved.

Notes:

 * It was necessary to disable the support for inlined_subprograms
   which was broken anyway: the inlined_subprogram entries should be
   stored as children of their parent subprogram (as a block). We need
   to add support for scope blocks inside a suprogram to handle this
   correctly.

 * Currently the translation between process virtual addresses and
   DWARF virtual addresses is handled in many different places. We
   should change this to process it only when parsing the DWARF DIEs
   and be done with it.


No differences found