Skip to content

Commit bd37443

Browse files
committed
gui: send active fork cnt
1 parent c73dc69 commit bd37443

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

src/disco/gui/fd_gui.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fd_gui_new( void * shmem,
137137
gui->summary.slot_turbine = ULONG_MAX;
138138
gui->summary.slot_reset = ULONG_MAX;
139139
gui->summary.slot_storage = ULONG_MAX;
140+
gui->summary.active_fork_cnt = 1UL;
140141

141142
for( ulong i=0UL; i < (FD_GUI_REPAIR_SLOT_HISTORY_SZ+1UL); i++ ) gui->summary.slots_max_repair[ i ].slot = ULONG_MAX;
142143
for( ulong i=0UL; i < (FD_GUI_TURBINE_SLOT_HISTORY_SZ+1UL); i++ ) gui->summary.slots_max_turbine[ i ].slot = ULONG_MAX;
@@ -229,6 +230,9 @@ fd_gui_ws_open( fd_gui_t * gui,
229230
fd_gui_printf_vote_balance,
230231
fd_gui_printf_estimated_slot_duration_nanos,
231232
fd_gui_printf_root_slot,
233+
fd_gui_printf_storage_slot,
234+
fd_gui_printf_reset_slot,
235+
fd_gui_printf_active_fork_cnt,
232236
fd_gui_printf_optimistically_confirmed_slot,
233237
fd_gui_printf_completed_slot,
234238
fd_gui_printf_estimated_slot,
@@ -2631,6 +2635,12 @@ fd_gui_handle_tower_update( fd_gui_t * gui,
26312635
long now ) {
26322636
(void)now;
26332637

2638+
if( FD_UNLIKELY( tower->active_fork_cnt!=gui->summary.active_fork_cnt ) ) {
2639+
gui->summary.active_fork_cnt = tower->active_fork_cnt;
2640+
fd_gui_printf_active_fork_cnt( gui );
2641+
fd_http_server_ws_broadcast( gui->http );
2642+
}
2643+
26342644
/* handle new root */
26352645
if( FD_LIKELY( tower->root_slot!=ULONG_MAX && gui->summary.slot_rooted!=tower->root_slot ) ) {
26362646
fd_gui_handle_rooted_slot( gui, tower->root_slot );
@@ -2657,6 +2667,7 @@ fd_gui_handle_replay_update( fd_gui_t * gui,
26572667
ulong identity_balance,
26582668
long now ) {
26592669
(void)now;
2670+
26602671
if( FD_LIKELY( gui->summary.slot_storage!=storage_slot ) ) {
26612672
gui->summary.slot_storage = storage_slot;
26622673
fd_gui_printf_storage_slot( gui );

src/disco/gui/fd_gui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ struct fd_gui {
635635
ulong slot_turbine;
636636
ulong slot_reset;
637637
ulong slot_storage;
638+
ulong active_fork_cnt;
638639

639640
fd_gui_ephemeral_slot_t slots_max_turbine[ FD_GUI_TURBINE_SLOT_HISTORY_SZ+1UL ];
640641
fd_gui_ephemeral_slot_t slots_max_repair [ FD_GUI_REPAIR_SLOT_HISTORY_SZ +1UL ];

src/disco/gui/fd_gui_printf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ fd_gui_printf_storage_slot( fd_gui_t * gui ) {
275275
jsonp_close_envelope( gui->http );
276276
}
277277

278+
void
279+
fd_gui_printf_active_fork_cnt( fd_gui_t * gui ) {
280+
jsonp_open_envelope( gui->http, "summary", "active_fork_count" );
281+
if( FD_LIKELY( gui->summary.active_fork_cnt!=ULONG_MAX ) ) jsonp_ulong( gui->http, "value", gui->summary.active_fork_cnt );
282+
else jsonp_null ( gui->http, "value" );
283+
jsonp_close_envelope( gui->http );
284+
}
285+
278286
void
279287
fd_gui_printf_slot_caught_up( fd_gui_t * gui ) {
280288
jsonp_open_envelope( gui->http, "summary", "slot_caught_up" );

src/disco/gui/fd_gui_printf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void fd_gui_printf_catch_up_history( fd_gui_t * gui );
3939
void fd_gui_peers_printf_vote_slot( fd_gui_peers_ctx_t * peers );
4040
void fd_gui_printf_reset_slot( fd_gui_t * gui );
4141
void fd_gui_printf_storage_slot( fd_gui_t * gui );
42+
void fd_gui_printf_active_fork_cnt( fd_gui_t * gui );
4243

4344
void
4445
fd_gui_printf_null_query_response( fd_http_server_t * http,

src/discof/tower/fd_tower_tile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ replay_slot_completed( ctx_t * ctx,
648648

649649
fd_tower_slot_done_t * msg = fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk );
650650
msg->replay_slot = slot_info->slot;
651+
msg->active_fork_cnt = fd_tower_leaves_pool_used( ctx->forks->tower_leaves_pool );
651652
msg->vote_slot = out.vote_slot;
652653
msg->reset_slot = out.reset_slot;
653654
msg->reset_block_id = out.reset_block_id;

src/discof/tower/fd_tower_tile.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ struct fd_tower_slot_done {
4545
ulong root_slot;
4646
fd_hash_t root_block_id;
4747

48+
/* The number of leaves in the forks tree. */
49+
ulong active_fork_cnt;
50+
4851
/* This tower_slot_done message is 1-to-1 with the completion of a
4952
replayed slot. When that slot was done, the bank_idx was sent to
5053
tower, which tower used to query the bank and populate the vote

0 commit comments

Comments
 (0)