LCOV - code coverage report
Current view: top level - app/firedancer - callbacks.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 86 0.0 %
Date: 2026-01-23 05:02:40 Functions: 0 50 0.0 %

          Line data    Source code
       1             : #include "../../util/pod/fd_pod_format.h"
       2             : 
       3             : #include "../../disco/topo/fd_topo.h"
       4             : #include "../../disco/store/fd_store.h"
       5             : #include "../../flamenco/runtime/fd_bank.h"
       6             : #include "../../flamenco/runtime/fd_acc_pool.h"
       7             : #include "../../flamenco/runtime/fd_txncache_shmem.h"
       8             : #include "../../funk/fd_funk.h"
       9             : 
      10           0 : #define VAL(name) (__extension__({                                                             \
      11           0 :   ulong __x = fd_pod_queryf_ulong( topo->props, ULONG_MAX, "obj.%lu.%s", obj->id, name );      \
      12           0 :   if( FD_UNLIKELY( __x==ULONG_MAX ) ) FD_LOG_ERR(( "obj.%lu.%s was not set", obj->id, name )); \
      13           0 :   __x; }))
      14             : 
      15             : static ulong
      16             : banks_locks_footprint( fd_topo_t const *     topo FD_PARAM_UNUSED,
      17           0 :                        fd_topo_obj_t const * obj FD_PARAM_UNUSED ) {
      18           0 :   return sizeof(fd_banks_locks_t);
      19           0 : }
      20             : 
      21             : static ulong
      22             : banks_locks_align( fd_topo_t const *     topo FD_PARAM_UNUSED,
      23           0 :                    fd_topo_obj_t const * obj FD_PARAM_UNUSED ) {
      24           0 :   return alignof(fd_banks_locks_t);
      25           0 : }
      26             : 
      27             : static void
      28             : banks_locks_new( fd_topo_t const *     topo,
      29           0 :                  fd_topo_obj_t const * obj ) {
      30           0 :   fd_banks_locks_init( fd_topo_obj_laddr( topo, obj->id ) );
      31           0 : }
      32             : 
      33             : fd_topo_obj_callbacks_t fd_obj_cb_banks_locks = {
      34             :   .name      = "banks_locks",
      35             :   .footprint = banks_locks_footprint,
      36             :   .align     = banks_locks_align,
      37             :   .new       = banks_locks_new,
      38             : };
      39             : 
      40             : static ulong
      41             : banks_footprint( fd_topo_t const *     topo,
      42           0 :                  fd_topo_obj_t const * obj ) {
      43           0 :   return fd_banks_footprint( VAL("max_live_slots"), VAL("max_fork_width") );
      44           0 : }
      45             : 
      46             : static ulong
      47             : banks_align( fd_topo_t const *     topo FD_FN_UNUSED,
      48           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
      49           0 :   return fd_banks_align();
      50           0 : }
      51             : 
      52             : static void
      53             : banks_new( fd_topo_t const *     topo,
      54           0 :            fd_topo_obj_t const * obj ) {
      55           0 :   int larger_max_cost_per_block = fd_pod_queryf_int( topo->props, 0, "obj.%lu.larger_max_cost_per_block", obj->id );
      56           0 :   ulong seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      57           0 :   FD_TEST( fd_banks_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_live_slots"), VAL("max_fork_width"), larger_max_cost_per_block, seed ) );
      58           0 : }
      59             : 
      60             : fd_topo_obj_callbacks_t fd_obj_cb_banks = {
      61             :   .name      = "banks",
      62             :   .footprint = banks_footprint,
      63             :   .align     = banks_align,
      64             :   .new       = banks_new,
      65             : };
      66             : 
      67             : static ulong
      68             : funk_align( fd_topo_t const *     topo,
      69           0 :             fd_topo_obj_t const * obj ) {
      70           0 :   (void)topo; (void)obj;
      71           0 :   return fd_funk_align();
      72           0 : }
      73             : 
      74             : static ulong
      75             : funk_footprint( fd_topo_t const *     topo,
      76           0 :                 fd_topo_obj_t const * obj ) {
      77           0 :   (void)topo;
      78           0 :   return fd_funk_footprint( VAL("txn_max"), VAL("rec_max") );
      79           0 : }
      80             : 
      81             : static ulong
      82             : funk_loose( fd_topo_t const *     topo,
      83           0 :             fd_topo_obj_t const * obj ) {
      84           0 :   return VAL("heap_max");
      85           0 : }
      86             : 
      87             : static void
      88             : funk_new( fd_topo_t const *     topo,
      89           0 :            fd_topo_obj_t const * obj ) {
      90           0 :   ulong funk_seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      91           0 :   if( !funk_seed ) FD_TEST( fd_rng_secure( &funk_seed, sizeof(ulong) ) );
      92           0 :   FD_TEST( fd_funk_new( fd_topo_obj_laddr( topo, obj->id ), 2UL, funk_seed, VAL("txn_max"), VAL("rec_max") ) );
      93           0 : }
      94             : 
      95             : fd_topo_obj_callbacks_t fd_obj_cb_funk = {
      96             :   .name      = "funk",
      97             :   .footprint = funk_footprint,
      98             :   .loose     = funk_loose,
      99             :   .align     = funk_align,
     100             :   .new       = funk_new,
     101             : };
     102             : 
     103             : /* cnc: a tile admin message queue */
     104             : 
     105             : static ulong
     106             : cnc_align( fd_topo_t const *     topo,
     107           0 :            fd_topo_obj_t const * obj ) {
     108           0 :   (void)topo; (void)obj;
     109           0 :   return fd_cnc_align();
     110           0 : }
     111             : 
     112             : static ulong
     113             : cnc_footprint( fd_topo_t const *     topo,
     114           0 :                fd_topo_obj_t const * obj ) {
     115           0 :   return fd_cnc_footprint( VAL("app_sz") );
     116           0 : }
     117             : 
     118             : static void
     119             : cnc_new( fd_topo_t const *     topo,
     120           0 :          fd_topo_obj_t const * obj ) {
     121           0 :   FD_TEST( fd_cnc_new( fd_topo_obj_laddr( topo, obj->id ), VAL("app_sz"), VAL("type"), fd_log_wallclock() ) );
     122           0 : }
     123             : 
     124             : fd_topo_obj_callbacks_t fd_obj_cb_cnc = {
     125             :   .name      = "cnc",
     126             :   .footprint = cnc_footprint,
     127             :   .align     = cnc_align,
     128             :   .new       = cnc_new,
     129             : };
     130             : 
     131             : static ulong
     132             : fec_sets_footprint( fd_topo_t const *     topo,
     133           0 :                     fd_topo_obj_t const * obj ) {
     134           0 :   return VAL("sz");
     135           0 : }
     136             : 
     137             : static ulong
     138             : fec_sets_align( fd_topo_t const *     topo FD_FN_UNUSED,
     139           0 :                   fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     140           0 :   return fd_dcache_align();
     141           0 : }
     142             : 
     143             : static void
     144             : fec_sets_new( FD_PARAM_UNUSED fd_topo_t const *     topo,
     145           0 :               FD_PARAM_UNUSED fd_topo_obj_t const * obj ) {
     146           0 :   FD_TEST( fd_topo_obj_laddr( topo, obj->id ) );
     147           0 : }
     148             : 
     149             : fd_topo_obj_callbacks_t fd_obj_cb_fec_sets = {
     150             :   .name      = "fec_sets",
     151             :   .footprint = fec_sets_footprint,
     152             :   .align     = fec_sets_align,
     153             :   .new       = fec_sets_new,
     154             : };
     155             : 
     156             : static ulong
     157             : store_footprint( fd_topo_t const * topo,
     158           0 :                  fd_topo_obj_t const * obj ) {
     159           0 :   return fd_store_footprint( VAL("fec_max") );
     160           0 : }
     161             : 
     162             : static ulong
     163             : store_align( fd_topo_t const *     topo FD_FN_UNUSED,
     164           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     165           0 :   return fd_store_align();
     166           0 : }
     167             : 
     168             : static void
     169             : store_new( fd_topo_t const *     topo,
     170           0 :            fd_topo_obj_t const * obj ) {
     171           0 :   FD_TEST( fd_store_new( fd_topo_obj_laddr( topo, obj->id ), VAL("fec_max"), VAL("part_cnt") ) );
     172           0 : }
     173             : 
     174             : fd_topo_obj_callbacks_t fd_obj_cb_store = {
     175             :   .name      = "store",
     176             :   .footprint = store_footprint,
     177             :   .align     = store_align,
     178             :   .new       = store_new,
     179             : };
     180             : 
     181             : static ulong
     182             : txncache_footprint( fd_topo_t const *     topo,
     183           0 :                     fd_topo_obj_t const * obj ) {
     184           0 :   return fd_txncache_shmem_footprint( VAL("max_live_slots"), VAL("max_txn_per_slot") );
     185           0 : }
     186             : 
     187             : static ulong
     188             : txncache_align( fd_topo_t const *     topo FD_FN_UNUSED,
     189           0 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     190           0 :   return fd_txncache_shmem_align();
     191           0 : }
     192             : 
     193             : static void
     194             : txncache_new( fd_topo_t const *     topo,
     195           0 :               fd_topo_obj_t const * obj ) {
     196           0 :   FD_TEST( fd_txncache_shmem_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_live_slots"), VAL("max_txn_per_slot") ) );
     197           0 : }
     198             : 
     199             : fd_topo_obj_callbacks_t fd_obj_cb_txncache = {
     200             :   .name      = "txncache",
     201             :   .footprint = txncache_footprint,
     202             :   .align     = txncache_align,
     203             :   .new       = txncache_new,
     204             : };
     205             : 
     206             : static ulong
     207             : acc_pool_footprint( fd_topo_t const *     topo,
     208           0 :                     fd_topo_obj_t const * obj ) {
     209           0 :   return fd_acc_pool_footprint( VAL("max_account_cnt") );
     210           0 : }
     211             : 
     212             : static ulong
     213             : acc_pool_align( fd_topo_t const *     topo FD_FN_UNUSED,
     214           0 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     215           0 :   return fd_acc_pool_align();
     216           0 : }
     217             : 
     218             : static void
     219             : acc_pool_new( fd_topo_t const *     topo,
     220           0 :               fd_topo_obj_t const * obj ) {
     221           0 :   FD_TEST( fd_acc_pool_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_account_cnt") ) );
     222           0 : }
     223             : 
     224             : fd_topo_obj_callbacks_t fd_obj_cb_acc_pool = {
     225             :   .name      = "acc_pool",
     226             :   .footprint = acc_pool_footprint,
     227             :   .align     = acc_pool_align,
     228             :   .new       = acc_pool_new,
     229             : };
     230             : 
     231             : #undef VAL

Generated by: LCOV version 1.14