LCOV - code coverage report
Current view: top level - disco/stem - fd_stem.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 8 17 47.1 %
Date: 2025-07-18 05:01:12 Functions: 1 224 0.4 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_stem_fd_stem_h
       2             : #define HEADER_fd_src_disco_stem_fd_stem_h
       3             : 
       4             : #include "../fd_disco_base.h"
       5             : 
       6           0 : #define FD_STEM_SCRATCH_ALIGN (128UL)
       7             : 
       8             : struct fd_stem_context {
       9             :    fd_frag_meta_t ** mcaches;
      10             :    ulong *           seqs;
      11             :    ulong *           depths;
      12             : 
      13             :    ulong *           cr_avail;
      14             :    ulong *           min_cr_avail;
      15             :    ulong             cr_decrement_amount;
      16             : };
      17             : 
      18             : typedef struct fd_stem_context fd_stem_context_t;
      19             : 
      20             : struct __attribute__((aligned(64))) fd_stem_tile_in {
      21             :   fd_frag_meta_t const * mcache;   /* local join to this in's mcache */
      22             :   uint                   depth;    /* == fd_mcache_depth( mcache ), depth of this in's cache (const) */
      23             :   uint                   idx;      /* index of this in in the list of providers, [0, in_cnt) */
      24             :   ulong                  seq;      /* sequence number of next frag expected from the upstream producer,
      25             :                                       updated when frag from this in is published */
      26             :   fd_frag_meta_t const * mline;    /* == mcache + fd_mcache_line_idx( seq, depth ), location to poll next */
      27             :   ulong *                fseq;     /* local join to the fseq used to return flow control credits to the in */
      28             :   uint                   accum[6]; /* local diagnostic accumulators.  These are drained during in housekeeping. */
      29             :                                    /* Assumes FD_FSEQ_DIAG_{PUB_CNT,PUB_SZ,FILT_CNT,FILT_SZ,OVRNP_CNT,OVRNP_FRAG_CNT} are 0:5 */
      30             : };
      31             : 
      32             : typedef struct fd_stem_tile_in fd_stem_tile_in_t;
      33             : 
      34             : static inline void
      35             : fd_stem_publish( fd_stem_context_t * stem,
      36             :                  ulong               out_idx,
      37             :                  ulong               sig,
      38             :                  ulong               chunk,
      39             :                  ulong               sz,
      40             :                  ulong               ctl,
      41             :                  ulong               tsorig,
      42          24 :                  ulong               tspub ) {
      43          24 :   ulong * seqp = &stem->seqs[ out_idx ];
      44          24 :   ulong   seq  = *seqp;
      45          24 :   fd_mcache_publish( stem->mcaches[ out_idx ], stem->depths[ out_idx ], seq, sig, chunk, sz, ctl, tsorig, tspub );
      46          24 :   stem->cr_avail[ out_idx ] -= stem->cr_decrement_amount;
      47          24 :   *stem->min_cr_avail        = fd_ulong_min( stem->cr_avail[ out_idx ], *stem->min_cr_avail );
      48          24 :   *seqp = fd_seq_inc( seq, 1UL );
      49          24 : }
      50             : 
      51             : static inline ulong
      52             : fd_stem_advance( fd_stem_context_t * stem,
      53           0 :                  ulong               out_idx ) {
      54           0 :   ulong * seqp = &stem->seqs[ out_idx ];
      55           0 :   ulong   seq  = *seqp;
      56           0 :   stem->cr_avail[ out_idx ] -= stem->cr_decrement_amount;
      57           0 :   *stem->min_cr_avail        = fd_ulong_min( stem->cr_avail[ out_idx ], *stem->min_cr_avail );
      58           0 :   *seqp = fd_seq_inc( seq, 1UL );
      59           0 :   return seq;
      60           0 : }
      61             : 
      62             : #endif /* HEADER_fd_src_disco_stem_fd_stem_h */

Generated by: LCOV version 1.14