#pragma once #include #if defined(__CFA_NO_STATISTICS__) struct __stats_t; static inline void __init_stats( struct __stats_t * ) {} static inline void __tally_stats( struct __stats_t *, struct __stats_t * ) {} static inline void __print_stats( struct __stats_t * ) {} #else struct __attribute__((aligned(64))) __stats_readQ_t { struct { // Push statistic struct { // number of attemps at pushing something volatile uint64_t attempt; // number of attemps at pushing something something to preferred queues volatile uint64_t local; // number of successes at pushing volatile uint64_t success; } push; // Pop statistic struct { // number of reads of the mask // picking an empty __cfa_readyQ_mask_t counts here // but not as an attempt volatile uint64_t probe; // number of attemps at poping something volatile uint64_t attempt; // number of attemps at poping something from preferred queues volatile uint64_t local; // number of successes at poping volatile uint64_t success; } pop; } pick; struct { volatile uint64_t halts; volatile uint64_t cancels; volatile uint64_t wakes; volatile uint64_t exits; } sleep; }; #if defined(HAVE_LINUX_IO_URING_H) struct __attribute__((aligned(64))) __stats_io_t{ struct { struct { volatile uint64_t rdy; volatile uint64_t csm; volatile uint64_t avl; volatile uint64_t cnt; } submit_avg; struct { volatile uint64_t val; volatile uint64_t cnt; volatile uint64_t block; } look_avg; struct { volatile uint64_t val; volatile uint64_t cnt; volatile uint64_t block; } alloc_avg; } submit_q; struct { struct { volatile uint64_t val; volatile uint64_t slow_cnt; volatile uint64_t fast_cnt; } completed_avg; } complete_q; }; #endif struct __attribute__((aligned(128))) __stats_t { __stats_readQ_t ready; #if defined(HAVE_LINUX_IO_URING_H) __stats_io_t io; #endif }; void __init_stats ( struct __stats_t * ); void __tally_stats( struct __stats_t *, struct __stats_t * ); void __print_stats( struct __stats_t * ); #endif