feat(scheduler-sim-discrete-clock): remove the simulator speed argument and shadow copy (task 3.1)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
eb5f339541
commit
aa2bb6d090
32 changed files with 72 additions and 129 deletions
|
|
@ -295,6 +295,12 @@ struct xce_sched_core_s {
|
|||
* after xce_sched_core_init()); the simulation driver does so via
|
||||
* sim.c's sim_set_virtual_clock(). Only bare-core test fixtures that
|
||||
* never call either keep the neutral (0,0,1,1) default.
|
||||
*
|
||||
* speed_num/speed_den are not a user-selectable speed: they hold 1/1 in
|
||||
* normal mode (the clock tracks wall-clock time) and 0/1 in simulation
|
||||
* mode (scheduler-sim-discrete-clock: the simulator clock is frozen and
|
||||
* moves only when the replay loop sets virtual_clock_base to a recorded
|
||||
* timestamp).
|
||||
*/
|
||||
_Atomic uint64_t virtual_clock_base;
|
||||
_Atomic uint64_t real_clock_base;
|
||||
|
|
|
|||
|
|
@ -41,13 +41,6 @@
|
|||
* FILE *record_file; -- optional --sim-output stream
|
||||
* (task 11.5 writes to it; this
|
||||
* task only opens it)
|
||||
* uint64_t sim_speed_num/sim_speed_den -- the SAME two numbers this task
|
||||
* also stamps onto
|
||||
* `core.speed_num`/`core.speed_den`
|
||||
* (kept here too per design.md's
|
||||
* literal struct, e.g. for the
|
||||
* REPL/diagnostics to read without
|
||||
* reaching into `core`)
|
||||
* bool verify; -- --sim-verify (task 11.4 acts on
|
||||
* it; this task only stores it)
|
||||
* bool interactive; -- --interactive/-i (task 12 acts on
|
||||
|
|
@ -57,14 +50,12 @@
|
|||
* struct sketch (scheduler-core spec, task 11.5, Req 5 AC 19) -- added, not
|
||||
* merely implied, because writing a `--sim-output` file's initial
|
||||
* SnapshotEntry needs the EXACT timestamp Step 2's snapshot scan
|
||||
* (sim_locate_and_load_snapshot(), sim.c) chose, and re-deriving it via
|
||||
* xce_core_now(&sim->core) from inside sim_loop.c's event loop is NOT
|
||||
* equivalent for any --sim-speed other than frozen (0): the virtual clock
|
||||
* keeps advancing with real wall-clock time between
|
||||
* sched_sim_driver_start() returning and sim_loop.c's first opportunity to
|
||||
* write the output header/snapshot, so a re-derived value would drift from
|
||||
* "the same SnapshotEntry that was loaded" (AC 19's own wording -- same ts,
|
||||
* not merely a same-shaped one taken moments later).
|
||||
* (sim_locate_and_load_snapshot(), sim.c) chose. The simulator clock moves
|
||||
* only at recorded timestamps (the replay loop stamps each event's own
|
||||
* timestamp onto it), so by the time sim_loop.c writes the output
|
||||
* header/snapshot xce_core_now(&sim->core) may already have moved to a later
|
||||
* recorded value; storing the chosen timestamp keeps the output's initial
|
||||
* entry "the same SnapshotEntry that was loaded" (AC 19's own wording).
|
||||
*
|
||||
* `repl_state` below is a SECOND field beyond design.md's literal sketch
|
||||
* (scheduler-core spec, task 12.1, Req 5 AC 22) -- the interactive REPL's
|
||||
|
|
@ -87,8 +78,6 @@ typedef struct {
|
|||
FILE* replay_file;
|
||||
FILE* alt_events_file;
|
||||
FILE* record_file;
|
||||
uint64_t sim_speed_num;
|
||||
uint64_t sim_speed_den;
|
||||
bool verify;
|
||||
bool interactive;
|
||||
uint64_t snapshot_ts;
|
||||
|
|
@ -134,8 +123,10 @@ typedef struct {
|
|||
* 13's "The scheduler shall support simulation mode activated by --sim FILE
|
||||
* and --sim-start-ts TIMESTAMP", plus this task's own "Add the simulation-
|
||||
* mode CLI flags (replay file path, start timestamp, speed, verify,
|
||||
* alt-events file, output file, interactive)" bullet -- all seven listed
|
||||
* there are fields below). Populated by main.c's argp parsing, passed by
|
||||
* alt-events file, output file, interactive)" bullet -- every flag listed
|
||||
* there except speed is a field below; --sim-speed is a deprecated no-op
|
||||
* whose value main.c only logs, since the simulator clock moves only at
|
||||
* recorded timestamps). Populated by main.c's argp parsing, passed by
|
||||
* const pointer into sched_sim_driver_start()/sched_sim_driver_run().
|
||||
*
|
||||
* Deliberately a plain, self-contained struct -- only primitive/string
|
||||
|
|
@ -152,9 +143,6 @@ typedef struct {
|
|||
const char* replay_path; /* --sim FILE (required) */
|
||||
uint64_t sim_start_ts; /* --sim-start-ts TIMESTAMP (optional;
|
||||
* default SCHED_SIM_START_TS_LATEST) */
|
||||
uint64_t sim_speed; /* --sim-speed N: 0=as-fast-as-possible,
|
||||
* 1=real-time, N>1=N x real-time
|
||||
* (optional; default 1) */
|
||||
bool verify; /* --sim-verify (task 11.4) */
|
||||
const char*
|
||||
alt_events_path; /* --sim-alt-events FILE (optional, task 11.5) */
|
||||
|
|
@ -218,9 +206,10 @@ typedef struct {
|
|||
* not from core.c -- core.c's "zero wall-clock calls" isolation boundary,
|
||||
* test_core_isolation.c, is scoped to core.c specifically, not to driver-
|
||||
* level code that legitimately seeds the core's clock anchors), and
|
||||
* `sim->core.speed_num`/`speed_den` to `args->sim_speed`/1. From this point,
|
||||
* `xce_core_now(&sim->core)` returns virtual time computed from the
|
||||
* snapshot's own logical timestamp -- this function's own Observable.
|
||||
* `sim->core.speed_num`/`speed_den` to 0/1 (frozen: the simulator clock
|
||||
* moves only when the replay loop stamps a recorded timestamp onto it, never
|
||||
* with wall-clock time). From this point, `xce_core_now(&sim->core)` returns
|
||||
* the snapshot's own logical timestamp -- this function's own Observable.
|
||||
*
|
||||
* Known scope boundary: this function does NOT register any picker plugin
|
||||
* into `sim->core.plugins` (builtin_fcfs and friends are only registrable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue