collect_host_context_pre_run

Function collect_host_context_pre_run 

Source
pub fn collect_host_context_pre_run() -> HostContext
Expand description

Capture the host context at the start of a run, before the VM boots or the test body mutates any sysctl / hugepage / THP setting. Semantic alias for collect_host_context — the collection mechanism is identical (same static-cache + dynamic re-read policy) and callers remain free to call either function on either side of the run, but the name pins intent: collect_host_context_pre_run documents that the returned snapshot is the authoritative view of the drift-prone dynamic fields (sched_tunables, hugepages_total / hugepages_free, thp_enabled / thp_defrag) as the scheduler saw them.

Pair the pre-run snapshot with the post-run snapshot produced by collect_host_context via HostContextSnapshots so downstream consumers can diff the two and surface environment mutations attributable to the test body (e.g. “scheduler config reservoir bumped /proc/sys/kernel/sched_migration_cost_ns mid-run”) rather than silently folding them into a single ambiguous “post-run” record.

Static fields (uname triple, CPU identity, total memory, hugepage size, online CPU count, NUMA node count) are memoised across every call in the process via STATIC_HOST_INFO, so collect_host_context_pre_run and collect_host_context observing different values for a static field implies CPU/memory/NUMA hotplug between the two calls — see the module-level “Static-cache staleness under hotplug” section for the hotplug contract.