[android] build and ship libmono-profiler-aot.so#57511
Closed
jonathanpeppers wants to merge 1 commit intodotnet:mainfrom
Closed
[android] build and ship libmono-profiler-aot.so#57511jonathanpeppers wants to merge 1 commit intodotnet:mainfrom
jonathanpeppers wants to merge 1 commit intodotnet:mainfrom
Conversation
lambdageek
reviewed
Aug 16, 2021
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
akoeplinger
approved these changes
Aug 16, 2021
Member
Author
|
Is there a build artifact I can double-check the contents of the I tried to find it, but there are 100+ artifacts. |
Member
Author
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: dotnet/android#6171
Fixes: #56989
In order for the Android workload to be able to record
.aotprof/.aotprofilefiles, we needlibmono-profiler-aot.soto 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.sofor 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: