-
Notifications
You must be signed in to change notification settings - Fork 752
Change NetTrace format version support, eliminate pinning, and improve UnsupportedVersionException #2180
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
…rtedVersionException - Re-enabling support for parsing format V6 and re-enabling the tests - Removed support for ancient netperf format version 1 and 2 that were only used during .NET Core 2.0 (not even 2.1). - The implementation of the Nettrace reader was doing a bunch of pinning because the TraceEvent internal model of events uses unmanaged pointers, however the pinning was creating bad GC performance. TraceEvent builds for .NET standard so we don't have guaranteed access to the pinned heap and I didn't want to start doing lots of copying and/or managing pools of pinned arrays. Instead I switched the stream reading over to using spans backed by native heap allocations and explicit block lifetime tracking. As a side benefit it also brings the V3-5 block iteration code a bit closer to the V6 block iteration and removed all the dependencies on the existing FastSerialization library. - Add MinSupportedVersion and MaxSupportedVersion to the UnsupportedVersionException
brianrob
left a comment
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.
Thanks @noahfalk for putting this together! A few comments/questions below.
- Removed some V1_V2 support code that I missed before - Added comments referencing the block header format and why we have a duplicate FastSerialization tag enum - Pruned unneeded using statements - Switched from EndOfStreamException to FormatException so that we consistently use FormatException for all format issues - Removed StreamExtensions.ReadAtLeast which was dead code - Add tests for incomplete stream handling and verifying StreamExtensions.Read is implemented as expected for different platforms
|
Thanks for the feedback @brianrob! Hopefully the latest commit addresses all of it. |
|
|
||
| internal FixedBuffer(int length) | ||
| { | ||
| _pointer = Marshal.AllocHGlobal(length); |
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.
Would NativeMemory be more appropriate here?
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.
Unforetunately TraceEvent targets .NET Standard 2.0 and NativeMemory was first supported in .NET 6 so it isn't available.
brianrob
left a comment
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.
LGTM. Thanks @noahfalk!
Code updates are based on microsoft/perfview#2121 Would like to incorporate microsoft/perfview#2180 into dotnet-monitor, to potentially improve memory usage. ~~Test failures are most likely due to changes from microsoft/perfview#2170 Fixed with newest version
@wiktork - This may fix the GC issues you were seeing in dotnet-monitor
@karpinsn - Exception improvements should help with version error messages in Dev18
@mdh1418, @brianrob, @lateralusX, @beaubelgrave - aside from turning back on V6 support hopefully the behavior should be nearly identical to before despite all the code churn in there.