#45 ROOT CAUSE + FIX: the gauge executive starves in MP -- panels froze at healthy fps

Instruments repaint via the background task pump, which authentically runs
ONLY in the frame's leftover time with a floor of ONE pump per frame; the
gauge renderer is 1 of ~7 round-robin tasks and each turn advances ONE gauge
of ~140 active, with the rate mask advancing once per full sweep.  On a busy
MP mission the foreground eats the whole frame budget, the floor becomes the
norm, and the whole instrument stack rotates once in MINUTES at perfect fps:
comms-panel K/D stuck at 0, recharge tickers frozen, while the tallies and
their replication underneath were exactly right.  Measured: 4-node bench at
70-90 fps gave the PilotList ~2 Execute turns in six minutes.

Fix, both env-tunable, authentic behavior restorable:
  BT_BG_MIN      (APPMGR.cpp, default 32, 0=authentic)  minimum background
                 pumps per frame regardless of slack;
  BT_GAUGE_BATCH (GAUGREND.cpp, default 32, 1=authentic) gauges advanced per
                 gauge-renderer turn (a visit is only a rate-mask check
                 unless the gauge is due).
Verified 4-node self-damage bench: sweeps 0.006/s -> 18-20/s, PilotList ~10
Exec/s, ALL FOUR panels tracked every death live (0->11) within ~1s, bg cost
2-4 ms/frame, respawn ledger clean (40 cycles, 0 swallow / 0 mismatch).

Also: BT_PERF now reports gaugeTurns/sweeps/active alongside bgTasks;
BT_AF_PERIOD now throttles the missile autofire group too (unthrottled spam
trips the documented FailureHeat all-weapons brick, which froze run 1 of the
cross-fire bench).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Joe DiPrima
2026-07-30 11:22:47 -05:00
co-authored by Claude Fable 5
parent bfa1b04990
commit 494f32efb4
5 changed files with 106 additions and 3 deletions
+34 -1
View File
@@ -3819,7 +3819,28 @@ Logical
case background:
{
result = ProcessOneActiveGauge();
// BT GAUGE BATCH (#45, with the APPMGR minimum-pump floor): one gauge
// per turn is the authentic pod pacing, but a visit is just a
// rate-mask check unless the gauge is due, so on modern hardware it
// starves the rotation for no benefit -- with ~140 active instruments
// and ~4 gauge turns/frame a full sweep took ~1s and a D-rate gauge
// (the comms-panel PilotList) ran every ~4s. Advance a BATCH of
// gauges per turn so a sweep completes ~every frame and panel rows
// track the sim within a second. BT_GAUGE_BATCH=1 restores the
// authentic single-step.
static int s_batch = -1;
if (s_batch < 0)
{
const char *e = getenv("BT_GAUGE_BATCH");
s_batch = e ? atoi(e) : 32;
if (s_batch < 1) s_batch = 1;
if (s_batch > 1024) s_batch = 1024;
}
int n = s_batch;
do
{
result = ProcessOneActiveGauge();
} while (--n > 0 && result && taskMode == background);
break;
}
@@ -3963,6 +3984,10 @@ void
Check_Fpu();
}
// BT gauge-executive counters (#45) -- definitions; sampled + reset by the
// BT_PERF probe in APPMGR.cpp.
int gBTGaugeTurns = 0, gBTGaugeSweeps = 0, gBTGaugeActive = 0;
//
//===========================================================================
// ProcessOneActiveGauge
@@ -3979,8 +4004,15 @@ Logical
GaugeBase
*base_pointer = activeIterator->ReadAndNext();
// BT gauge-executive counters (#45): read by the BT_PERF probe (APPMGR.cpp)
// to expose the instrument-rotation rate -- turns = single-gauge Updates,
// sweeps = full active-list passes (the rate mask advances once per sweep,
// so a "D-rate" gauge executes once per FOUR sweeps).
extern int gBTGaugeTurns, gBTGaugeSweeps, gBTGaugeActive;
if (base_pointer == NULL)
{
++gBTGaugeSweeps;
gBTGaugeActive = activeIterator->GetSize();
//--------------------------------------------------
// We're done!
// Bump the bit mask and index for the next pass
@@ -3997,6 +4029,7 @@ Logical
}
else
{
++gBTGaugeTurns;
//--------------------------------------------------
// Process one gauge
//--------------------------------------------------