Prevent XYZAC TP queue starvation

This commit is contained in:
2026-09-02 10:41:21 +08:00
parent 0a22c7bf1b
commit 32adda73d6
10 changed files with 77 additions and 16 deletions

View File

@@ -46,6 +46,7 @@ const run = send("PROGRAM_RUN");
assert.equal(run.kind, "COMMAND_RESULT");
let stepped = null;
let executionTraceEntries = 0;
let runningQueueGaps = 0;
// The first long Z feed is planned at the configured LinuxCNC TP limit. Give
// the fixed-tick simulation enough servo time to complete it before checking
// that the interpreter has advanced beyond the historical line-82 boundary.
@@ -55,6 +56,7 @@ for (let cycle = 0; cycle < cyclesToRun; cycle += 1) {
stepped = send("SIM_STEP", { cycles: 1, response: "motion_delta" });
assert.equal(stepped.kind, "COMMAND_RESULT");
executionTraceEntries += stepped.payload.execution_trace.length;
if (cycle > 0 && stepped.payload.program.program_status === "running" && Number(stepped.payload.wasm_motion.state.queue_depth) === 0) runningQueueGaps += 1;
}
assert.equal(stepped.kind, "COMMAND_RESULT");
assert.equal(stepped.payload.program.program_status, "running");
@@ -65,6 +67,7 @@ assert.equal(stepped.payload.motion_authority, "wasm");
assert.equal(Object.hasOwn(stepped.payload.xyzac_ledger.entries.at(-1), "response"), false);
assert.equal(session.timeline.snapshots.snapshots.size, 0);
assert.equal(session.ledger.audit({ maxEntries: 32 }).entries.length, 32);
assert.equal(runningQueueGaps, 0);
console.log(JSON.stringify({
schema: "xyzac-3d-chips-program.v1",
@@ -77,6 +80,7 @@ console.log(JSON.stringify({
cycles: cyclesToRun,
execution_line: stepped.payload.program.current_line,
execution_trace: executionTraceEntries,
running_queue_gaps: runningQueueGaps,
motion_authority: stepped.payload.motion_authority,
motion_delta_snapshots: session.timeline.snapshots.snapshots.size,
ledger_audit_window: session.ledger.audit({ maxEntries: 32 }).entries.length,