feat(scheduler-sim-decision-trace): trace attachment and trace-only op on decisions

Task 1.7: xce_decision_t gains a trace pointer (NULL from every existing
constructor) and XCE_DECISION_TRACE with make_trace_decision(); the live
driver skips trace-only decisions and frees any attached trace.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-08 08:40:37 +00:00
parent 320f88a432
commit 29b6734649
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 304 additions and 3 deletions

View file

@ -10,9 +10,17 @@ typedef enum {
XCE_DECISION_DISPATCH,
XCE_DECISION_PEND,
XCE_DECISION_NEW_SESSION,
XCE_DECISION_PREEMPT
XCE_DECISION_PREEMPT,
/* scheduler-sim-decision-trace: a trace-only decision carrying just a
* trace record (a selected job that produced no decision). Appended
* after the existing ops; produced only by the sim REPL's tracing,
* never in live. */
XCE_DECISION_TRACE
} xce_decision_op_t;
/* Defined in sched/trace.h, not included here to keep this header light. */
struct xce_sched_trace_rec_s;
/*
* xce_preempt_victim_t / xce_preempt_t - PREEMPT decision payload
* (scheduler-core spec, task 4.4, Req 5 AC 6). Scheduler-owned (not
@ -46,10 +54,21 @@ typedef struct {
xce_pendreason_t* reason;
xce_preempt_t* preempt;
} u;
/*
* Trace record attached to this decision (scheduler-sim-decision-trace,
* design.md "DecisionTransport"). NULL from every constructor except
* make_trace_decision(), and never set in live. The drain loop that
* receives the decision owns it: the REPL takes it by setting this to
* NULL, and every receiver calls sched_trace_rec_free(d->trace) right
* before free(d).
*/
struct xce_sched_trace_rec_s* trace;
} xce_decision_t;
extern xce_decision_t* make_pend_decision(xce_pendreason_t*);
extern xce_decision_t* make_dispatch_decision(xce_job_alloc_t*);
extern xce_decision_t* make_preempt_decision(xce_preempt_t*);
/* Trace-only decision: op XCE_DECISION_TRACE, zeroed union, trace = rec. */
extern xce_decision_t* make_trace_decision(struct xce_sched_trace_rec_s* rec);
#endif