LCOV - code coverage report
Current view: top level - disco/gui - fd_gui.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 30 0.0 %
Date: 2025-01-08 12:08:44 Functions: 0 0 -

          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_frag_drop;
      99             :     ulong quic_abandoned;
     100             :     ulong tpu_quic_invalid;
     101             :     ulong tpu_udp_invalid;
     102             :     ulong verify_overrun;
     103             :     ulong verify_parse;
     104             :     ulong verify_failed;
     105             :     ulong verify_duplicate;
     106             :     ulong dedup_duplicate;
     107             :     ulong resolv_failed;
     108             :     ulong pack_invalid;
     109             :     ulong pack_expired;
     110             :     ulong pack_retained;
     111             :     ulong pack_wait_full;
     112             :     ulong pack_leader_slow;
     113             :     ulong bank_invalid;
     114             :     ulong block_success;
     115             :     ulong block_fail;
     116             :   } out;
     117             : };
     118             : 
     119             : typedef struct fd_gui_txn_waterfall fd_gui_txn_waterfall_t;
     120             : 
     121             : struct fd_gui_tile_timers {
     122             :   ulong caughtup_housekeeping_ticks;
     123             :   ulong processing_housekeeping_ticks;
     124             :   ulong backpressure_housekeeping_ticks;
     125             : 
     126             :   ulong caughtup_prefrag_ticks;
     127             :   ulong processing_prefrag_ticks;
     128             :   ulong backpressure_prefrag_ticks;
     129             : 
     130             :   ulong caughtup_postfrag_ticks;
     131             :   ulong processing_postfrag_ticks;
     132             : };
     133             : 
     134             : typedef struct fd_gui_tile_timers fd_gui_tile_timers_t;
     135             : 
     136             : struct fd_gui_tile_stats {
     137             :   long  sample_time_nanos;
     138             : 
     139             :   ulong net_in_rx_bytes;      /* Number of bytes received by the net tile*/
     140             :   ulong quic_conn_cnt;        /* Number of active QUIC connections */
     141             :   ulong verify_drop_cnt;      /* Number of transactions dropped by verify tiles */
     142             :   ulong verify_total_cnt;     /* Number of transactions received by verify tiles */
     143             :   ulong dedup_drop_cnt;       /* Number of transactions dropped by dedup tile */
     144             :   ulong dedup_total_cnt;      /* Number of transactions received by dedup tile */
     145             :   ulong pack_buffer_cnt;      /* Number of buffered transactions in the pack tile */
     146             :   ulong pack_buffer_capacity; /* Total size of the pack transaction buffer */
     147             :   ulong bank_txn_exec_cnt;    /* Number of transactions processed by the bank tile */
     148             :   ulong net_out_tx_bytes;     /* Number of bytes sent by the net tile */
     149             : };
     150             : 
     151             : typedef struct fd_gui_tile_stats fd_gui_tile_stats_t;
     152             : 
     153           0 : #define FD_GUI_SLOT_LEADER_UNSTARTED (0UL)
     154           0 : #define FD_GUI_SLOT_LEADER_STARTED   (1UL)
     155           0 : #define FD_GUI_SLOT_LEADER_ENDED     (2UL)
     156             : 
     157             : struct fd_gui_slot {
     158             :   ulong slot;
     159             :   ulong parent_slot;
     160             :   long  completed_time;
     161             :   int   mine;
     162             :   int   skipped;
     163             :   int   must_republish;
     164             :   int   level;
     165             :   ulong total_txn_cnt;
     166             :   ulong vote_txn_cnt;
     167             :   ulong failed_txn_cnt;
     168             :   ulong nonvote_failed_txn_cnt;
     169             :   ulong compute_units;
     170             :   ulong transaction_fee;
     171             :   ulong priority_fee;
     172             :   ulong tips;
     173             : 
     174             :   int leader_state;
     175             : 
     176             :   fd_gui_txn_waterfall_t waterfall_begin[ 1 ];
     177             :   fd_gui_txn_waterfall_t waterfall_end[ 1 ];
     178             : 
     179             :   fd_gui_tile_stats_t tile_stats_begin[ 1 ];
     180             :   fd_gui_tile_stats_t tile_stats_end[ 1 ];
     181             : 
     182             :   ulong tile_timers_history_idx;
     183             : };
     184             : 
     185             : typedef struct fd_gui_slot fd_gui_slot_t;
     186             : 
     187             : struct fd_gui {
     188             :   fd_http_server_t * http;
     189             :   fd_topo_t * topo;
     190             : 
     191             :   long next_sample_400millis;
     192             :   long next_sample_100millis;
     193             :   long next_sample_10millis;
     194             : 
     195             :   ulong debug_in_leader_slot;
     196             : 
     197             :   struct {
     198             :     fd_pubkey_t identity_key[ 1 ];
     199             :     char identity_key_base58[ FD_BASE58_ENCODED_32_SZ+1 ];
     200             : 
     201             :     char const * version;
     202             :     char const * cluster;
     203             : 
     204             :     ulong vote_distance;
     205             :     int vote_state;
     206             : 
     207             :     long  startup_time_nanos;
     208             : 
     209             :     uchar startup_progress;
     210             :     int   startup_got_full_snapshot;
     211             : 
     212             :     ulong  startup_incremental_snapshot_slot;
     213             :     uint   startup_incremental_snapshot_peer_ip_addr;
     214             :     ushort startup_incremental_snapshot_peer_port;
     215             :     double startup_incremental_snapshot_elapsed_secs;
     216             :     double startup_incremental_snapshot_remaining_secs;
     217             :     double startup_incremental_snapshot_throughput;
     218             :     ulong  startup_incremental_snapshot_total_bytes;
     219             :     ulong  startup_incremental_snapshot_current_bytes;
     220             : 
     221             :     ulong  startup_full_snapshot_slot;
     222             :     uint   startup_full_snapshot_peer_ip_addr;
     223             :     ushort startup_full_snapshot_peer_port;
     224             :     double startup_full_snapshot_elapsed_secs;
     225             :     double startup_full_snapshot_remaining_secs;
     226             :     double startup_full_snapshot_throughput;
     227             :     ulong  startup_full_snapshot_total_bytes;
     228             :     ulong  startup_full_snapshot_current_bytes;
     229             : 
     230             :     ulong startup_ledger_slot;
     231             :     ulong startup_ledger_max_slot;
     232             : 
     233             :     ulong startup_waiting_for_supermajority_slot;
     234             :     ulong startup_waiting_for_supermajority_stake_pct;
     235             : 
     236             :     ulong balance;
     237             :     ulong estimated_slot_duration_nanos;
     238             : 
     239             :     ulong net_tile_cnt;
     240             :     ulong quic_tile_cnt;
     241             :     ulong verify_tile_cnt;
     242             :     ulong resolv_tile_cnt;
     243             :     ulong bank_tile_cnt;
     244             :     ulong shred_tile_cnt;
     245             : 
     246             :     ulong slot_rooted;
     247             :     ulong slot_optimistically_confirmed;
     248             :     ulong slot_completed;
     249             :     ulong slot_estimated;
     250             : 
     251             :     ulong estimated_tps_history_idx;
     252             :     ulong estimated_tps_history[ FD_GUI_TPS_HISTORY_SAMPLE_CNT ][ 3UL ];
     253             : 
     254             :     fd_gui_txn_waterfall_t txn_waterfall_reference[ 1 ];
     255             :     fd_gui_txn_waterfall_t txn_waterfall_current[ 1 ];
     256             : 
     257             :     fd_gui_tile_stats_t tile_stats_reference[ 1 ];
     258             :     fd_gui_tile_stats_t tile_stats_current[ 1 ];
     259             : 
     260             :     ulong                tile_timers_snap_idx;
     261             :     ulong                tile_timers_snap_idx_slot_start;
     262             :     /* Temporary storage for samples. Will be downsampled into leader history on slot end. */
     263             :     fd_gui_tile_timers_t tile_timers_snap[ FD_GUI_TILE_TIMER_SNAP_CNT ][ FD_GUI_TILE_TIMER_TILE_CNT ];
     264             :     ulong                tile_timers_history_idx;
     265             :     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 ];
     266             :     ulong                tile_timers_leader_history_slot_sample_cnt[ FD_GUI_TILE_TIMER_LEADER_CNT ];
     267             :     ulong                tile_timers_leader_history_slot[ FD_GUI_TILE_TIMER_LEADER_CNT ];
     268             :   } summary;
     269             : 
     270             :   fd_gui_slot_t slots[ FD_GUI_SLOTS_CNT ][ 1 ];
     271             : 
     272             :   struct {
     273             :     int has_epoch[ 2 ];
     274             : 
     275             :     struct {
     276             :       ulong epoch;
     277             :       long start_time;
     278             :       long end_time;
     279             : 
     280             :       ulong my_total_slots;
     281             :       ulong my_skipped_slots;
     282             : 
     283             :       ulong start_slot;
     284             :       ulong end_slot;
     285             :       ulong excluded_stake;
     286             :       fd_epoch_leaders_t * lsched;
     287             :       uchar __attribute__((aligned(FD_EPOCH_LEADERS_ALIGN))) _lsched[ FD_EPOCH_LEADERS_FOOTPRINT(50000UL, 432000UL) ];
     288             :       fd_stake_weight_t stakes[ 50000UL ];
     289             :     } epochs[ 2 ];
     290             :   } epoch;
     291             : 
     292             :   struct {
     293             :     ulong                     peer_cnt;
     294             :     struct fd_gui_gossip_peer peers[ 40200 ];
     295             :   } gossip;
     296             : 
     297             :   struct {
     298             :     ulong                      vote_account_cnt;
     299             :     struct fd_gui_vote_account vote_accounts[ 40200 ];
     300             :   } vote_account;
     301             : 
     302             :   struct {
     303             :     ulong                        info_cnt;
     304             :     struct fd_gui_validator_info info[ 40200 ];
     305             :   } validator_info;
     306             : };
     307             : 
     308             : typedef struct fd_gui fd_gui_t;
     309             : 
     310             : FD_PROTOTYPES_BEGIN
     311             : 
     312             : FD_FN_CONST ulong
     313             : fd_gui_align( void );
     314             : 
     315             : FD_FN_CONST ulong
     316             : fd_gui_footprint( void );
     317             : 
     318             : void *
     319             : fd_gui_new( void *             shmem,
     320             :             fd_http_server_t * http,
     321             :             char const *       version,
     322             :             char const *       cluster,
     323             :             uchar const *      identity_key,
     324             :             int                is_voting,
     325             :             fd_topo_t *        topo );
     326             : 
     327             : fd_gui_t *
     328             : fd_gui_join( void * shmem );
     329             : 
     330             : void
     331             : fd_gui_ws_open( fd_gui_t *  gui,
     332             :                 ulong       conn_id );
     333             : 
     334             : int
     335             : fd_gui_ws_message( fd_gui_t *    gui,
     336             :                    ulong         ws_conn_id,
     337             :                    uchar const * data,
     338             :                    ulong         data_len );
     339             : 
     340             : void
     341             : fd_gui_plugin_message( fd_gui_t *    gui,
     342             :                        ulong         plugin_msg,
     343             :                        uchar const * msg );
     344             : 
     345             : int
     346             : fd_gui_poll( fd_gui_t * gui );
     347             : 
     348             : FD_PROTOTYPES_END
     349             : 
     350             : #endif /* HEADER_fd_src_disco_gui_fd_gui_h */

Generated by: LCOV version 1.14