iOS app launch time measurement

后端 未结 6 1781
醉梦人生
醉梦人生 2021-02-15 17:19

How can I count the time it takes from the moment the user presses the launch button on the home screen until the moment the app is active (for example, until the viewDidAppear

6条回答
  •  [愿得一人]
    2021-02-15 18:14

    You can go to edit scheme on Xcode and add a environment variable (DYLD_PRINT_STATISTICS = 1) as shown in the image

    When you run the app the details will be printed on debugger output as below:

    Total pre-main time: 481.88 milliseconds (100.0%)
             dylib loading time:  71.70 milliseconds (14.8%)
            rebase/binding time:  53.66 milliseconds (11.1%)
                ObjC setup time:  40.04 milliseconds (8.3%)
               initializer time: 316.33 milliseconds (65.6%)
               slowest intializers :
                 libSystem.B.dylib :  16.71 milliseconds (3.4%)
    

    Please watch the video for more details.

提交回复
热议问题