在 linux 上计时共享库加载时间

Timing shared library load times on linux

我想弄清楚我在 linux 系统(具体是 RHEL 6)上加载共享库需要多少时间,我想知道那里有哪些工具计时共享库加载需要多长时间。我还没有真正找到任何关于如何执行此操作的有用信息,我希望存在某种工具。

你应该 运行 在 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%)