How to profile initialization function call time when dyld loads an image?

Now I'm trying to optimize the startup time of the application and currently I want to reduce the time spent by the bootloader of the OS image.

From dyld (1), I found two environment variables: DYLD_PRINT_STATISTICSand DYLD_PRINT_INITIALIZERS.

DYLD_PRINT_STATISTICScauses dyld to print statistics about how dyld spent his time. This is his conclusion when I launched the application after the command purge.

total time: 5.9 seconds (100.0%)
total images loaded:  130 (101 from dyld shared cache, 0 needed no fixups)
total segments mapped: 105, into 12914 pages with 840 pages pre-fetched
total images loading time: 1.8 seconds (31.0%)
total dtrace DOF registration time: 0.09 milliseconds (0.0%)
total rebase fixups:  137,658
total rebase fixups time: 1.1 seconds (19.4%)
total binding fixups: 28,502
total binding symbol lookups: 1,127, average images searched per symbol: 0.1
total binding fixups time: 452.28 milliseconds (7.6%)
total weak binding fixups time: 188.52 milliseconds (3.1%)
total bindings lazily fixed up: 130 of 1,164
total initializer time: 2.3 seconds (38.7%)
total symbol trie searches:    2611
total symbol table binary searches:    118
total images defining/using weak symbols:  13/65

Apparently, when calling the initializer functions, a lot of time is used. So I tried to DYLD_PRINT_INITIALIZERSget a list of initializer functions.

I really got them, but there was no time information on them, for example, time stamp, just a few lines:

dyld: calling initializer function 0x25170 in MY_APPLICATE_PATH

It is useless for me to find the target initializers for optimization.

, :

  • dyld?
  • , - , dyld? DTrace Instruments?
  • .

OSX, Windows.

+3
1

?

, DLL . , , , , , .

, , , - , , . : , , , , ..

0

Source: https://habr.com/ru/post/1765478/


All Articles