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

[android] update built-in AOT profile #4355

Merged
merged 1 commit into from Jan 28, 2022

Conversation

jonathanpeppers
Copy link
Member

Description of Change

Context: https://github.com/jonathanpeppers/android-profiled-aot#updating-dotnetmauis-profile

I recorded a new AOT profile using 34e1af5b.

Results

A dotnet new maui app using:

dotnet build -c Release -p:RunAOTCompilation=true -p:AndroidEnableProfiledAot=true

On a Pixel 5:

01-27 11:40:57.762 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +641ms
01-27 11:41:03.576 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +594ms
01-27 11:41:09.314 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +607ms
01-27 11:41:15.062 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +615ms
01-27 11:41:20.707 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +600ms
01-27 11:41:26.345 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +599ms
01-27 11:41:31.999 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +597ms
01-27 11:41:37.752 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +652ms
01-27 11:41:43.292 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +618ms
01-27 11:41:49.060 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +599ms
Average(ms): 612.2
Std Err(ms): 6.27304639797213
Std Dev(ms): 19.837114485507

This is an improvement on the 648.9 number I got in Preview 12:

https://github.com/jonathanpeppers/maui-profiling

Contents

Modules:
    AFA8E8E0-188C-44AC-97D2-4981065AEE61 System.Private.CoreLib
    2C5D6600-5830-43C1-8ACE-CD4A4681C839 Mono.Android
    F9F7D74D-5E67-4873-A1DC-0CF8237DC604 Java.Interop
    7F9085AD-A4DF-41D4-A983-004F1E5032AA Microsoft.Maui.Essentials
    E09CFE39-03E2-446E-8A9D-3880D5719C16 Xamarin.AndroidX.Core
    5EC947A4-71F6-4774-98E8-A7503CCA2A2A Microsoft.Maui
    D1B7B075-D64D-4D75-AA20-30111F6AD22A Microsoft.Extensions.Hosting
    BE27BC14-BB3B-4617-B7AE-47E46EA76E4D Microsoft.Extensions.DependencyInjection
    D6AE9D0A-8F06-48AA-8261-19C2A4A75B4F Microsoft.Extensions.DependencyInjection.Abstractions
    C360ED5A-84FC-4CA2-A4F3-AF68645CA61A Microsoft.Extensions.Configuration
    150D5AFA-1F85-472F-A3D9-0B7E6DF2C91F Microsoft.Extensions.Primitives
    07C72DBB-AF8E-4F50-96E5-9504043A5132 Microsoft.Extensions.Hosting.Abstractions
    3AA96B92-4634-48DB-B439-7B91294CFCA8 Microsoft.Extensions.Configuration.FileExtensions
    E5B664A7-1508-4A90-8521-476BC92F9D89 Microsoft.Extensions.FileProviders.Physical
    DAD01428-CE5D-4331-B51F-2F1BEBBFEB12 System.Linq
    E30041EE-D7DF-4AF4-9980-66A580367BB3 Microsoft.Extensions.Logging
    A0472EA3-01E4-4ECB-B346-61F97A41D7BD Microsoft.Extensions.Options
    C8A3B504-5837-48B2-8944-E1A241EA667F Microsoft.Extensions.Logging.Configuration
    6F3D37FE-64B6-4DED-9CEC-913E27FAFEA6 Microsoft.Extensions.Options.ConfigurationExtensions
    2BB8D273-FE6D-4FE0-8A1B-C830F9F0E94C Microsoft.Extensions.Logging.Debug
    8D753B1F-0719-4421-A347-FA697C9E3FD8 Microsoft.Maui.Controls.Compatibility
    B3226C46-45BD-4EA6-BEE7-0065E74DC273 Microsoft.Maui.Controls
    89437B8B-AFD1-4856-8DA6-703892E665E7 Microsoft.Maui.Graphics
    A1B73301-C857-4856-9D5C-D3CE4B7F3349 System.ComponentModel.TypeConverter
    C8B80A37-8245-4477-9788-6F4CC6952583 System.Diagnostics.DiagnosticSource
    177FE67B-5DEE-4A7F-9D86-8792ED5C7F4B System.Collections.Concurrent
    ABC0B7B0-B4AA-4F61-9DB6-6FFFB7D909EC Microsoft.Extensions.Configuration.Binder
    A9F0B481-2DFA-410C-930C-69EC60F0062F Microsoft.Extensions.Configuration.Abstractions
    4566F9C0-1350-4113-86CD-BC7AF26BF2C2 Microsoft.Extensions.Logging.Abstractions
    29A29251-965A-4222-8EAA-9DD18F0F5B5D System.Linq.Expressions
    26EEE18D-AB53-4253-B02F-F1415C56DF25 System.ObjectModel
    27F247BB-DB83-4E10-9097-33DAD79F7CE6 Microsoft.Maui.Controls.Xaml
    34BBF2BB-300E-4067-A3B1-88E0579B7864 System.Private.Xml
    62DBA4BE-3AF6-4AA7-B70F-5BA1ABF24515 System.Private.Uri
    F799812F-0375-4EAB-96A1-17B7BABC0ED3 Xamarin.AndroidX.AppCompat
    7DA05D10-E446-49A9-8474-961D044AA227 Xamarin.AndroidX.Fragment
    E38970FA-F8EB-4F0C-B6D8-C5D7907E0C14 Xamarin.AndroidX.Activity
    7141226E-3975-47E1-89D8-19A895A27B11 Xamarin.Google.Android.Material
    61FEE203-0C6E-4ED0-972C-99CCF097F283 Xamarin.AndroidX.CoordinatorLayout
    7A603D2D-7EAF-475E-8B8E-67C754ED4578 System.Collections
Summary:
    Modules:         40  (of 41)
    Types:        1,142  (of 1240)
    Methods:      5,415  (of 5429)

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the WinUI, Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

No

Context: https://github.com/jonathanpeppers/android-profiled-aot#updating-dotnetmauis-profile

I recorded a new AOT profile using dotnet/maui@34e1af5b.

~~ Results ~~

A `dotnet new maui` app using:

    dotnet build -c Release -p:RunAOTCompilation=true -p:AndroidEnableProfiledAot=true

On a Pixel 5:

    01-27 11:40:57.762 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +641ms
    01-27 11:41:03.576 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +594ms
    01-27 11:41:09.314 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +607ms
    01-27 11:41:15.062 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +615ms
    01-27 11:41:20.707 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +600ms
    01-27 11:41:26.345 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +599ms
    01-27 11:41:31.999 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +597ms
    01-27 11:41:37.752 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +652ms
    01-27 11:41:43.292 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +618ms
    01-27 11:41:49.060 1867 2226 I ActivityTaskManager: Displayed com.androidaot.MauiApp1/MauiApp1.MainActivity: +599ms
    Average(ms): 612.2
    Std Err(ms): 6.27304639797213
    Std Dev(ms): 19.837114485507

This is an improvement on the 648.9 number I got in Preview 12:

https://github.com/jonathanpeppers/maui-profiling

~~ Contents ~~

    Modules:
        AFA8E8E0-188C-44AC-97D2-4981065AEE61 System.Private.CoreLib
        2C5D6600-5830-43C1-8ACE-CD4A4681C839 Mono.Android
        F9F7D74D-5E67-4873-A1DC-0CF8237DC604 Java.Interop
        7F9085AD-A4DF-41D4-A983-004F1E5032AA Microsoft.Maui.Essentials
        E09CFE39-03E2-446E-8A9D-3880D5719C16 Xamarin.AndroidX.Core
        5EC947A4-71F6-4774-98E8-A7503CCA2A2A Microsoft.Maui
        D1B7B075-D64D-4D75-AA20-30111F6AD22A Microsoft.Extensions.Hosting
        BE27BC14-BB3B-4617-B7AE-47E46EA76E4D Microsoft.Extensions.DependencyInjection
        D6AE9D0A-8F06-48AA-8261-19C2A4A75B4F Microsoft.Extensions.DependencyInjection.Abstractions
        C360ED5A-84FC-4CA2-A4F3-AF68645CA61A Microsoft.Extensions.Configuration
        150D5AFA-1F85-472F-A3D9-0B7E6DF2C91F Microsoft.Extensions.Primitives
        07C72DBB-AF8E-4F50-96E5-9504043A5132 Microsoft.Extensions.Hosting.Abstractions
        3AA96B92-4634-48DB-B439-7B91294CFCA8 Microsoft.Extensions.Configuration.FileExtensions
        E5B664A7-1508-4A90-8521-476BC92F9D89 Microsoft.Extensions.FileProviders.Physical
        DAD01428-CE5D-4331-B51F-2F1BEBBFEB12 System.Linq
        E30041EE-D7DF-4AF4-9980-66A580367BB3 Microsoft.Extensions.Logging
        A0472EA3-01E4-4ECB-B346-61F97A41D7BD Microsoft.Extensions.Options
        C8A3B504-5837-48B2-8944-E1A241EA667F Microsoft.Extensions.Logging.Configuration
        6F3D37FE-64B6-4DED-9CEC-913E27FAFEA6 Microsoft.Extensions.Options.ConfigurationExtensions
        2BB8D273-FE6D-4FE0-8A1B-C830F9F0E94C Microsoft.Extensions.Logging.Debug
        8D753B1F-0719-4421-A347-FA697C9E3FD8 Microsoft.Maui.Controls.Compatibility
        B3226C46-45BD-4EA6-BEE7-0065E74DC273 Microsoft.Maui.Controls
        89437B8B-AFD1-4856-8DA6-703892E665E7 Microsoft.Maui.Graphics
        A1B73301-C857-4856-9D5C-D3CE4B7F3349 System.ComponentModel.TypeConverter
        C8B80A37-8245-4477-9788-6F4CC6952583 System.Diagnostics.DiagnosticSource
        177FE67B-5DEE-4A7F-9D86-8792ED5C7F4B System.Collections.Concurrent
        ABC0B7B0-B4AA-4F61-9DB6-6FFFB7D909EC Microsoft.Extensions.Configuration.Binder
        A9F0B481-2DFA-410C-930C-69EC60F0062F Microsoft.Extensions.Configuration.Abstractions
        4566F9C0-1350-4113-86CD-BC7AF26BF2C2 Microsoft.Extensions.Logging.Abstractions
        29A29251-965A-4222-8EAA-9DD18F0F5B5D System.Linq.Expressions
        26EEE18D-AB53-4253-B02F-F1415C56DF25 System.ObjectModel
        27F247BB-DB83-4E10-9097-33DAD79F7CE6 Microsoft.Maui.Controls.Xaml
        34BBF2BB-300E-4067-A3B1-88E0579B7864 System.Private.Xml
        62DBA4BE-3AF6-4AA7-B70F-5BA1ABF24515 System.Private.Uri
        F799812F-0375-4EAB-96A1-17B7BABC0ED3 Xamarin.AndroidX.AppCompat
        7DA05D10-E446-49A9-8474-961D044AA227 Xamarin.AndroidX.Fragment
        E38970FA-F8EB-4F0C-B6D8-C5D7907E0C14 Xamarin.AndroidX.Activity
        7141226E-3975-47E1-89D8-19A895A27B11 Xamarin.Google.Android.Material
        61FEE203-0C6E-4ED0-972C-99CCF097F283 Xamarin.AndroidX.CoordinatorLayout
        7A603D2D-7EAF-475E-8B8E-67C754ED4578 System.Collections
    Summary:
        Modules:         40  (of 41)
        Types:        1,142  (of 1240)
        Methods:      5,415  (of 5429)
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Jan 27, 2022
I found when I went to update the AOT profile in .NET MAUI:

https://github.com/jonathanpeppers/android-profiled-aot
dotnet/maui#4355

The profiler crashed with:

    01-27 11:10:16.119 28922 28922 W monodroid: Creating public update directory: `/data/user/0/com.androidaot.MauiApp1/files/.__override__`
    ...
    01-27 11:10:16.119 28922 28922 W monodroid: Initializing profiler with options: aot:port=9999output=/data/user/0/com.androidaot.MauiApp1/files/.__override__/profile.aotprofile
    01-27 11:10:16.119 28922 28922 W monodroid: Looking for profiler init symbol 'mono_profiler_init_aot'? 0x7325b6355c
    01-27 11:10:16.119 28922 28922 E mono-prof: Could not create AOT profiler output file 'output.aotprofile': Read-only file system

But the directory was writeable?

    adb shell run-as com.androidaot.MauiApp1 touch files/.__override__/foo

After some digging, it turned out appending `,` to this line fixed the
issue:

https://github.com/xamarin/xamarin-android/blob/b7a368a27667c69117f64be81050403f2d5c8560/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Application.targets#L45

What happened was we lost a `,` somewhere in this commit:

xamarin@f73a323

To fix this:

1. Prepend a `,`

2. I found a way to actually enable tests for Profiled AOT in .NET 6
   by downloading binaries from my Github repo.
@Redth Redth merged commit 94e73e4 into dotnet:main Jan 28, 2022
@jonathanpeppers jonathanpeppers deleted the preview13-aot-profile branch January 28, 2022 00:27
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Jan 28, 2022
I found when I went to update the AOT profile in .NET MAUI:

https://github.com/jonathanpeppers/android-profiled-aot
dotnet/maui#4355

The profiler crashed with:

    01-27 11:10:16.119 28922 28922 W monodroid: Creating public update directory: `/data/user/0/com.androidaot.MauiApp1/files/.__override__`
    ...
    01-27 11:10:16.119 28922 28922 W monodroid: Initializing profiler with options: aot:port=9999output=/data/user/0/com.androidaot.MauiApp1/files/.__override__/profile.aotprofile
    01-27 11:10:16.119 28922 28922 W monodroid: Looking for profiler init symbol 'mono_profiler_init_aot'? 0x7325b6355c
    01-27 11:10:16.119 28922 28922 E mono-prof: Could not create AOT profiler output file 'output.aotprofile': Read-only file system

But the directory was writeable?

    adb shell run-as com.androidaot.MauiApp1 touch files/.__override__/foo

After some digging, it turned out appending `,` to this line fixed the
issue:

https://github.com/xamarin/xamarin-android/blob/b7a368a27667c69117f64be81050403f2d5c8560/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Application.targets#L45

What happened was we lost a `,` somewhere in this commit:

xamarin@f73a323

To fix this:

1. Prepend a `,`

2. I found a way to actually enable tests for Profiled AOT in .NET 6
   by downloading binaries from my Github repo.

In enabling the `ProfiledAOT` category for .NET 6, I found that this
setting wasn't working:

    <AndroidExtraAotOptions>--verbose</AndroidExtraAotOptions>

I updated `%(_MonoAOTAssemblies.ProcessArguments)` to solve this.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Jan 31, 2022
I found when I went to update the AOT profile in .NET MAUI:

https://github.com/jonathanpeppers/android-profiled-aot
dotnet/maui#4355

The profiler crashed with:

    01-27 11:10:16.119 28922 28922 W monodroid: Creating public update directory: `/data/user/0/com.androidaot.MauiApp1/files/.__override__`
    ...
    01-27 11:10:16.119 28922 28922 W monodroid: Initializing profiler with options: aot:port=9999output=/data/user/0/com.androidaot.MauiApp1/files/.__override__/profile.aotprofile
    01-27 11:10:16.119 28922 28922 W monodroid: Looking for profiler init symbol 'mono_profiler_init_aot'? 0x7325b6355c
    01-27 11:10:16.119 28922 28922 E mono-prof: Could not create AOT profiler output file 'output.aotprofile': Read-only file system

But the directory was writeable?

    adb shell run-as com.androidaot.MauiApp1 touch files/.__override__/foo

After some digging, it turned out appending `,` to this line fixed the
issue:

https://github.com/xamarin/xamarin-android/blob/b7a368a27667c69117f64be81050403f2d5c8560/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Application.targets#L45

What happened was we lost a `,` somewhere in this commit:

xamarin@f73a323

To fix this:

1. Prepend a `,`

2. I found a way to actually enable tests for Profiled AOT in .NET 6
   by downloading binaries from my Github repo.

In enabling the `ProfiledAOT` category for .NET 6, I found that this
setting wasn't working:

    <AndroidExtraAotOptions>--verbose</AndroidExtraAotOptions>

I updated `%(_MonoAOTAssemblies.ProcessArguments)` to solve this.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Jan 31, 2022
I found when I went to update the AOT profile in .NET MAUI:

https://github.com/jonathanpeppers/android-profiled-aot
dotnet/maui#4355

The profiler crashed with:

    01-27 11:10:16.119 28922 28922 W monodroid: Creating public update directory: `/data/user/0/com.androidaot.MauiApp1/files/.__override__`
    ...
    01-27 11:10:16.119 28922 28922 W monodroid: Initializing profiler with options: aot:port=9999output=/data/user/0/com.androidaot.MauiApp1/files/.__override__/profile.aotprofile
    01-27 11:10:16.119 28922 28922 W monodroid: Looking for profiler init symbol 'mono_profiler_init_aot'? 0x7325b6355c
    01-27 11:10:16.119 28922 28922 E mono-prof: Could not create AOT profiler output file 'output.aotprofile': Read-only file system

But the directory was writeable?

    adb shell run-as com.androidaot.MauiApp1 touch files/.__override__/foo

After some digging, it turned out appending `,` to this line fixed the
issue:

https://github.com/xamarin/xamarin-android/blob/b7a368a27667c69117f64be81050403f2d5c8560/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Application.targets#L45

What happened was we lost a `,` somewhere in this commit:

xamarin@f73a323

To fix this:

1. Prepend a `,`

2. I found a way to actually enable tests for Profiled AOT in .NET 6
   by downloading binaries from my Github repo.

In enabling the `ProfiledAOT` category for .NET 6, I found that this
setting wasn't working:

    <AndroidExtraAotOptions>--verbose</AndroidExtraAotOptions>

I updated `%(_MonoAOTAssemblies.ProcessArguments)` to solve this.
jonpryor pushed a commit to xamarin/xamarin-android that referenced this pull request Feb 1, 2022
Context: dotnet/maui#4355
Context: https://github.com/jonathanpeppers/android-profiled-aot
Context: #6171
Context: 3e699d6


I found that when I went to update the .NET MAUI AOT profile in
dotnet/maui#4355, the profiler crashed with:

	01-27 11:10:16.119 28922 28922 W monodroid: Creating public update directory: `/data/user/0/com.androidaot.MauiApp1/files/.__override__`
	...
	01-27 11:10:16.119 28922 28922 W monodroid: Initializing profiler with options: aot:port=9999output=/data/user/0/com.androidaot.MauiApp1/files/.__override__/profile.aotprofile
	01-27 11:10:16.119 28922 28922 W monodroid: Looking for profiler init symbol 'mono_profiler_init_aot'? 0x7325b6355c
	01-27 11:10:16.119 28922 28922 E mono-prof: Could not create AOT profiler output file 'output.aotprofile': Read-only file system

But the directory was writeable?

	adb shell run-as com.androidaot.MauiApp1 touch files/.__override__/foo
	# no error

After some digging, it turned out that *appending* `,` to the
[`_SetAotProfilingPropsOnDevice` target's `<Exec/>`][0] fixed it:

	"$(AdbToolPath)adb" $(AdbTarget) shell setprop debug.mono.profile aot:port=$(AndroidAotProfilerPort),

What happened was we "lost" a `,` somewhere in
#6171, likely in:

  * f73a323

To fix this:

 1. Prepend a `,`

 2. I found a way to actually enable tests for Profiled AOT in .NET 6
    by downloading binaries from my Github repo.

In enabling the `ProfiledAOT` category for .NET 6, I found that this
setting wasn't working:

	<AndroidExtraAotOptions>--verbose</AndroidExtraAotOptions>

I updated `%(_MonoAOTAssemblies.ProcessArguments)` to solve this.

[0]: https://github.com/xamarin/xamarin-android/blob/b7a368a27667c69117f64be81050403f2d5c8560/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Application.targets#L45
jonathanpeppers added a commit to jonathanpeppers/maui-profiling that referenced this pull request Feb 2, 2022
Note, that really the only perf improvement in Preview 13 is a new AOT profile:

dotnet/maui#4355

And we see a nice improvement there.
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants