I'm trying to figure out how much time I'm taking in loading shared libraries on a linux system (RHEL 6 to be specific) and I'm wondering what sort of tools are out there to time how long shared library loading takes. I haven't really found any good information out there as to how to do this and I'm hoping some sort of tool exists.
You should run under LD_DEBUG=statistics
:
$ LD_DEBUG=statistics ls > /dev/null
9897:
9897: runtime linker statistics:
9897: total startup time in dynamic loader: 1557664 clock cycles
9897: time needed for relocation: 322049 clock cycles (20.6%)
9897: number of relocations: 156
9897: number of relocations from cache: 8
9897: number of relative relocations: 1257
9897: time needed to load objects: 1037549 clock cycles (66.6%)