Dotnet-trace (.netrace) support - #95
Conversation
…till work / refactoring to be done)
…ace /w Console output, GC, thread, and Exception
| { | ||
| public string[] CallStack { get; set; } | ||
| public TraceModuleFile Module { get; set; } | ||
| public string FullMethodName { get; set; } |
There was a problem hiding this comment.
Maybe make readonly?
| // The DataSourceInfo is used to tell analzyer the time range of the data(if applicable) and any other relevant data for rendering / synchronizing. | ||
|
|
||
| return this.dataSourceInfo; | ||
|
|
There was a problem hiding this comment.
nit: extra line
|
|
||
| foreach (var path in this.filePaths) | ||
| { | ||
| var traceStartTime = DateTime.UtcNow.Date; |
There was a problem hiding this comment.
not needed?
| // EventPipeEventSource doesn't expose the callstacks - https://github.com/Microsoft/perfview/blob/main/src/TraceEvent/EventPipe/EventPipeFormat.md | ||
| // But currently it's SessionDuration, SessionStartTime are correct | ||
| // Can remove when when this is released - https://github.com/microsoft/perfview/pull/1635 | ||
| var dotnetFileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); |
There was a problem hiding this comment.
add using
| var baseProjection = Projection.Index(ThreadSamplingEvents); | ||
|
|
||
|
|
||
| tableGenerator.AddColumn(countColumn, baseProjection.Compose(x => 1)); // 1 sample |
There was a problem hiding this comment.
Projection.Constant(1)
| tableGenerator.AddColumn(moduleColumn, baseProjection.Compose(x => x.Module?.Name)); | ||
| tableGenerator.AddColumn(functionColumn, baseProjection.Compose(x => x.FullMethodName)); | ||
| tableGenerator.AddHierarchicalColumn(callStackColumn, baseProjection.Compose(x => x.CallStack), new ArrayAccessProvider<string>()); | ||
| var timeStampProjection = Projection.CreateUsingFuncAdaptor((i) => ThreadSamplingEvents[i].Timestamp); |
There was a problem hiding this comment.
Could compose work here?
baseProjection.Compose(x => x.Timestamp)
…g trace session info. Include some updated docs and developer info
| } | ||
| catch (Exception e) | ||
| { | ||
| if (e.Message != ReadPastEndOfStreamExceptionMessage || !traceEventProcessor.HasTraceData()) |
There was a problem hiding this comment.
If a failure occurs when calling CreateFromEventPipeDataFile, you might consider attempting to re-process the file with ContinueOnError==true. If this succeed,s you should tell users that there was an error, and you stopped at the point in the file where the error occurred, so the file might not contain all of the expected data.
| { | ||
| internal class EventStat | ||
| { | ||
| public string ProviderName { get; set; } |
There was a problem hiding this comment.
TraceLog.Stats can provide this information for each type of event.
| } | ||
|
|
||
| var firstTraceProcessorEventsParsed = TraceEventProcessor.First().Value; // First Log | ||
| var gcStartEvents = firstTraceProcessorEventsParsed.GenericEvents.Where(f => f.ProviderName == "Microsoft-Windows-DotNETRuntime" && |
There was a problem hiding this comment.
Pretty cool! I would recommend sourcing this information from the state machine that knows how to build up the list of GCs instead of using GC/Start and GC/Stop events. This will provide you with more information if it's available, but will also handle cases where you might have nested GC/Start/Stop events (e.g. in the case of background GCs where a foreground gen0 is triggered). You can see where this gets created in PerfView here: https://github.com/microsoft/perfview/blob/main/src/PerfView/PerfViewData.cs#L3532
|
ivberg, this is pretty great! |
|
follow |
Do you have a comment or would use this feature DO HUU NGHIA (@MESINDUPA) ? |
No description provided.