dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k stars 531 forks source link

Support recording custom AOT profiles #7722

Open Eilon opened 1 year ago

Eilon commented 1 year ago

Issue moved from dotnet/maui#10237


From @sake402 on Wednesday, September 21, 2022 12:51:20 PM

Description

With a maui application dotnet build -t:BuildAndStartAotProfiling returns an error

Steps to Reproduce

dotnet add package Mono.AotProfiler.Android
dotnet build -t:BuildAndStartAotProfiling

Produces error

 error MSB4057: The target "BuildAndStartAotProfiling" does not exist in the project.

Link to public reproduction project repository

None

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 21

Did you find any workaround?

No response

Relevant log output

No response

Eilon commented 1 year ago

Issue moved from dotnet/maui#10237


From @msftbot[bot] on Wednesday, September 21, 2022 6:14:59 PM

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

jonathanpeppers commented 1 year ago

Recording custom profiles is not yet fully supported in .NET 6 and 7. I have an experimental package to enable this at:

https://github.com/jonathanpeppers/Mono.Profiler.Android

We began the process of replacing libmono-profiler-aot.so with new .NET features:

It was not ready in time for .NET 7, but we may be able to revisit in .NET 8.

MitchBomcanhao commented 9 months ago

any news on this front?

jonathanpeppers commented 9 months ago

This lists the blockers:

I think the main issue, is dotnet-pgo is not distributed on NuGet.org. So waiting from the .NET teamt to see how that could be released where we can depend on it.

themronion commented 9 months ago

@jonathanpeppers but i successfully managed to record a profile using that experimental nuget just by specifying the android TF. That's exactly what the OP was missing in order for it to work. Or we shouldn't use that package anymore and wait?

jonathanpeppers commented 9 months ago

@themronion you can use the experimental package, it's what we still use for the Android and MAUI workloads:

https://github.com/dotnet/maui/blob/0e61f5ecc51c65d8fa0bbfce89e8c5774d0e417f/src/ProfiledAot/src/Directory.Build.targets#L10

crui3er commented 7 months ago

@jonathanpeppers Am I correct that using mibc profiles is not yet possible in MAUI .NET8 or there is any way to benefit from using them?

jonathanpeppers commented 7 months ago

The questions in using .mibc are listed here:

It might be something that comes in .NET 9, but the only benefit being it's "more supported" than the old Mono format.