DYLD_PRINT_STATISTICS output from device?

Hi. We can see output from dyld, when adding the DYLD_PRINT_STATISTICS=1 env var, in the XCode console when running from simulator.

When running on device the statistics are not printed in either XCode console or Console.app.

Is there a way to get this info when running an app on device?
Answered by brianindeed in 662861022
Mea culpa. I prematurely optimized my scheme before running once and had turned off some of the standard checks in the Options and Diagnostics pane.

I performed some additional tests and isolated it down to the "Main Thread Checker". If you disable that, the dlyd statistics will not be printed.

This is using XCode 12.4 on MacOS 11.1
I was surprised that this failed so I tried it here in my office. I’m on macOS 11.1 running Xcode 12.4 to target iOS 14.4. A simple iOS app with DYLD_PRINT_STATISTICS set to 1 in the scheme prints these statistics:

Code Block
Total pre-main time: 95.07 milliseconds (100.0%)
dylib loading time: 25.00 milliseconds (26.3%)
rebase/binding time: 19.75 milliseconds (20.7%)
ObjC setup time: 6.85 milliseconds (7.2%)
initializer time: 43.45 milliseconds (45.7%)
slowest intializers :
libSystem.B.dylib : 8.43 milliseconds (8.8%)
libBacktraceRecording.dylib : 9.00 milliseconds (9.4%)
libMainThreadChecker.dylib : 22.05 milliseconds (23.1%)


How are you testing this?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
Mea culpa. I prematurely optimized my scheme before running once and had turned off some of the standard checks in the Options and Diagnostics pane.

I performed some additional tests and isolated it down to the "Main Thread Checker". If you disable that, the dlyd statistics will not be printed.

This is using XCode 12.4 on MacOS 11.1
DYLD_PRINT_STATISTICS output from device?
 
 
Q