ark::pipeline::SimClockThrottle
Defined in header “ark/pipeline/simclock_throttle.hh”.
This class manages a simulated clock. As you execute stage callbacks/timers, this will monitor the expected runtimes. The clock’s advancement will be throttled based on stages that are executing.
Methods
-
SimClockThrottle(const std::vector< StageInterfacePtr > & stages)
Constructors the throttler against the given set of stages. -
void mark_executing(uint64_t stage_instance_id, std::chrono::steady_clock::time_point expected_completion_time)
Register that a stage is executing and expected to complete at the given point in time. -
void mark_complete(uint64_t stage_instance_id)
Registers that the given stage is complete. This doesn’t remove it from consideration of throttling, but does allow us to advance up to the final completion time. -
bool is_stage_executing(uint64_t stage_instance_id)
Returns true if the given stage is processing and time hasn’t advanced past when it can run again. -
void tick(std::chrono::steady_clock::time_point new_time)
Marks that the clock has advanced to the given time. All stages that are ’executing’ and at that time or past it will be clear. -
std::optional< std::chrono::nanoseconds > get_time_remaining_until_limit(const std::chrono::steady_clock::time_point & now)
Returns the time that the simclock can advance to before it must block due to executing stages. -
void wait_once(std::chrono::nanoseconds duration)
Blocks until at least one stage finishes execution, or the timeout expires. -
uint64_t execution_count()
Returns the number of stages that have executed. -
std::map< std::string, LongRunningState > long_running_stages()
Returns all of the stages that have been running (in real time) for over a fixed number of seconds.