Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_repair_fd_catchup_h 2 : #define HEADER_fd_src_flamenco_repair_fd_catchup_h 3 : 4 : /* fd_catchup tracks metadata on the N most recent slots, in particular 5 : the time it took to complete the slot. As this purpose of this 6 : module currently is exclusively to print a waterfall diagram of the 7 : catchup progress, this is a circular buffer of the last N slots, 8 : where N=256 and is non-configurable. */ 9 : 10 : 11 : #include "../../util/fd_util_base.h" 12 : struct fd_catchup_metrics { 13 : ulong slot; 14 : long first_ts; 15 : long slot_complete_ts; 16 : 17 : uint repair_cnt; 18 : uint turbine_cnt; 19 : }; 20 : typedef struct fd_catchup_metrics fd_catchup_metrics_t; 21 : 22 0 : #define FD_CATCHUP_METRICS_MAX 256 23 : 24 : struct fd_catchup_t { 25 : fd_catchup_metrics_t metrics[ FD_CATCHUP_METRICS_MAX ]; 26 : uint st; 27 : uint en; 28 : ulong turbine_slot0; 29 : }; 30 : typedef struct fd_catchup_t fd_catchup_t; 31 : 32 : 33 : FD_FN_CONST static inline ulong 34 0 : fd_catchup_align( void ) { 35 0 : return alignof( fd_catchup_metrics_t ); 36 0 : } 37 : 38 : FD_FN_CONST static inline ulong 39 0 : fd_catchup_footprint( void ) { 40 0 : return sizeof( fd_catchup_t ); 41 0 : } 42 : 43 : void * 44 : fd_catchup_new( void * mem ); 45 : 46 : fd_catchup_t * 47 : fd_catchup_join( void * catchup ); 48 : 49 : void 50 : fd_catchup_set_turbine_slot0( fd_catchup_t * catchup, ulong turbine_slot0 ); 51 : 52 : void 53 : fd_catchup_print( fd_catchup_t * catchup ); 54 : 55 : void 56 : fd_catchup_add_slot( fd_catchup_t * catchup, ulong slot, long first_ts, long slot_complete_ts, uint repair_cnt, uint turbine_cnt ); 57 : 58 : 59 : 60 : #endif /* HEADER_fd_src_flamenco_repair_fd_catchup_h */