-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add diagnostic metrics/activities #18314
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
Conversation
You can test this PR using the following package version. |
public static void InitMetrics() | ||
{ | ||
// Metrics | ||
var meter = new Meter("Avalonia.Diagnostic.Meter"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be Avalonia.Diagnostics.Meter or Avalonia.Diagnostics.Diagnostic.Meter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is public (for listeners, and also devtools UI), so I made it shorter. I don't have strong opinion though.
What does the pull request do?
avalonia.comp.render.time
avalonia.comp.update.time
avalonia.ui.measure.time
avalonia.ui.arrange.time
avalonia.ui.render.time
avalonia.ui.input.time
avalonia.ui.event.handler.count
avalonia.ui.visual.count
avalonia.ui.dispatcher.timer.count
Avalonia.AttachingStyle
Avalonia.FindingResource
Avalonia.EvaluatingStyle
Avalonia.MeasuringLayoutable
Avalonia.ArrangingLayoutable
Avalonia.PerformingHitTest
Avalonia.RaisingRoutedEvent
These are not considered a public API and might be removed or changed. As it's likely we didn't get things right on the first try.
We also might want to split histogram metrics per TopLevel. But probably not in this PR.
What is the updated/expected behavior with this PR?
RuntimeCongig
Avalonia.Diagnostics.Diagnostic.IsEnabled
enabled these meters and activities. Disabled by default.Additionally, metrics can be additionally disabled via built-in
System.Diagnostics.Metrics.Meter.IsSupported
.Fixed issues
Fixes #12032
Benchmarks
Benchmarks without any listeners, just master + with runtime config enabled + without runtime config enabled.
Just to see if this PR doesn't regress anything.
In summary, when
Avalonia.Diagnostics.Diagnostic.IsEnabled
is enabled, some code paths, especially style attaching, is noticably slower on becnmarks. Makes sense to keep it disabled by default.Remeasure
master
with enabled runtime config
with disabled runtime config (default)
FindPreResource + FindPostResource + FindNotExistingResource
master
with enabled runtime config
with disabled runtime config (default)
Apply_Simple_Styles
master
with enabled runtime config
with disabled runtime config (default)
Apply_Detach_Styles
master
with enabled runtime config
with disabled runtime config (default)
Apply style
master
with enabled runtime config
with disabled runtime config (default)