btrace(8): cache ELF symbols in sorted array
Currently, every kelf_snprintsym() call performs a linear search
through the .symtab for a symbol matching the given PC. The search is
expensive and seems to be a major source of dropped profiling events.
Storing all STT_FUNC .symtab entries and their names in a sorted array
cuts search time from O(n) to O(lg n). In practice, the faster
lookups seem to dramatically reduce the profiling drop rate.
With tweaks from mpi@.
Thread: https://marc.info/?l=openbsd-tech&m=
170830125132105&w=2
ok mpi@