-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[android] build and ship libmono-profiler-aot.so #57511
[android] build and ship libmono-profiler-aot.so #57511
Conversation
Context: dotnet/android#6171 Fixes: dotnet#56989 In order for the Android workload to be able to record `.aotprof`/`.aotprofile` files, we need `libmono-profiler-aot.so` to be available. Down the road this feature could be provided by the Mono diagnostics component, but will probably not happen in .NET 6. These changes build `libmono-profiler-aot.so` for Android, and includes it in the `Microsoft.NETCore.App.Runtime.Mono.android-*` runtime packs. In the Android workload's MSBuild targets we exclude this native library unless the app is configured to record an AOT profile. I also included in `CMakeLists.txt`: target_compile_definitions(mono-profiler-aot PRIVATE -DMONO_DLL_EXPORT) Otherwise, the AOT profiler cannot be loaded: 08-12 16:01:39.817 3003 3003 I monodroid-assembly: Trying to load shared library '/data/app/com.microsoft.net6.helloandroid-4u8tNHoPAh4zSZMaf2FsnA==/lib/x86_64/libmono-profiler-aot.so' 08-12 16:01:39.818 3003 3003 W monodroid: Looking for profiler init symbol 'mono_profiler_init_aot'? 0x0 08-12 16:01:39.818 3003 3003 W monodroid: The 'aot' profiler wasn't found in the main executable nor could it be loaded from 'libmono-profiler-aot.so'. With these changes, I can successfully record an AOT profile on Android: Reading from '127.0.0.1:9999'... Read 4096 bytes... ... Read 2671 bytes... Read total 72303 bytes... Summary: Modules: 8 Types: 197 Methods: 910 Going to write the profile to 'custom.aprof' When using the profile, I get improved startup times: 08-12 16:56:33.940 1624 1874 I ActivityTaskManager: Displayed com.microsoft.net6.helloandroid/crc6490bfc84a0f5dff7a.MainActivity: +217ms
741e63c
to
a6f54f7
Compare
Is there a build artifact I can double-check the contents of the I tried to find it, but there are 100+ artifacts. |
Closing this, as we've gone the route of not supporting custom profiles in .NET 6. In some future release, support for custom profiles with the To record a profile now, I've setup a repo: https://github.com/jonathanpeppers/android-profiled-aot We setup premade profiles for |
Context: dotnet/android#6171
Fixes: #56989
In order for the Android workload to be able to record
.aotprof
/.aotprofile
files, we needlibmono-profiler-aot.so
to be available. Down the road this feature could be provided by the
Mono diagnostics component, but will probably not happen in .NET 6.
These changes build
libmono-profiler-aot.so
for Android, and includesit in the
Microsoft.NETCore.App.Runtime.Mono.android-*
runtime packs.In the Android workload's MSBuild targets we exclude this native library
unless the app is configured to record an AOT profile.
I also included in
CMakeLists.txt
:Otherwise, the AOT profiler cannot be loaded:
With these changes, I can successfully record an AOT profile on Android:
When using the profile, I get improved startup times: