-
Notifications
You must be signed in to change notification settings - Fork 617
Add global Stream tracker in debug builds #5598
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,14 @@ | |
| #include "stream.c.clog.h" | ||
| #endif | ||
|
|
||
| #if DEBUG | ||
| // | ||
| // Global stream object tracker for debugging. | ||
| // | ||
| CXPLAT_LIST_ENTRY QuicStreamTrackerList = { &QuicStreamTrackerList, &QuicStreamTrackerList }; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've never seen this pattern before - is there a precedent for it in MsQuic? If not, let's use the init routine. |
||
| CXPLAT_DISPATCH_LOCK QuicStreamTrackerLock; | ||
| #endif | ||
|
|
||
| _IRQL_requires_max_(DISPATCH_LEVEL) | ||
| QUIC_STATUS | ||
| QuicStreamInitialize( | ||
|
|
@@ -46,6 +54,10 @@ QuicStreamInitialize( | |
| CxPlatDispatchLockAcquire(&Connection->Streams.AllStreamsLock); | ||
| CxPlatListInsertTail(&Connection->Streams.AllStreams, &Stream->AllStreamsLink); | ||
| CxPlatDispatchLockRelease(&Connection->Streams.AllStreamsLock); | ||
|
|
||
| CxPlatDispatchLockAcquire(&QuicStreamTrackerLock); | ||
| CxPlatListInsertTail(&QuicStreamTrackerList, &Stream->TrackerLink); | ||
| CxPlatDispatchLockRelease(&QuicStreamTrackerLock); | ||
| #endif | ||
| QuicPerfCounterIncrement(Connection->Partition, QUIC_PERF_COUNTER_STRM_ACTIVE); | ||
|
|
||
|
|
@@ -175,6 +187,10 @@ QuicStreamInitialize( | |
| if (Stream) { | ||
| #if DEBUG | ||
| CXPLAT_DBG_ASSERT(!CxPlatRefDecrement(&Stream->RefTypeBiasedCount[QUIC_STREAM_REF_APP])); | ||
| CxPlatDispatchLockAcquire(&QuicStreamTrackerLock); | ||
| CxPlatListEntryRemove(&Stream->TrackerLink); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we may want to introduce some abstractions for these trackers, such that if perf becomes a practical bottleneck on debug builds, we can:
|
||
| CxPlatDispatchLockRelease(&QuicStreamTrackerLock); | ||
|
|
||
| CxPlatDispatchLockAcquire(&Connection->Streams.AllStreamsLock); | ||
| CxPlatListEntryRemove(&Stream->AllStreamsLink); | ||
| CxPlatDispatchLockRelease(&Connection->Streams.AllStreamsLock); | ||
|
|
@@ -214,6 +230,10 @@ QuicStreamFree( | |
| CXPLAT_DBG_ASSERT(Stream->SendRequests == NULL); | ||
|
|
||
| #if DEBUG | ||
| CxPlatDispatchLockAcquire(&QuicStreamTrackerLock); | ||
| CxPlatListEntryRemove(&Stream->TrackerLink); | ||
| CxPlatDispatchLockRelease(&QuicStreamTrackerLock); | ||
|
|
||
| CxPlatDispatchLockAcquire(&Connection->Streams.AllStreamsLock); | ||
| CxPlatListEntryRemove(&Stream->AllStreamsLink); | ||
| CxPlatDispatchLockRelease(&Connection->Streams.AllStreamsLock); | ||
|
|
||
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.
Nit: I'd suggest simplifying this to one lock for all the trackers.