Uh oh!
There was an error while loading. Please reload this page.
Add new DiagnosticMethodInfo public API - #103220
Conversation
ghost
commented
Jun 10, 2024
Note regarding the |
1 similar comment
ghost
commented
Jun 10, 2024
Note regarding the |
Tagging subscribers to this area: @tommcdon |
| DiagnosticMethodInfo? dmi = DiagnosticMethodInfo.Create(@delegate); | ||
| return dmi?.Name ?? "<unknown>"; |
There was a problem hiding this comment.
This could alternatively be this, but not sure how important that is:
| DiagnosticMethodInfo?dmi=DiagnosticMethodInfo.Create(@delegate); | |
| returndmi?.Name??"<unknown>"; | |
| if(StackTrace.IsSupported) | |
| { | |
| DiagnosticMethodInfo?dmi=DiagnosticMethodInfo.Create(@delegate); | |
| returndmi!.Name; | |
| } | |
| else | |
| { | |
| return@delegate.Method.Name; | |
| } |
MichalStrehovsky
commented
Jun 11, 2024
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
MichalStrehovsky
commented
Jun 11, 2024
1.1% size savings on webapiaot! MichalStrehovsky/rt-sz#29 (comment) |
MichalStrehovsky
commented
Jun 12, 2024
This is ready for review, cc @dotnet/ilc-contrib |
| // For all other task than TaskContinuations we want to log. TaskContinuations log in their constructor | ||
| Debug.Assert(m_action != null, "Must have a delegate to be in ScheduleAndStart"); | ||
| TplEventSource.Log.TraceOperationBegin(this.Id, "Task: " + m_action.Method.Name, 0); | ||
| TplEventSource.Log.TraceOperationBegin(this.Id, "Task: " + m_action.GetMethodName(), 0); |
There was a problem hiding this comment.
Is this measurably more expensive than the existing code on regular CoreCLR?
There was a problem hiding this comment.
On regular coreclr there's the one extra allocation but otherwise I don't expect impact. DiagnosticMethodInfo just wraps the underlying MethodInfo.
On native AOT we unnecessarily materialize type name and class name. I thought about structuring DiagnosticMethodInfo so that it wraps MetadataReader and a bunch of handles but ended up not doing it because we'd still need strings for the open method delegate cases (or somehow wrestle metadata handles out of reflection objects in that case).
This add support for the new public API for all runtime flavors and switches Tasks logging to use it (we could make it a separate PR, I don't mind either way). Switching tasks logging to the new API saves 1.1% in size on webapiaot because the compiler no longer needs to consider all delegates targets of reflection.
TODO:
<StackTraceSupport>false</StackTraceSupport>really means this doesn't work.get_Method.#96528