| 1 | #pragma once | 
|---|
| 2 |  | 
|---|
| 3 | #include <stdint.h> | 
|---|
| 4 |  | 
|---|
| 5 | #if defined(__CFA_NO_STATISTICS__) | 
|---|
| 6 | struct __stats_t; | 
|---|
| 7 | static inline void __init_stats( struct __stats_t * ) {} | 
|---|
| 8 | static inline void __tally_stats( struct __stats_t *, struct __stats_t * ) {} | 
|---|
| 9 | static inline void __print_stats( struct __stats_t * ) {} | 
|---|
| 10 | #else | 
|---|
| 11 | struct __attribute__((aligned(64))) __stats_readQ_t { | 
|---|
| 12 | struct { | 
|---|
| 13 | // Push statistic | 
|---|
| 14 | struct { | 
|---|
| 15 | // number of attemps at pushing something | 
|---|
| 16 | volatile uint64_t attempt; | 
|---|
| 17 |  | 
|---|
| 18 | // number of successes at pushing | 
|---|
| 19 | volatile uint64_t success; | 
|---|
| 20 |  | 
|---|
| 21 | // number of attemps at pushing something to preferred queues | 
|---|
| 22 | volatile uint64_t local; | 
|---|
| 23 |  | 
|---|
| 24 | // number of successes at pushing to preferred queues | 
|---|
| 25 | volatile uint64_t lsuccess; | 
|---|
| 26 | } push; | 
|---|
| 27 |  | 
|---|
| 28 | // Pop statistic | 
|---|
| 29 | struct { | 
|---|
| 30 | // number of reads of the mask | 
|---|
| 31 | // picking an empty __cfa_readyQ_mask_t counts here | 
|---|
| 32 | // but not as an attempt | 
|---|
| 33 | volatile uint64_t probe; | 
|---|
| 34 |  | 
|---|
| 35 | // number of attemps at poping something | 
|---|
| 36 | volatile uint64_t attempt; | 
|---|
| 37 |  | 
|---|
| 38 | // number of successes at poping | 
|---|
| 39 | volatile uint64_t success; | 
|---|
| 40 |  | 
|---|
| 41 | // number of attemps at poping something to preferred queues | 
|---|
| 42 | volatile uint64_t local; | 
|---|
| 43 |  | 
|---|
| 44 | // number of successes at poping to preferred queues | 
|---|
| 45 | volatile uint64_t lsuccess; | 
|---|
| 46 | } pop; | 
|---|
| 47 | } pick; | 
|---|
| 48 | struct { | 
|---|
| 49 | volatile uint64_t halts; | 
|---|
| 50 | volatile uint64_t cancels; | 
|---|
| 51 | volatile uint64_t wakes; | 
|---|
| 52 | volatile uint64_t exits; | 
|---|
| 53 | } sleep; | 
|---|
| 54 | }; | 
|---|
| 55 |  | 
|---|
| 56 | #if defined(HAVE_LINUX_IO_URING_H) | 
|---|
| 57 | struct __attribute__((aligned(64))) __stats_io_t{ | 
|---|
| 58 | struct { | 
|---|
| 59 | struct { | 
|---|
| 60 | volatile uint64_t rdy; | 
|---|
| 61 | volatile uint64_t csm; | 
|---|
| 62 | volatile uint64_t avl; | 
|---|
| 63 | volatile uint64_t cnt; | 
|---|
| 64 | } submit_avg; | 
|---|
| 65 | struct { | 
|---|
| 66 | volatile uint64_t val; | 
|---|
| 67 | volatile uint64_t cnt; | 
|---|
| 68 | volatile uint64_t block; | 
|---|
| 69 | } look_avg; | 
|---|
| 70 | struct { | 
|---|
| 71 | volatile uint64_t val; | 
|---|
| 72 | volatile uint64_t cnt; | 
|---|
| 73 | volatile uint64_t block; | 
|---|
| 74 | } alloc_avg; | 
|---|
| 75 | } submit_q; | 
|---|
| 76 | struct { | 
|---|
| 77 | struct { | 
|---|
| 78 | volatile uint64_t val; | 
|---|
| 79 | volatile uint64_t slow_cnt; | 
|---|
| 80 | volatile uint64_t fast_cnt; | 
|---|
| 81 | } completed_avg; | 
|---|
| 82 | } complete_q; | 
|---|
| 83 | }; | 
|---|
| 84 | #endif | 
|---|
| 85 |  | 
|---|
| 86 | struct __attribute__((aligned(128))) __stats_t { | 
|---|
| 87 | __stats_readQ_t ready; | 
|---|
| 88 | #if defined(HAVE_LINUX_IO_URING_H) | 
|---|
| 89 | __stats_io_t    io; | 
|---|
| 90 | #endif | 
|---|
| 91 | }; | 
|---|
| 92 |  | 
|---|
| 93 | void __init_stats ( struct __stats_t * ); | 
|---|
| 94 | void __tally_stats( struct __stats_t *, struct __stats_t * ); | 
|---|
| 95 | void __print_stats( struct __stats_t * ); | 
|---|
| 96 | #endif | 
|---|
| 97 |  | 
|---|