@@ -192,6 +192,8 @@ typedef struct {
192
192
increases, we expire old transactions. */
193
193
ulong highest_observed_slot ;
194
194
195
+ ulong transaction_expired ;
196
+
195
197
/* microblock_duration_ns, and wait_duration
196
198
respectively scaled to be in ticks instead of nanoseconds */
197
199
ulong microblock_duration_ticks ;
@@ -203,6 +205,9 @@ typedef struct {
203
205
full. This is an fd_deque. */
204
206
fd_txn_e_t * extra_txn_deq ;
205
207
int insert_to_extra ; /* whether the last insert was into pack or the extra deq */
208
+ ulong transaction_dropped_from_extra ;,
209
+ ulong transaction_inserted_from_extra ;,
210
+ ulong transaction_inserted_to_extra ;
206
211
#endif
207
212
208
213
fd_pack_in_ctx_t in [ 32 ];
@@ -250,6 +255,8 @@ typedef struct {
250
255
fd_txn_e_t * const * bundle ; /* points to _txn when non-NULL */
251
256
} current_bundle [1 ];
252
257
258
+ ulong partial_bundle_dropped_txn_cnt ;
259
+
253
260
block_builder_info_t blk_engine_cfg [1 ];
254
261
255
262
struct {
@@ -358,9 +365,7 @@ log_end_block_metrics( fd_pack_ctx_t * ctx,
358
365
359
366
static inline void
360
367
metrics_write ( fd_pack_ctx_t * ctx ) {
361
- FD_MCNT_ENUM_COPY ( PACK , TRANSACTION_INSERTED , ctx -> insert_result );
362
368
FD_MCNT_ENUM_COPY ( PACK , METRIC_TIMING , ((ulong * )ctx -> metric_timing ) );
363
- FD_MCNT_ENUM_COPY ( PACK , BUNDLE_CRANK_STATUS , ctx -> crank -> metrics );
364
369
FD_MHIST_COPY ( PACK , SCHEDULE_MICROBLOCK_DURATION_SECONDS , ctx -> schedule_duration );
365
370
FD_MHIST_COPY ( PACK , NO_SCHED_MICROBLOCK_DURATION_SECONDS , ctx -> no_sched_duration );
366
371
FD_MHIST_COPY ( PACK , INSERT_TRANSACTION_DURATION_SECONDS , ctx -> insert_duration );
@@ -369,6 +374,22 @@ metrics_write( fd_pack_ctx_t * ctx ) {
369
374
fd_pack_metrics_write ( ctx -> pack );
370
375
}
371
376
377
+ static inline void
378
+ metrics_write_fixed_interval ( fd_pack_ctx_t * ctx ) {
379
+ FD_MCNT_ENUM_COPY ( PACK , TRANSACTION_INSERTED , ctx -> insert_result );
380
+ FD_MCNT_SET ( PACK , TRANSACTION_EXPIRED , ctx -> transaction_expired );
381
+ FD_MCNT_ENUM_COPY ( PACK , BUNDLE_CRANK_STATUS , ctx -> crank -> metrics );
382
+ FD_MCNT_INC ( PACK , TRANSACTION_DROPPED_PARTIAL_BUNDLE , ctx -> partial_bundle_dropped_txn_cnt );
383
+
384
+ #if FD_PACK_USE_EXTRA_STORAGE
385
+ FD_MCNT_SET ( PACK , TRANSACTION_DROPPED_FROM_EXTRA , ctx -> transaction_dropped_from_extra );
386
+ FD_MCNT_SET ( PACK , TRANSACTION_INSERTED_FROM_EXTRA , ctx -> transaction_inserted_from_extra );
387
+ FD_MCNT_SET ( PACK , TRANSACTION_INSERTED_TO_EXTRA , ctx -> transaction_inserted_to_extra );
388
+ #endif
389
+
390
+ fd_pack_metrics_fixed_int_write (ctx -> pack );
391
+ }
392
+
372
393
static inline void
373
394
during_housekeeping ( fd_pack_ctx_t * ctx ) {
374
395
ctx -> approx_wallclock_ns = fd_log_wallclock ();
@@ -428,7 +449,7 @@ insert_from_extra( fd_pack_ctx_t * ctx ) {
428
449
insert_duration += fd_tickcount ();
429
450
ctx -> insert_result [ result + FD_PACK_INSERT_RETVAL_OFF ]++ ;
430
451
fd_histf_sample ( ctx -> insert_duration , (ulong )insert_duration );
431
- FD_MCNT_INC ( PACK , TRANSACTION_INSERTED_FROM_EXTRA , 1UL ) ;
452
+ ctx -> transaction_inserted_from_extra ++ ;
432
453
return result ;
433
454
}
434
455
#endif
@@ -747,8 +768,7 @@ during_frag( fd_pack_ctx_t * ctx,
747
768
}
748
769
ctx -> leader_slot = fd_disco_poh_sig_slot ( sig );
749
770
750
- ulong exp_cnt = fd_pack_expire_before ( ctx -> pack , fd_ulong_max ( ctx -> leader_slot , TRANSACTION_LIFETIME_SLOTS )- TRANSACTION_LIFETIME_SLOTS );
751
- FD_MCNT_INC ( PACK , TRANSACTION_EXPIRED , exp_cnt );
771
+ ctx -> transaction_expired += fd_pack_expire_before ( ctx -> pack , fd_ulong_max ( ctx -> leader_slot , TRANSACTION_LIFETIME_SLOTS )- TRANSACTION_LIFETIME_SLOTS );
752
772
753
773
fd_became_leader_t * became_leader = (fd_became_leader_t * )dcache_entry ;
754
774
ctx -> leader_bank = became_leader -> bank ;
@@ -817,16 +837,15 @@ during_frag( fd_pack_ctx_t * ctx,
817
837
with expired but high-fee-paying transactions. That can only
818
838
happen if we are getting transactions. */
819
839
ctx -> highest_observed_slot = sig ;
820
- ulong exp_cnt = fd_pack_expire_before ( ctx -> pack , fd_ulong_max ( ctx -> highest_observed_slot , TRANSACTION_LIFETIME_SLOTS )- TRANSACTION_LIFETIME_SLOTS );
821
- FD_MCNT_INC ( PACK , TRANSACTION_EXPIRED , exp_cnt );
840
+ ctx -> transaction_expired += fd_pack_expire_before ( ctx -> pack , fd_ulong_max ( ctx -> highest_observed_slot , TRANSACTION_LIFETIME_SLOTS )- TRANSACTION_LIFETIME_SLOTS );
822
841
}
823
842
824
843
825
844
if ( FD_UNLIKELY ( txnm -> block_engine .bundle_id ) ) {
826
845
ctx -> is_bundle = 1 ;
827
846
if ( FD_LIKELY ( txnm -> block_engine .bundle_id != ctx -> current_bundle -> id ) ) {
828
847
if ( FD_UNLIKELY ( ctx -> current_bundle -> bundle ) ) {
829
- FD_MCNT_INC ( PACK , TRANSACTION_DROPPED_PARTIAL_BUNDLE , ctx -> current_bundle -> txn_received ) ;
848
+ ctx -> partial_bundle_dropped_txn_cnt += ctx -> current_bundle -> txn_received ;
830
849
fd_pack_insert_bundle_cancel ( ctx -> pack , ctx -> current_bundle -> bundle , ctx -> current_bundle -> txn_cnt );
831
850
}
832
851
ctx -> current_bundle -> id = txnm -> block_engine .bundle_id ;
@@ -835,7 +854,7 @@ during_frag( fd_pack_ctx_t * ctx,
835
854
ctx -> current_bundle -> txn_received = 0UL ;
836
855
837
856
if ( FD_UNLIKELY ( ctx -> current_bundle -> txn_cnt == 0UL ) ) {
838
- FD_MCNT_INC ( PACK , TRANSACTION_DROPPED_PARTIAL_BUNDLE , 1UL ) ;
857
+ ctx -> partial_bundle_dropped_txn_cnt ++ ;
839
858
ctx -> current_bundle -> id = 0UL ;
840
859
return ;
841
860
}
@@ -857,15 +876,15 @@ during_frag( fd_pack_ctx_t * ctx,
857
876
} else {
858
877
if ( FD_UNLIKELY ( extra_txn_deq_full ( ctx -> extra_txn_deq ) ) ) {
859
878
extra_txn_deq_remove_head ( ctx -> extra_txn_deq );
860
- FD_MCNT_INC ( PACK , TRANSACTION_DROPPED_FROM_EXTRA , 1UL ) ;
879
+ ctx -> transaction_dropped_from_extra ++ ;
861
880
}
862
881
ctx -> cur_spot = extra_txn_deq_peek_tail ( extra_txn_deq_insert_tail ( ctx -> extra_txn_deq ) );
863
882
/* We want to store the current time in cur_spot so that we can
864
883
track its expiration better. We just stash it in the CU
865
884
fields, since those aren't important right now. */
866
885
ctx -> cur_spot -> txnp -> blockhash_slot = sig ;
867
886
ctx -> insert_to_extra = 1 ;
868
- FD_MCNT_INC ( PACK , TRANSACTION_INSERTED_TO_EXTRA , 1UL ) ;
887
+ ctx -> transaction_inserted_to_extra ++ ;
869
888
}
870
889
#else
871
890
ctx -> cur_spot = fd_pack_insert_txn_init ( ctx -> pack );
@@ -1094,9 +1113,12 @@ unprivileged_init( fd_topo_t * topo,
1094
1113
ctx -> ticks_per_ns = fd_tempo_tick_per_ns ( NULL );
1095
1114
ctx -> last_successful_insert = 0L ;
1096
1115
ctx -> highest_observed_slot = 0UL ;
1116
+ ctx -> transaction_expired = 0UL ;
1097
1117
ctx -> microblock_duration_ticks = (ulong )(fd_tempo_tick_per_ns ( NULL )* (double )MICROBLOCK_DURATION_NS + 0.5 );
1098
1118
#if FD_PACK_USE_EXTRA_STORAGE
1099
1119
ctx -> insert_to_extra = 0 ;
1120
+ ctx -> transaction_dropped_from_extra = 0UL ;
1121
+ ctx -> transaction_inserted_to_extra = 0UL ;
1100
1122
#endif
1101
1123
ctx -> use_consumed_cus = tile -> pack .use_consumed_cus ;
1102
1124
ctx -> crank -> enabled = tile -> pack .bundle .enabled ;
@@ -1204,12 +1226,13 @@ populate_allowed_fds( fd_topo_t const * topo,
1204
1226
#define STEM_CALLBACK_CONTEXT_TYPE fd_pack_ctx_t
1205
1227
#define STEM_CALLBACK_CONTEXT_ALIGN alignof(fd_pack_ctx_t)
1206
1228
1207
- #define STEM_CALLBACK_DURING_HOUSEKEEPING during_housekeeping
1208
- #define STEM_CALLBACK_BEFORE_CREDIT before_credit
1209
- #define STEM_CALLBACK_AFTER_CREDIT after_credit
1210
- #define STEM_CALLBACK_DURING_FRAG during_frag
1211
- #define STEM_CALLBACK_AFTER_FRAG after_frag
1212
- #define STEM_CALLBACK_METRICS_WRITE metrics_write
1229
+ #define STEM_CALLBACK_DURING_HOUSEKEEPING during_housekeeping
1230
+ #define STEM_CALLBACK_BEFORE_CREDIT before_credit
1231
+ #define STEM_CALLBACK_AFTER_CREDIT after_credit
1232
+ #define STEM_CALLBACK_DURING_FRAG during_frag
1233
+ #define STEM_CALLBACK_AFTER_FRAG after_frag
1234
+ #define STEM_CALLBACK_FIXED_METRICS_WRITE_INTERVAL metrics_write_fixed_interval
1235
+ #define STEM_CALLBACK_METRICS_WRITE metrics_write
1213
1236
1214
1237
#include "../../../../disco/stem/fd_stem.c"
1215
1238
0 commit comments