Runtime Loader advanced event view#1232
Conversation
|
Yes, I will take a look @davidwrighton. |
| <Compile Include="..\PerfView\ClrStats.cs" /> | ||
| <Compile Include="..\PerfView\GcStats.cs" /> | ||
| <Compile Include="..\PerfView\JitStats.cs" /> | ||
| <Compile Include="..\PerfView\RuntimeLoaderStats.cs" /> |
There was a problem hiding this comment.
Are you wanting to enable this via the PerfViewCollect tool?
There was a problem hiding this comment.
Eventually... yes. But for now, I'm settling for it just building cleanly. This change was required for that. The rest of these changes, are VS doing something I didn't want.
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles" Version="$(MicrosoftDiagnosticsTracingTraceEventSupportFilesVersion)" /> | ||
| <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All"/> |
There was a problem hiding this comment.
It looks like there is a bunch of whitespace change here. Can you revert these please? Let me know if I missed an actual change here.
| To enable data about all loader operations set the ".NET Loader" checkbox when collecting data. | ||
| Otherwise, the data captured will be restricted to JIT and assembly load operations. The /RuntimeLoading switch may also be used. | ||
|
|
||
| Also see the Runtime Loader stacks view, which ties this data into a view of CPU activity, to allow investigating CPU usage during specific loader operations. |
There was a problem hiding this comment.
Thanks for adding help for this. Can you also add a note that this only works on .NET Core (assuming we're not porting this to desktop)?
There was a problem hiding this comment.
It actually works to some extent on desktop. You can see JIT and assembly load events there.
|
|
||
| <CheckBox Grid.Row="0" Grid.Column="13" Name="Unused2" Visibility="Hidden" VerticalAlignment="Center"/> | ||
| <TextBlock Grid.Row="0" Grid.Column="12" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="8,2,5,2" | ||
| ToolTip="Log information about .NET Runtime loading." > |
There was a problem hiding this comment.
It might be good to disambiguate this a bit in the tooltip to be clear that this is for more than just assembly loading, but also type loading, method loading, etc.
src/PerfView/RuntimeLoaderStats.cs
Outdated
|
|
||
| foreach (var proc in runtimeOps.EventSource.TraceLog.Processes) | ||
| { | ||
| if (proc.ProcessID == incompleteStatsProc.ProcessID) |
There was a problem hiding this comment.
There are a couple of ways that you can match processes, while handing the fact that process IDs can be re-used. One is to use TraceProcess.ProcessIndex, which is a unique value across the entire trace. The second is to use ProcessID and timestamp, and find the closest match - TraceLog.Processes has an API for this. If you leave this as is, it's possible that PID re-use will impact the results here.
There was a problem hiding this comment.
In RuntimeLoaderStats.cs, you are using Microsoft.Diagnostics.Tracing.Etlx.TraceProcess, but here you're using Microsoft.Diagnostics.Tracing.Analysis.TraceProcess. They are slightly different. The first is layered on top of TraceLog, while this one is a level lower at TraceEventSource. Since you already require Etlx.TraceProcess, I'd recommend just using that everywhere, and then you can use ProcessIndex rather than PID.
In reply to: 458422874 [](ancestors = 458422874)
src/PerfView/RuntimeLoaderStats.cs
Outdated
|
|
||
| foreach (var proc in runtimeOps.EventSource.TraceLog.Processes) | ||
| { | ||
| if (proc.ProcessID == incompleteStatsProc.ProcessID) |
src/PerfView/PerfViewData.cs
Outdated
|
|
||
| advanced.Children.Add(new PerfViewJitStats(this)); | ||
|
|
||
| advanced.Children.Add(new PerfViewRuntimeLoaderStats(this)); |
There was a problem hiding this comment.
Can you condition this on having enough data in the trace to show something? You're just looking for the specific types of events that you need. We do this so that there aren't views that don't show anything.
brianrob
left a comment
There was a problem hiding this comment.
Thanks for submitting this @davidwrighton. Overall looks good - some comments and recommendations. Also, can you share a trace that you've captured with these events? I'm interested to see the view in action.
| source.Clr.LoaderTypeLoadStart += Clr_LoaderTypeLoadStart; | ||
| source.Clr.LoaderTypeLoadStop += Clr_LoaderTypeLoadStop; | ||
| source.Process(); | ||
| source.Clr.MethodJittingStarted -= Clr_MethodJittingStarted; |
There was a problem hiding this comment.
You should not need to unsubscribe these delegates. The pattern used is to provide a fresh EventSource so that you are sure that other machinery isn't subscribed if you are concerned about this. I don't think you'll find many, if any, places in where we attempt to unsubscribe in order to re-use the EventSource.
…instead of inscrutqable commands.
…instead of inscrutqable commands.
…ctored stats page
Add support for generating csv as well as txt and make output generally acceptable to excel
- Consistently use the Microsoft.Diagnostics.Tracing.Analysis.TraceProcess - Refactor CLRRuntimeActivityComputer to be more pluggable into the existing Process once model - Only display view when it has data - Properly segregate process local data and handle process id reuse
- Update help text and documentation to be more accurate
ec3b44c to
48b4d15
Compare
|
@brianrob I've addressed all of the feedback you've given me. As it turns out it was more difficult to consolidate on using the Etlx TraceProcess, so instead I consolidated on working with the Analysis TraceProcess, and some modestly dodgy logic involving pids and timestamps. |
Add support for viewing various when various runtime load operations occur during process execution. This is a view much like jit stats, but somewhat more flexible and less specialized to just the JIT.
Events visible are
The view is presented linearly per thread, and can be shown nested or not (nested allows understanding of which operations occur as a result of other operations)
In addition, which events are shown is configurable via checkbox.