Line data Source code
1 : #ifndef HEADER_fd_src_disco_gui_fd_gui_h 2 : #define HEADER_fd_src_disco_gui_fd_gui_h 3 : 4 : #include "../fd_disco_base.h" 5 : 6 : #include "../../ballet/http/fd_http_server.h" 7 : #include "../../flamenco/types/fd_types.h" 8 : #include "../../flamenco/leaders/fd_leaders.h" 9 : 10 : #include "../topo/fd_topo.h" 11 : 12 0 : #define FD_GUI_SLOTS_CNT (864000UL) 13 0 : #define FD_GUI_TPS_HISTORY_WINDOW_DURATION_SECONDS (10L) /* 10 second moving average */ 14 0 : #define FD_GUI_TPS_HISTORY_SAMPLE_CNT (150UL) 15 0 : #define FD_GUI_TILE_TIMER_SNAP_CNT (512UL) 16 0 : #define FD_GUI_TILE_TIMER_LEADER_CNT (4096UL) 17 0 : #define FD_GUI_TILE_TIMER_LEADER_DOWNSAMPLE_CNT (50UL) 18 : #define FD_GUI_TILE_TIMER_TILE_CNT (128UL) 19 : 20 0 : #define FD_GUI_SLOT_LEVEL_INCOMPLETE (0) 21 0 : #define FD_GUI_SLOT_LEVEL_COMPLETED (1) 22 0 : #define FD_GUI_SLOT_LEVEL_OPTIMISTICALLY_CONFIRMED (2) 23 0 : #define FD_GUI_SLOT_LEVEL_ROOTED (3) 24 0 : #define FD_GUI_SLOT_LEVEL_FINALIZED (4) 25 : 26 0 : #define FD_GUI_VOTE_STATE_NON_VOTING (0) 27 0 : #define FD_GUI_VOTE_STATE_VOTING (1) 28 0 : #define FD_GUI_VOTE_STATE_DELINQUENT (2) 29 : 30 0 : #define FD_GUI_START_PROGRESS_TYPE_INITIALIZING ( 0) 31 0 : #define FD_GUI_START_PROGRESS_TYPE_SEARCHING_FOR_FULL_SNAPSHOT ( 1) 32 0 : #define FD_GUI_START_PROGRESS_TYPE_DOWNLOADING_FULL_SNAPSHOT ( 2) 33 0 : #define FD_GUI_START_PROGRESS_TYPE_SEARCHING_FOR_INCREMENTAL_SNAPSHOT ( 3) 34 0 : #define FD_GUI_START_PROGRESS_TYPE_DOWNLOADING_INCREMENTAL_SNAPSHOT ( 4) 35 0 : #define FD_GUI_START_PROGRESS_TYPE_CLEANING_BLOCK_STORE ( 5) 36 0 : #define FD_GUI_START_PROGRESS_TYPE_CLEANING_ACCOUNTS ( 6) 37 0 : #define FD_GUI_START_PROGRESS_TYPE_LOADING_LEDGER ( 7) 38 0 : #define FD_GUI_START_PROGRESS_TYPE_PROCESSING_LEDGER ( 8) 39 0 : #define FD_GUI_START_PROGRESS_TYPE_STARTING_SERVICES ( 9) 40 0 : #define FD_GUI_START_PROGRESS_TYPE_HALTED (10) 41 0 : #define FD_GUI_START_PROGRESS_TYPE_WAITING_FOR_SUPERMAJORITY (11) 42 0 : #define FD_GUI_START_PROGRESS_TYPE_RUNNING (12) 43 : 44 : struct fd_gui_gossip_peer { 45 : fd_pubkey_t pubkey[ 1 ]; 46 : ulong wallclock; 47 : ushort shred_version; 48 : 49 : int has_version; 50 : struct { 51 : ushort major; 52 : ushort minor; 53 : ushort patch; 54 : 55 : int has_commit; 56 : uint commit; 57 : 58 : uint feature_set; 59 : } version; 60 : 61 : struct { 62 : uint ipv4; 63 : ushort port; 64 : } sockets[ 12 ]; 65 : }; 66 : 67 : struct fd_gui_vote_account { 68 : fd_pubkey_t pubkey[ 1 ]; 69 : fd_pubkey_t vote_account[ 1 ]; 70 : 71 : ulong activated_stake; 72 : ulong last_vote; 73 : ulong root_slot; 74 : ulong epoch_credits; 75 : uchar commission; 76 : int delinquent; 77 : }; 78 : 79 : struct fd_gui_validator_info { 80 : fd_pubkey_t pubkey[ 1 ]; 81 : 82 : char name[ 64 ]; 83 : char website[ 128 ]; 84 : char details[ 256 ]; 85 : char icon_uri[ 128 ]; 86 : }; 87 : 88 : struct fd_gui_txn_waterfall { 89 : struct { 90 : ulong quic; 91 : ulong udp; 92 : ulong gossip; 93 : } in; 94 : 95 : struct { 96 : ulong net_overrun; 97 : ulong quic_overrun; 98 : ulong quic_quic_invalid; 99 : ulong quic_udp_invalid; 100 : ulong verify_overrun; 101 : ulong verify_parse; 102 : ulong verify_failed; 103 : ulong verify_duplicate; 104 : ulong dedup_duplicate; 105 : ulong resolv_failed; 106 : ulong pack_invalid; 107 : ulong pack_expired; 108 : ulong pack_retained; 109 : ulong pack_wait_full; 110 : ulong pack_leader_slow; 111 : ulong bank_invalid; 112 : ulong block_success; 113 : ulong block_fail; 114 : } out; 115 : }; 116 : 117 : typedef struct fd_gui_txn_waterfall fd_gui_txn_waterfall_t; 118 : 119 : struct fd_gui_tile_timers { 120 : ulong caughtup_housekeeping_ticks; 121 : ulong processing_housekeeping_ticks; 122 : ulong backpressure_housekeeping_ticks; 123 : 124 : ulong caughtup_prefrag_ticks; 125 : ulong processing_prefrag_ticks; 126 : ulong backpressure_prefrag_ticks; 127 : 128 : ulong caughtup_postfrag_ticks; 129 : ulong processing_postfrag_ticks; 130 : }; 131 : 132 : typedef struct fd_gui_tile_timers fd_gui_tile_timers_t; 133 : 134 : struct fd_gui_tile_prime_metric { 135 : ulong net_in_bytes; 136 : ulong quic_conns; 137 : ulong verify_drop_numerator; 138 : ulong verify_drop_denominator; 139 : ulong dedup_drop_numerator; 140 : ulong dedup_drop_denominator; 141 : ulong pack_fill_numerator; 142 : ulong pack_fill_denominator; 143 : ulong bank_txn; 144 : ulong net_out_bytes; 145 : long ts_nanos; 146 : }; 147 : 148 : typedef struct fd_gui_tile_prime_metric fd_gui_tile_prime_metric_t; 149 : 150 0 : #define FD_GUI_SLOT_LEADER_UNSTARTED (0UL) 151 0 : #define FD_GUI_SLOT_LEADER_STARTED (1UL) 152 0 : #define FD_GUI_SLOT_LEADER_ENDED (2UL) 153 : 154 : struct fd_gui_slot { 155 : ulong slot; 156 : ulong parent_slot; 157 : long completed_time; 158 : int mine; 159 : int skipped; 160 : int must_republish; 161 : int level; 162 : ulong total_txn_cnt; 163 : ulong vote_txn_cnt; 164 : ulong failed_txn_cnt; 165 : ulong nonvote_failed_txn_cnt; 166 : ulong compute_units; 167 : ulong transaction_fee; 168 : ulong priority_fee; 169 : 170 : int leader_state; 171 : 172 : fd_gui_txn_waterfall_t waterfall_begin[ 1 ]; 173 : fd_gui_txn_waterfall_t waterfall_end[ 1 ]; 174 : 175 : fd_gui_tile_prime_metric_t tile_prime_metric_begin[ 1 ]; 176 : fd_gui_tile_prime_metric_t tile_prime_metric_end[ 1 ]; 177 : 178 : ulong tile_timers_history_idx; 179 : }; 180 : 181 : typedef struct fd_gui_slot fd_gui_slot_t; 182 : 183 : struct fd_gui { 184 : fd_http_server_t * http; 185 : fd_topo_t * topo; 186 : 187 : long next_sample_400millis; 188 : long next_sample_100millis; 189 : long next_sample_10millis; 190 : 191 : ulong debug_in_leader_slot; 192 : 193 : struct { 194 : fd_pubkey_t identity_key[ 1 ]; 195 : char identity_key_base58[ FD_BASE58_ENCODED_32_SZ+1 ]; 196 : 197 : char const * version; 198 : char const * cluster; 199 : 200 : ulong vote_distance; 201 : int vote_state; 202 : 203 : long startup_time_nanos; 204 : 205 : uchar startup_progress; 206 : int startup_got_full_snapshot; 207 : 208 : ulong startup_incremental_snapshot_slot; 209 : uint startup_incremental_snapshot_peer_ip_addr; 210 : ushort startup_incremental_snapshot_peer_port; 211 : double startup_incremental_snapshot_elapsed_secs; 212 : double startup_incremental_snapshot_remaining_secs; 213 : double startup_incremental_snapshot_throughput; 214 : ulong startup_incremental_snapshot_total_bytes; 215 : ulong startup_incremental_snapshot_current_bytes; 216 : 217 : ulong startup_full_snapshot_slot; 218 : uint startup_full_snapshot_peer_ip_addr; 219 : ushort startup_full_snapshot_peer_port; 220 : double startup_full_snapshot_elapsed_secs; 221 : double startup_full_snapshot_remaining_secs; 222 : double startup_full_snapshot_throughput; 223 : ulong startup_full_snapshot_total_bytes; 224 : ulong startup_full_snapshot_current_bytes; 225 : 226 : ulong startup_ledger_slot; 227 : ulong startup_ledger_max_slot; 228 : 229 : ulong startup_waiting_for_supermajority_slot; 230 : ulong startup_waiting_for_supermajority_stake_pct; 231 : 232 : ulong balance; 233 : ulong estimated_slot_duration_nanos; 234 : 235 : ulong net_tile_cnt; 236 : ulong quic_tile_cnt; 237 : ulong verify_tile_cnt; 238 : ulong resolv_tile_cnt; 239 : ulong bank_tile_cnt; 240 : ulong shred_tile_cnt; 241 : 242 : ulong slot_rooted; 243 : ulong slot_optimistically_confirmed; 244 : ulong slot_completed; 245 : ulong slot_estimated; 246 : 247 : ulong estimated_tps_history_idx; 248 : ulong estimated_tps_history[ FD_GUI_TPS_HISTORY_SAMPLE_CNT ][ 3UL ]; 249 : 250 : fd_gui_txn_waterfall_t txn_waterfall_reference[ 1 ]; 251 : fd_gui_txn_waterfall_t txn_waterfall_current[ 1 ]; 252 : 253 : fd_gui_tile_prime_metric_t tile_prime_metric_ref[ 1 ]; 254 : fd_gui_tile_prime_metric_t tile_prime_metric_cur[ 1 ]; 255 : 256 : ulong tile_timers_snap_idx; 257 : ulong tile_timers_snap_idx_slot_start; 258 : /* Temporary storage for samples. Will be downsampled into leader history on slot end. */ 259 : fd_gui_tile_timers_t tile_timers_snap[ FD_GUI_TILE_TIMER_SNAP_CNT ][ FD_GUI_TILE_TIMER_TILE_CNT ]; 260 : ulong tile_timers_history_idx; 261 : fd_gui_tile_timers_t tile_timers_leader_history[ FD_GUI_TILE_TIMER_LEADER_CNT ][ FD_GUI_TILE_TIMER_LEADER_DOWNSAMPLE_CNT ][ FD_GUI_TILE_TIMER_TILE_CNT ]; 262 : ulong tile_timers_leader_history_slot_sample_cnt[ FD_GUI_TILE_TIMER_LEADER_CNT ]; 263 : ulong tile_timers_leader_history_slot[ FD_GUI_TILE_TIMER_LEADER_CNT ]; 264 : } summary; 265 : 266 : fd_gui_slot_t slots[ FD_GUI_SLOTS_CNT ][ 1 ]; 267 : 268 : struct { 269 : int has_epoch[ 2 ]; 270 : 271 : struct { 272 : ulong epoch; 273 : long start_time; 274 : long end_time; 275 : 276 : ulong my_total_slots; 277 : ulong my_skipped_slots; 278 : 279 : ulong start_slot; 280 : ulong end_slot; 281 : ulong excluded_stake; 282 : fd_epoch_leaders_t * lsched; 283 : uchar __attribute__((aligned(FD_EPOCH_LEADERS_ALIGN))) _lsched[ FD_EPOCH_LEADERS_FOOTPRINT(50000UL, 432000UL) ]; 284 : fd_stake_weight_t stakes[ 50000UL ]; 285 : } epochs[ 2 ]; 286 : } epoch; 287 : 288 : struct { 289 : ulong peer_cnt; 290 : struct fd_gui_gossip_peer peers[ 40200 ]; 291 : } gossip; 292 : 293 : struct { 294 : ulong vote_account_cnt; 295 : struct fd_gui_vote_account vote_accounts[ 40200 ]; 296 : } vote_account; 297 : 298 : struct { 299 : ulong info_cnt; 300 : struct fd_gui_validator_info info[ 40200 ]; 301 : } validator_info; 302 : }; 303 : 304 : typedef struct fd_gui fd_gui_t; 305 : 306 : FD_PROTOTYPES_BEGIN 307 : 308 : FD_FN_CONST ulong 309 : fd_gui_align( void ); 310 : 311 : FD_FN_CONST ulong 312 : fd_gui_footprint( void ); 313 : 314 : void * 315 : fd_gui_new( void * shmem, 316 : fd_http_server_t * http, 317 : char const * version, 318 : char const * cluster, 319 : uchar const * identity_key, 320 : int is_voting, 321 : fd_topo_t * topo ); 322 : 323 : fd_gui_t * 324 : fd_gui_join( void * shmem ); 325 : 326 : void 327 : fd_gui_ws_open( fd_gui_t * gui, 328 : ulong conn_id ); 329 : 330 : int 331 : fd_gui_ws_message( fd_gui_t * gui, 332 : ulong ws_conn_id, 333 : uchar const * data, 334 : ulong data_len ); 335 : 336 : void 337 : fd_gui_plugin_message( fd_gui_t * gui, 338 : ulong plugin_msg, 339 : uchar const * msg ); 340 : 341 : int 342 : fd_gui_poll( fd_gui_t * gui ); 343 : 344 : FD_PROTOTYPES_END 345 : 346 : #endif /* HEADER_fd_src_disco_gui_fd_gui_h */