#pragma once #include enum { CFA_STATS_READY_Q = 0x01, CFA_STATS_IO = 0x02, }; #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 *, int, const char *, const char *, void * ) {} #else struct __attribute__((aligned(64))) __stats_readQ_t { struct { // Push statistic struct { // number of attemps at pushing something volatile uint64_t attempt; // number of successes at pushing volatile uint64_t success; // number of attemps at pushing something to preferred queues volatile uint64_t local; // number of successes at pushing to preferred queues volatile uint64_t lsuccess; } push; struct { // number of attemps at pushing something volatile uint64_t attempt; // number of successes at pushing volatile uint64_t success; // number of attemps at pushing something to preferred queues volatile uint64_t local; // number of successes at pushing to preferred queues volatile uint64_t lsuccess; } ext; // 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 successes at poping volatile uint64_t success; // number of attemps at poping something to preferred queues volatile uint64_t local; // number of successes at poping to preferred queues volatile uint64_t lsuccess; } pop; } pick; struct { volatile uint64_t migration; } threads; struct { volatile uint64_t halts; volatile uint64_t cancels; volatile uint64_t wakes; volatile uint64_t exits; } sleep; }; #if defined(CFA_HAVE_LINUX_IO_URING_H) struct __attribute__((aligned(64))) __stats_io_t{ struct { volatile uint64_t fast; volatile uint64_t slow; volatile uint64_t fail; volatile uint64_t revoke; volatile uint64_t block; } alloc; struct { volatile uint64_t fast; volatile uint64_t slow; } submit; struct { volatile uint64_t external; } flush; struct { volatile uint64_t drain; volatile uint64_t completed; volatile uint64_t flush; volatile uint64_t submitted; struct { volatile uint64_t busy; } errors; } calls; struct { volatile uint64_t sleeps; } poller; }; #endif struct __attribute__((aligned(128))) __stats_t { __stats_readQ_t ready; #if defined(CFA_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 *, int, const char *, const char *, void * ); #endif