Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] build and ship libmono-profiler-aot.so
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
- Loading branch information