-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add additional filter capabilities to dotnet-pgo tool. #89853
Merged
jakobbotsch
merged 6 commits into
dotnet:main
from
lateralusX:lateralusX/add-dotnet-pgo-include-exclude-methods
Aug 10, 2023
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
72df5ed
Add additional filter capabilities to dotnet-pgo tool.
lateralusX 817e82a
Review feedback.
lateralusX 930a574
Address feedback
mdh1418 8b7693f
Align spacing for R2RLoad and jitStart event processing
mdh1418 f95dc3e
Address more feedback
mdh1418 c6affef
Select largest range to bound events
mdh1418 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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 string is generally meant for debugging, it goes through
DebugNameFormatter
which will produce method names that users may not be familiar with (e.g. I believe types will be module prefixed in the format "[module name]type name"). Would it be better to introduce a custom formatter, reuse theTypeString
formatter, or to reuse themethodNameFromEventDirectly
that we are already using to print the warnings above?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.
Is there expectation for users to be more specific than to use a regular expression for specifying which method to exclude events after? I was trying to get a local test loop going on Android to see the structural differences between a
MethodDesc.ToString()
and themethodNameFromEventDirectly
but its taking me some time to get it working locally.I can switch it to
methodNameFromEventDirectly
as that should still be able to match a regex provided by the user. Is it usually easier to match themethodNameFromEventDirectly
form than to match theMethodDesc.ToString()
form even though it is passed through theDebugNameFormatter
?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.
The problem is that the way
DebugNameFormatter
formats names is an internal detail of the managed type system, so I do not think user-facing tools should be using this for any purpose but diagnostics. We do not want situations where we change this detail in the future and break something that took a dependency on the exact way that namespaces or class names are formatted by this formatter.I looked again and realize
methodNameFromEventDirectly
is not actually a field that comes directly from the event, but a concatenation of various fields. I think a simpler concatenation likee.MethodNamespace + "." + e.MethodName
would be better to do the matching against. I thinkMethodNamespace
includes the class name, but you may want to double check.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.
I think this also suggests that
e.MethodNamespace
will also contain the class name https://github.com/microsoft/perfview/blob/766a08ca8373d273d55da8b07147e7068e4d5f58/src/TraceEvent/Samples/21_ObserveJitEvents.cs#L126-L132. (haven't found the source code for such fields/classes yet)Maybe
methodNameFromEventDirectly
would allow for more flexibility as it will allow users to also specify between different overloaded forms of the same method? It would also more closely align with aGetMethodName
in Perfview https://github.com/microsoft/perfview/blob/766a08ca8373d273d55da8b07147e7068e4d5f58/src/TraceEvent/Computers/TraceManagedProcess.cs#L4170There 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.
I like that idea, but then we should match the PerfView name exactly,
methodNameFromEventDirectly
does not match that today. We should also update documentation of the CLI option to refer to the fact that matching works against names that are formatted the same as PerfView (I would also add a note that this includes parameters, so that users can realize they cannot use e.g.*MyClass*
to match all methods defined on that class). Do you know where exactly this name is displayed in the PerfView UI?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.
I'm not too familiar with the user scenarios, so I dont know if it is likely that one would want to only include methods with a certain set of parameters and not include the others. Maybe we can start out with having the most customizable option first (allowing users to include/exclude particular overloaded methods) and later if we know users will never want to do that we can pursue the simpler format?
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.
I'm also noticing that the
excludeEventsBeforeJittingMethod
andexcludeEventsAfterJittingMethod
are based off ofmethod.ToString()
. It would probably be better to maintain parity for those as well. And on more deliberation and offline discussion, maybe keeping the simpler format is better for now. Also, do you happen to know ifMethodDesc.ToString()
will contain the parameter information or not @jakobbotsch ?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.
Ah, it looks like it does
runtime/src/coreclr/tools/Common/TypeSystem/Common/MethodDesc.ToString.cs
Lines 70 to 79 in f5889ec
Maybe it would be better to stick with @lateralusX's original intent of the regex matching.
I'm not very familiar with these types, would
e.MethodNamespace + "." + e.MethodName + paramsArgs
be the same values that are held by the resultingMethodDesc
discovered byidParser.ResolveMethoID(e.MethodID...)
? If not, then it might not be the right "substitution"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.
Yes, the code above should be changed in the same way.
We should not use
MethodDesc.ToString()
for anything except diagnostics when it is user facing like this. It should have a dedicated formatter then if we do not want to use the name from the event. I think you can base it on TypeString, except without including instantiations.Yes, they represent the same thing. dotnet-pgo has a managed implementation of the type system that replicates the native implementation of the type system that produced the strings in the event. Classes and methods are loaded into the type system based on events in the trace.
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.
Updated to use
e.MethodNamespace + "." + e.MethodName + paramsArgs
as the method's name for regex matching, formatted after the method name in PerfView.Also updated the documentation in the options' descriptions