Line data Source code
1 : #ifndef HEADER_fd_src_discof_repair_fd_repair_metrics_h 2 : #define HEADER_fd_src_discof_repair_fd_repair_metrics_h 3 : 4 : /* fd_repair_metrics 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 : repair_metrics progress, this is a circular buffer of the last N slots, 8 : where N=256 and is non-configurable. */ 9 : 10 : #include "../../util/fd_util_base.h" 11 : 12 : struct fd_slot_metrics { 13 : ulong slot; 14 : 15 : long first_shred_ts; 16 : long slot_complete_ts; /* tick */ 17 : 18 : uint repair_cnt; 19 : uint turbine_cnt; 20 : }; 21 : typedef struct fd_slot_metrics fd_slot_metrics_t; 22 : 23 : struct fd_shred_metrics { 24 : ulong slot; 25 : uint shred_idx; 26 : ulong req_cnt; 27 : ulong res_cnt; 28 : }; 29 : typedef struct fd_shred_metrics fd_shred_metrics_t; 30 : 31 0 : #define FD_CATCHUP_METRICS_MAX 16384 32 : 33 : struct fd_repair_metrics_t { 34 : fd_slot_metrics_t slots[FD_CATCHUP_METRICS_MAX]; 35 : fd_shred_metrics_t shreds[FD_CATCHUP_METRICS_MAX]; 36 : uint st; 37 : uint en; 38 : ulong turbine_slot0; 39 : }; 40 : typedef struct fd_repair_metrics_t fd_repair_metrics_t; 41 : 42 : 43 : FD_FN_CONST static inline ulong 44 0 : fd_repair_metrics_align( void ) { 45 0 : return alignof( fd_slot_metrics_t ); 46 0 : } 47 : 48 : FD_FN_CONST static inline ulong 49 0 : fd_repair_metrics_footprint( void ) { 50 0 : return sizeof( fd_repair_metrics_t ); 51 0 : } 52 : 53 : void * 54 : fd_repair_metrics_new( void * mem ); 55 : 56 : fd_repair_metrics_t * 57 : fd_repair_metrics_join( void * repair_metrics ); 58 : 59 : void 60 : fd_repair_metrics_set_turbine_slot0( fd_repair_metrics_t * repair_metrics, ulong turbine_slot0 ); 61 : 62 : void 63 : fd_repair_metrics_print( fd_repair_metrics_t * repair_metrics, int verbose ); 64 : 65 : void 66 : fd_repair_metrics_print_sorted( fd_repair_metrics_t * repair_metrics, int verbose, fd_slot_metrics_t * temp_slots ); 67 : 68 : void 69 : fd_repair_metrics_add_slot( fd_repair_metrics_t * repair_metrics, ulong slot, long first_ts, long slot_complete_ts, uint repair_cnt, uint turbine_cnt ); 70 : 71 : 72 : 73 : #endif /* HEADER_fd_src_discof_repair_fd_repair_metrics_h */