runtime: LEONIDA_THREAD_SNAPSHOT names what every thread waits on at given times (OLD-9926) #1270

Closed
ambroseautomation wants to merge 1 commit from upstream-pr/1270 into main
ambroseautomation commented 2026-11-24 21:07:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ambroseautomation on 2026-11-24T21:07:11Z.


Claimed in the coordination issue as: OLD-9926 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144475783)

What and why

Carries forward old-pr/9926 (draft #195, original commit author JRamos1993 preserved; indexed in #17), rebased cleanly onto current main (6261ca916).

Adds LEONIDA_THREAD_SNAPSHOT diagnostic thread-wait reporting to gta6rt (runtime/shims/thread_snapshot.h, wired in runtime/src/main.cpp):

  • At configured timestamps, suspends and snapshots live threads, grouping identical stacks and naming both the thread (SetThreadDescription / MS_VC_EXCEPTION) and the kernel object each waiting thread is blocked on (auto-reset/manual-reset events, joined threads, worker-factory pools, etc.) with resolved host symbols.
  • Adds runtime/test/thread_snapshot_test.cpp and registers thread_snapshot in runtime/CMakeLists.txt.

Tested

  • Compiled and ran thread_snapshot_test.exe natively on Windows 11 with MSVC (/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2): all 6 checks PASS, zero compiler warnings.
  • Built runtime/build/gta6rt.exe via .\scripts\build_runtime.ps1 -jobs 8: succeeded cleanly with thread_snapshot.h included in runtime/src/main.cpp.
  • python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/thread_snapshot.h runtime/src/main.cpp runtime/test/thread_snapshot_test.cpp: exit 0 (no game data).

GPUs tested: n/a (CPU/OS runtime diagnostics; built and tested on Windows 11 Pro 64-bit, MSVC VS 18)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — runtime diagnostics)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480347519 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1270). Originally posted by [ambroseautomation](https://github.com/ambroseautomation) on 2026-11-24T21:07:11Z. --- Claimed in the coordination issue as: OLD-9926 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144475783) ### What and why Carries forward `old-pr/9926` (draft #195, original commit author `JRamos1993` preserved; indexed in #17), rebased cleanly onto current `main` (`6261ca916`). Adds `LEONIDA_THREAD_SNAPSHOT` diagnostic thread-wait reporting to `gta6rt` (`runtime/shims/thread_snapshot.h`, wired in `runtime/src/main.cpp`): - At configured timestamps, suspends and snapshots live threads, grouping identical stacks and naming both the thread (`SetThreadDescription` / `MS_VC_EXCEPTION`) and the kernel object each waiting thread is blocked on (auto-reset/manual-reset events, joined threads, worker-factory pools, etc.) with resolved host symbols. - Adds `runtime/test/thread_snapshot_test.cpp` and registers `thread_snapshot` in `runtime/CMakeLists.txt`. ### Tested - Compiled and ran `thread_snapshot_test.exe` natively on Windows 11 with MSVC (`/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`): all 6 checks PASS, zero compiler warnings. - Built `runtime/build/gta6rt.exe` via `.\scripts\build_runtime.ps1 -jobs 8`: succeeded cleanly with `thread_snapshot.h` included in `runtime/src/main.cpp`. - `python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/thread_snapshot.h runtime/src/main.cpp runtime/test/thread_snapshot_test.cpp`: exit 0 (no game data). GPUs tested: n/a (CPU/OS runtime diagnostics; built and tested on Windows 11 Pro 64-bit, MSVC VS 18) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — runtime diagnostics)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1270
No description provided.