feat(scheduler-sim-decision-trace): hook the allocator loop

Task 3.1: when the sim publishes trace settings, sched_allocator() counts
job positions, starts a record for wanted jobs with their selection and
cluster-wide limits, pushes no-decision kinds as trace-only decisions,
and attaches the captured outcome to built decisions; every handoff
clears core->trace_rec. Live (trace_ctl NULL) is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-08 11:10:28 +00:00
parent 144a01982e
commit ed7b889bb7
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
4 changed files with 617 additions and 1 deletions

View file

@ -2627,3 +2627,30 @@ sched_trace_hooks_gate_test = executable(
test('scheduler trace hooks gate test',
sched_trace_hooks_gate_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
# scheduler-sim-decision-trace task 3.1: the allocator-loop trace hooks
# (design.md "TraceHooks", allocator-loop rows; Requirements 2.1-2.4, 6.1,
# 6.4, 11.2) on the real allocator thread. Real-scheduler_srcs link
# technique, so the decision-constructor wraps see the allocator's calls
# (decision-build failures).
sched_trace_hooks_alloc_loop_test_srcs = ['test_trace_hooks_alloc_loop.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
sched_trace_hooks_alloc_loop_test_srcs += ['../' + f]
endif
endforeach
sched_trace_hooks_alloc_loop_test = executable(
'sched_trace_hooks_alloc_loop_test',
sched_trace_hooks_alloc_loop_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
link_args: ['-Wl,--wrap=xcecli_start',
'-Wl,--wrap=xcecli_join',
'-Wl,--wrap=make_pend_decision',
'-Wl,--wrap=make_dispatch_decision'],
install: false)
test('scheduler trace hooks alloc loop test',
sched_trace_hooks_alloc_loop_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])