Slim ThreadStressLogData and simplify GetStressMessages API#129673
Slim ThreadStressLogData and simplify GetStressMessages API#129673max-charlamb merged 2 commits into
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR narrows the stress log contract surface by slimming ThreadStressLogData down to essential fields and by changing IStressLog.GetStressMessages to accept a TargetPointer address (instead of a ThreadStressLogData value), updating SOS and tooling call sites accordingly.
Changes:
- Reduce
ThreadStressLogDatato{ Address, ThreadId, WriteHasWrapped }in the cDAC abstractions/design docs and adjust contract construction. - Change
GetStressMessagessignature toGetStressMessages(TargetPointer threadStressLogAddress)and re-readThreadStressLoginternally in the contract implementation. - Update consumers (SOSDacImpl bridge, dump tests, StressLogAnalyzer) to pass the thread log address.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/StressLogAnalyzer/src/StressLogAnalyzer.cs | Updates calls to GetStressMessages to pass log.Address. |
| src/native/managed/cdac/tests/DumpTests/StressLogDumpTests.cs | Updates contract test to pass thread.Address into GetStressMessages. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs | Simplifies message enumerator creation by passing the thread log address directly to the contract. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StressLog.cs | Refactors contract traversal to accept a thread log address and re-read ThreadStressLog data internally. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IStressLog.cs | Slims ThreadStressLogData and updates GetStressMessages signature in the abstraction contract. |
| docs/design/datacontracts/StressLog.md | Updates design documentation to reflect slimmer thread data and the new GetStressMessages signature. |
0c7050b to
210d5a8
Compare
|
Are all fields listed in datadescriptor.inc still needed? |
Reduce ThreadStressLogData public record from 8 fields to 3:
{Address, ThreadId, WriteHasWrapped}. The removed fields
(NextPointer, CurrentPointer, ChunkListHead, ChunkListTail,
CurrentWriteChunk) are internal traversal state that only the
contract implementation needs.
Change GetStressMessages to take a TargetPointer (the thread stress
log address) instead of the full record. The contract re-reads the
ThreadStressLog data internally from that address.
This also simplifies GetStressLogMessageEnumerator in SOSDacImpl --
it no longer needs to re-enumerate all threads to find the matching
one; it passes the address directly to the contract.
Remove unused StressLogChunk.Prev data descriptor and field (only
used at runtime for the write path, never during dump analysis).
Remove unused StressLogChunkMaxSize constant.
Fix pre-existing StressLogAnalyzer crash: contract version was
specified as numeric 2 instead of string "c2" in the hardcoded
contract descriptor JSON.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
210d5a8 to
af052a0
Compare
We don't use |
|
/ba-g cDAC only change and runtime-diagnostics pipeline passes |
Follow-up based on #129272 (comment)
Summary
Reduce the public surface of
ThreadStressLogDataand simplify theGetStressMessagesAPI signature.Changes
ThreadStressLogData: Trimmed from 8 fields to 3:{Address, ThreadId, WriteHasWrapped}. The removed fields (NextPointer,CurrentPointer,ChunkListHead,ChunkListTail,CurrentWriteChunk) are internal traversal state only needed by the contract implementation.GetStressMessages: Changed fromGetStressMessages(ThreadStressLogData threadLog)toGetStressMessages(TargetPointer threadStressLogAddress). The contract re-reads theThreadStressLogdata internally from the address.SOSDacImpl.GetStressLogMessageEnumerator: Simplified -- no longer needs to re-enumerate all threads to find the matching one. Passes the address directly to the contract.Motivation
Feedback from PR #129272 review (noahfalk): the public
ThreadStressLogDatarecord exposed internal data structure implementation details (chunk pointers, write positions) that consumers don't need. OnlyThreadId,WriteHasWrapped, andAddressare used externally.Related