register_end_sample_callback

passengersim.callbacks.register_end_sample_callback(callback: Callable[[CallbackMixin], dict | None] | GenericTracer)

Register a function to be triggered at the end of each sample.

The callback function will be triggered before counters are reset or history buffers are rolled over.

Parameters:
callback : Callable[[Simulation], None]

The callback function to register. It should accept a single argument, which will be the Simulation object, and return a dictionary of interesting things to store, or nothing.