Line data Source code
1 : #ifndef HEADER_fd_src_discof_fd_startup_h 2 : #define HEADER_fd_src_discof_fd_startup_h 3 : 4 : #include "../disco/topo/fd_topo.h" 5 : 6 : /* fd_startup_gate defers a stem tile's work until the replay tile's 7 : status metric indicates that it loaded a snapshot. 8 : 9 : The tile enters its run loop immediately, so producers see credits 10 : returned and in links drain, and calls fd_startup_gate_idle once 11 : per iteration from a credit callback: while replay has not started 12 : it sleeps 1ms per call once every in link has been observed empty, 13 : keeping cores shared with snapshot loading tiles quiet. Frag 14 : callbacks call fd_startup_gate_busy so bursts drain at full speed. 15 : 16 : Requires read access to the metric_in workspace. 17 : Dispatches syscall clock_nanosleep( CLOCK_REALTIME, 0, ???, NULL ). */ 18 : 19 : struct fd_startup_gate { 20 : ulong volatile const * status; /* replay:0 RUNTIME_STATUS gauge */ 21 : int started; 22 : ulong idle_cnt; 23 : ulong idle_max; 24 : }; 25 : 26 : typedef struct fd_startup_gate fd_startup_gate_t; 27 : 28 : void 29 : fd_startup_gate_init( fd_startup_gate_t * gate, 30 : fd_topo_t const * topo, 31 : ulong in_cnt ); 32 : 33 : /* Returns 1 if replay started, else 0 (and possibly slept). */ 34 : 35 : int 36 : fd_startup_gate_idle( fd_startup_gate_t * gate ); 37 : 38 : static inline void 39 0 : fd_startup_gate_busy( fd_startup_gate_t * gate ) { 40 0 : gate->idle_cnt = 0UL; 41 0 : } 42 : 43 : #endif /* HEADER_fd_src_discof_fd_startup_h */