DYLD_PRINT_STATISTICS not showing anything
Asked Answered
S

2

8

I'm trying to profile app startup after moving from static libraries to frameworks. We have 30 or so frameworks (fyi: cocoapods) so I want to check that it's not affecting performance. Anecdotal testing in the team says that it isn't, but I would like some numbers as well!

I've added the environment variables DYLD_PRINT_STATISTICS and DYLD_PRINT_LIBRARIES to see what the linker is doing, but all the output I get is from the DYLD_PRINT_LIBRARIES variable. I can see that the frameworks are loading correctly, but get no statistics from them.

I've tried restarting the device to make sure that the frameworks aren't in memory already but that hasn't helped.

Any other suggestions as to why I'm not getting any output from DYLD_PRINT_STATISTICS?

Suffering answered 18/11, 2015 at 9:52 Comment(7)
DYLD_PRINT_STATISTICS only seems to work on the simulator for me.Kotick
@RhythmicFistman I'm trying on the simulator :(Suffering
that's weird. what xcode version/sim version/sim device/deployment target? guessing now.Kotick
@RhythmicFistman Sigh, turns out I had the simulator running on my monitor but it was actually building to a real device I had plugged in; as soon as I unplugged it and actually targeted the simulator the output appeared :) If you move your comment to be an answer I'll mark it as accepted.Suffering
thanks! I rounded the comment out with extra speculationKotick
You are not running on the iPhone, useful in the simulatorBibbs
Your iPhone system must be iOS 10Bibbs
K
4

While other flags, like DYLD_PRINT_BINDINGS work fine on the device, DYLD_PRINT_STATISTICS only seems to work on the simulator (for me, iOS 9.0).

In this (possibly unrelated) version of dyld.cpp, from osx 10.10.5 there doesn't seem to be any obvious exclusion of DYLD_PRINT_STATISTICS for devices, although there are conditionally compiled TARGET_IPHONE_SIMULATORs sprinkled throughout the code.

I guess it's a bug.

Kotick answered 24/11, 2015 at 21:20 Comment(2)
This now works on device as well since iOS 10. Highly recommend watching developer.apple.com/videos/play/wwdc2016/406Phenolphthalein
OMG!!! DYLD_PRINT_BINDINGS make console get crazy! console printing soooooooooo many log on my iPhone 5S (8.3) device...Batholith
A
13

Looks like you can do it on device if you enable both environment variables in your scheme: DYLD_PRINT_APIS = YES DYLD_PRINT_STATISTICS = YES

Reference: https://github.com/artsy/eigen/issues/586#issuecomment-118606377

Anthracene answered 9/2, 2016 at 18:55 Comment(2)
This works now without adding the first variable i.e 'DYLD_PRINT_APIS' now. Apple mentioned they've improved this in WWDC 2016, developer.apple.com/videos/play/wwdc2016/406. Skip to 26:00. Tested on Xcode 9.1. Works perfectly fine. :)Padova
On an iPhone 4S running iOS 9.3.5, DYLD_PRINT_APIS was the solution for me. DYLD_PRINT_BINDINGS as mentioned by @Meilbn will print so many stuff that I won't even get to actually launch the app after minutes of crazy logging.Invercargill
K
4

While other flags, like DYLD_PRINT_BINDINGS work fine on the device, DYLD_PRINT_STATISTICS only seems to work on the simulator (for me, iOS 9.0).

In this (possibly unrelated) version of dyld.cpp, from osx 10.10.5 there doesn't seem to be any obvious exclusion of DYLD_PRINT_STATISTICS for devices, although there are conditionally compiled TARGET_IPHONE_SIMULATORs sprinkled throughout the code.

I guess it's a bug.

Kotick answered 24/11, 2015 at 21:20 Comment(2)
This now works on device as well since iOS 10. Highly recommend watching developer.apple.com/videos/play/wwdc2016/406Phenolphthalein
OMG!!! DYLD_PRINT_BINDINGS make console get crazy! console printing soooooooooo many log on my iPhone 5S (8.3) device...Batholith

© 2022 - 2024 — McMap. All rights reserved.