Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measuring the Application Launch Time #1119

Open
huan1936 opened this issue Jul 14, 2024 · 3 comments
Open

Measuring the Application Launch Time #1119

huan1936 opened this issue Jul 14, 2024 · 3 comments

Comments

@huan1936
Copy link

Is it feasible to determine the startup duration of an application using pymobiledevice3?

I understand that by emulating Xcode and integrating DYLD_PRINT_STATISTICS, one can achieve a detailed printout of the time spent during various stages of the process.
In theory, this approach should be supported.

However, it appears that this method may not be compatible with iOS versions above 15.

@doronz88
Copy link
Owner

I don't know wether this is best way, but you can still launch applications with whatever env variables you want:

pymobiledevice3 developer dvt launch com.apple.calculator --env DYLD_PRINT_STATISTICS 1

@huan1936
Copy link
Author

I don't know wether this is best way, but you can still launch applications with whatever env variables you want:我不知道这是否是最好的方法,但您仍然可以使用所需的任何环境变量启动应用程序:

pymobiledevice3 developer dvt launch com.apple.calculator --env DYLD_PRINT_STATISTICS 1pymobiledevice3 开发者 dvt 启动 com.apple.calculator --env DYLD_PRINT_STATISTICS 1

In IOS 15.0 and below, it can output the boot time, but in versions above 15.0, it doesn't. It seems to be because of this
https://forums.developer.apple.com/forums/thread/689581

arguments = []
env = {
    'DYLD_PRINT_STATISTICS': '1'
}
with DvtSecureSocketProxyService(lockdown=lockdown) as dvt:
    process_control = ProcessControl(dvt)
    pid = process_control.launch(bundle_id=test_bundle_id, arguments=arguments,
                                 kill_existing=True,
                                 start_suspended=False,
                                 environment=env)
    print(f'Process launched with pid {pid}')
    for output_received in process_control:
        print(output_received.message)

out

Total pre-main time:  99.75 milliseconds (100.0%)
         dylib loading time:  14.13 milliseconds (14.1%)
        rebase/binding time:   9.72 milliseconds (9.7%)
            ObjC setup time:   2.90 milliseconds (2.9%)
           initializer time:  72.99 milliseconds (73.1%)
           slowest intializers :
             libSystem.B.dylib :   3.37 milliseconds (3.3%)
     substitute-inserter.dylib :  37.25 milliseconds (37.3%)

@huan1936
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants