[.NET 10] Add performance logging and suggestions#29972
Closed
jsuarezruiz wants to merge 18 commits intonet10.0from
Closed
[.NET 10] Add performance logging and suggestions#29972jsuarezruiz wants to merge 18 commits intonet10.0from
jsuarezruiz wants to merge 18 commits intonet10.0from
Conversation
MartyIX
reviewed
Jun 18, 2025
| @@ -0,0 +1,109 @@ | |||
| #nullable disable | |||
Contributor
There was a problem hiding this comment.
Isn't it better to enable it for new class?
Contributor
Author
|
Closed to put the focus on #30130 |
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.
Description of Change
This PR includes changes to add a performance monitoring system for the .NET MAUI framework, focusing on performance metrics including layout engine performance or Image performance monitoring. The system is integrated directly into the MAUI framework, outlines a modular architecture with per-domain trackers (Layout, Image), each using its own Meter and instruments from the System.Diagnostics.Metrics API.
Available by default in Debug and Trimmed in Release although included a Feature to allow enable or disable it. If you want to get performance metrics in Release mode, can enable the profiling:
dotnet build -c Release -p:EnableMauiPerformanceMonitoring=trueNOTE: This feature is still under development, created this PR to provide visibility and early feedback.
How to use:
First, add the performance monitoring and configure it in the
MauiProgram.csfile.There are parameters to activate/deactivate metrics and thresholds to obtain warnings or recommendations if we exceed them.
Then, can get stats by requests:
var layoutStats = _performanceProfiler.Layout.GetStats();Updates in realtime:
performanceProfiler.Layout.SubscribeToLayoutUpdates(OnLayoutUpdate);And also, we can get warnings:
performanceProfiler.Warnings.WarningRaised += OnPerformanceWarning;More details: #28091 (comment)
A simplified version is available here main...fix-28091-II
Not have options parameters, warnings, options to subscribe to get stats at realtime etc.
Issues Fixed
Fixes #28091