[M1-SYS-03] Per-system timing + budget enforcement (G-R5) - #27
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
M1-SYS-03 exactly, nothing else (roadmap/M1-heartbeat.md): per-system timing + budget enforcement (G-R5).
World::runSystemstimes each system's own run (TimeItaround the run function) and hands the sample to a newWorld::checkSystemBudget(src/laige-sim/system_timing.cpp).Histogram, fixed capacitykSystemTimingWindowSamples(64 ≈ 1.1 s @ 60 Hz), O(1) no-alloc record, drop-oldest, rolls across ticks (not per-frame).measured > 1× budget→system/budget_overrun(Warn);measured >= 3× budget(kBudgetCriticalMultiplier) →system/budget_critical(Error); a 3× run fires both. NFR-13.3 5-field grammar (build-stable text, dynamic values as fieldssystem/id/measured_ms/budget_ms/p99_ms/window_samples), rate-limited per (subsystem, event, severity). Over-budget systems are still run — observation, never a gate.World::systemTimingStats(SystemId)(O(1) pure query) +World::systemTimingWindow(SystemId)(constHistogram*for the frame graph'sbudgetCheck).New public API (additive,
laige-api.json496 → 505 symbols)SystemTimingStats(+4 members),kSystemTimingWindowSamples,kBudgetCriticalMultiplier,World::systemTimingStats,World::systemTimingWindow.Tests
New
SystemTimingsuite (8 tests), CTest entrysystem_timing(the step's Verify command; in the TSan property list): healthy ticks log nothing; over-budget warns at the documented multiplier (second tick rate-limited,rate_limitedsummary on shutdown); critical system warns then errors in one tick; rolling window drops oldest; NFR-13.3 grammar check; query validation; state travels with move; zero-allocation window (non-sanitizer trees: 100 ticks × 2 systems →allocs=0).Verification (all local trees)
ctest -R system_timinggreen; full suite 43/43 onbuild(Debug GCC 16.2.1),build-asan(leak-free),build-tsan,build-clang,build-release,build-shared.-Wall -Werror);tools/laige-include-lintOK (28 files).laige-api.jsonregenerated;api-real-treegreen.Docs (same change, DOC-007)
New
docs/api/system_timing.md; cross-refs indocs/api/scheduler.md,docs/api/system_registry.md,docs/README.md,src/laige-sim/README.md.Compatibility
Additive only — no existing symbol or behavior changed. No
ENGINE-RULE-EXCEPTIONadded.Unverified paths