Skip to content
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

Expose StressLog via CDAC and port StressLogAnalyzer to managed code #104999

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7d4a3e0
Start a StressLog contract for CDAC
jkoritzinsky Jun 20, 2024
2f03842
Start on StressLogAnalyzer port.
jkoritzinsky Jun 28, 2024
a904770
Load in and read the thread stress logs and the stress messages.
jkoritzinsky Jun 28, 2024
0edfc36
Add support for Ix, I64 specifiers
jkoritzinsky Jul 11, 2024
acbe6d5
Refactor into src/test directories and add tests for basic format str…
jkoritzinsky Jul 11, 2024
9d1f475
Add more tests and extend the signed integer test case to test a ton …
jkoritzinsky Jul 12, 2024
9b777ae
Add special pointer formatting hook and a default implementation for …
jkoritzinsky Jul 12, 2024
4ff56ba
Write the command line and start work on porting over logic (first on…
jkoritzinsky Jul 15, 2024
8864e5c
Add GC heap map memory and default string handling
jkoritzinsky Jul 15, 2024
5a192db
Implement GC heap map association
jkoritzinsky Jul 15, 2024
227ad83
Fill in more processing and start on sketching out the output handling.
jkoritzinsky Jul 16, 2024
d487523
Port over remaining features
jkoritzinsky Jul 16, 2024
3d92f5e
Remove native StressLogAnalyzer
jkoritzinsky Jul 16, 2024
5e20521
Get 'dump all messages' working correctly
jkoritzinsky Jul 16, 2024
8180c9f
Fix format offset calculation and update contract md to include refer…
jkoritzinsky Jul 16, 2024
1c5f08e
Merge branch 'main' of github.com:dotnet/runtime into cdac-stresslog-…
jkoritzinsky Jul 16, 2024
77669f3
Add a conceptual description of how to format a StressLog message
jkoritzinsky Jul 16, 2024
2c369c5
Implement escape sequence interpretation
jkoritzinsky Jul 16, 2024
7cb4dd3
Redefine maxMsgSize to make it C++11 constexpr-compliant even with ou…
jkoritzinsky Jul 16, 2024
0aad986
Merge branch 'main' of github.com:dotnet/runtime into cdac-stresslog-…
jkoritzinsky Jul 17, 2024
5e314f1
Add "is pointer in stresslog" contract function for SOS's GCHandleLea…
jkoritzinsky Jul 17, 2024
7fd20a0
Add some additional members to the contract to allow implementing all…
jkoritzinsky Jul 17, 2024
4c5ea16
Wire up ISOSDacInterface::GetStressLogAddress while I'm here
jkoritzinsky Jul 17, 2024
da3f56a
Merge branch 'main' of github.com:dotnet/runtime into cdac-stresslog-…
jkoritzinsky Jul 18, 2024
09ec3d2
Merge branch 'main' into cdac-stresslog-analyzer
jkoritzinsky Jul 19, 2024
0b28ab3
Merge branch 'main' into cdac-stresslog-analyzer
jkoritzinsky Jul 21, 2024
ee2f1f1
Update the StressLog contract to better describe and cross-link the c…
jkoritzinsky Jul 22, 2024
edebefa
Start adjusting output to match StressLogAnalyzer
jkoritzinsky Jul 22, 2024
914639a
Fix discovering the first message of a new chunk
jkoritzinsky Jul 22, 2024
23f9eaf
Fix remaining output nits that would cause the most confusion.
jkoritzinsky Jul 22, 2024
1bca8c2
Lots of perf improvements and some fixes
jkoritzinsky Jul 23, 2024
4145344
Rewrite GC time index searching for better perf
jkoritzinsky Jul 23, 2024
6d7a859
Make GC thread filtering more aggressive and fix non-GC thread filter…
jkoritzinsky Jul 23, 2024
9368bad
Hook into clr.tools and clr.toolstests subsets
jkoritzinsky Jul 23, 2024
277ca4b
Remove uncessary cast
jkoritzinsky Jul 23, 2024
96aaec7
Correctly implement the quit/retry commands
jkoritzinsky Jul 29, 2024
ee89343
Merge branch 'main' of github.com:dotnet/runtime into cdac-stresslog-…
jkoritzinsky Aug 20, 2024
208412b
Use string helpers from Target
jkoritzinsky Aug 20, 2024
ffd4fe1
Remove dead code now that StressLogAnalyzer is in C#
jkoritzinsky Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add "is pointer in stresslog" contract function for SOS's GCHandleLea…
…ks functionality
  • Loading branch information
jkoritzinsky committed Jul 17, 2024
commit 5e314f1bbc22ddbd926d29bd6e2bdad208bb82df
22 changes: 22 additions & 0 deletions docs/design/datacontracts/StressLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ bool HasStressLog();
StressLogData GetStressLogData();
IEnumerable<ThreadStressLogData> GetThreadStressLogs(TargetPointer Logs);
IEnumerable<StressMsgData> GetStressMessages(ThreadStressLogData threadLog);
bool IsPointerInStressLog(StressLogData stressLog, TargetPointer pointer);
```

## Versions 0 to 2
Expand Down Expand Up @@ -223,6 +224,27 @@ IEnumerable<StressMsgData> GetStressMessages(ThreadStressLog threadLog, uint for
readPointer = new TargetPointer((ulong)readPointer + stressMsgHeaderSize + pointerSize * (uint)parsedMessage.Args.Count);
}
}

bool IsPointerInStressLog(StressLogData stressLog, TargetPointer pointer)
{
ulong chunckSize = target.GetTypeInfo(DataType.StressLogChunk).Size!.Value;
foreach (ThreadStressLogData threadLog in GetThreadStressLogs(stressLog.Logs))
{
TargetPointer chunkPtr = threadLog.ChunkListHead;
do
{
if (pointer.Value >= chunkPtr.Value && pointer.Value <= chunkPtr.Value + chunckSize)
{
return true;
}

Data.StressLogChunk chunk = target.ProcessedData.GetOrAdd<Data.StressLogChunk>(chunkPtr);
chunkPtr = chunk.Next;
} while (chunkPtr != TargetPointer.Null && chunkPtr != threadLog.ChunkListHead);
}

return false;
}
```

A StressLog message, represented by a `StressMsgData` struct, can be formatted as though the null-terminated UTF-8 string located at `FormatString` is a `printf`-style format string, with all arguments located at `Args`. Additionally, the following special format specifiers are supported:
Expand Down
21 changes: 21 additions & 0 deletions src/native/managed/cdacreader/src/Contracts/StressLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,27 @@ public IEnumerable<StressMsgData> GetStressMessages(ThreadStressLogData threadLo
readPointer = new TargetPointer((ulong)readPointer + stressMsgHeaderSize + pointerSize * (uint)parsedMessage.Args.Count);
}
}

public bool IsPointerInStressLog(StressLogData stressLog, TargetPointer pointer)
{
ulong chunckSize = target.GetTypeInfo(DataType.StressLogChunk).Size!.Value;
foreach (ThreadStressLogData threadLog in GetThreadStressLogs(stressLog.Logs))
{
TargetPointer chunkPtr = threadLog.ChunkListHead;
do
{
if (pointer.Value >= chunkPtr.Value && pointer.Value <= chunkPtr.Value + chunckSize)
{
return true;
}

Data.StressLogChunk chunk = target.ProcessedData.GetOrAdd<Data.StressLogChunk>(chunkPtr);
chunkPtr = chunk.Next;
} while (chunkPtr != TargetPointer.Null && chunkPtr != threadLog.ChunkListHead);
}

return false;
}
}

file sealed class StressLog_0(Target target) : StressLog_0_2(target)
Expand Down