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

Open
opened 2026-11-26 20:20:47 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1270
Author: @ambroseautomation
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: carry/old-9926-thread-snapshot


📝 Commits (1)

  • 387fc16 runtime: LEONIDA_THREAD_SNAPSHOT names what every thread waits on at given times (A50)

📊 Changes

4 files changed (+550 additions, -0 deletions)

View changed files

📝 runtime/CMakeLists.txt (+9 -0)
➕ runtime/shims/thread_snapshot.h (+428 -0)
📝 runtime/src/main.cpp (+3 -0)
➕ runtime/test/thread_snapshot_test.cpp (+110 -0)

📄 Description

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)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1270 **Author:** [@ambroseautomation](https://github.com/ambroseautomation) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9926-thread-snapshot` --- ### 📝 Commits (1) - [`387fc16`](https://github.com/ubiquitarianism/leonida/commit/387fc167bafa7da563f91cd4b5f26af4249d2339) runtime: LEONIDA_THREAD_SNAPSHOT names what every thread waits on at given times (A50) ### 📊 Changes **4 files changed** (+550 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+9 -0) ➕ `runtime/shims/thread_snapshot.h` (+428 -0) 📝 `runtime/src/main.cpp` (+3 -0) ➕ `runtime/test/thread_snapshot_test.cpp` (+110 -0) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1301
No description provided.