[8834751] | 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; |
---|
[52769ba] | 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; |
---|
[8834751] | 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; |
---|
[52769ba] | 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; |
---|
[8834751] | 46 | } pop; |
---|
| 47 | } pick; |
---|
[29cb302] | 48 | struct { |
---|
| 49 | volatile uint64_t migration; |
---|
| 50 | } threads; |
---|
[68f36f4] | 51 | struct { |
---|
| 52 | volatile uint64_t halts; |
---|
| 53 | volatile uint64_t cancels; |
---|
| 54 | volatile uint64_t wakes; |
---|
| 55 | volatile uint64_t exits; |
---|
| 56 | } sleep; |
---|
[8834751] | 57 | }; |
---|
| 58 | |
---|
| 59 | #if defined(HAVE_LINUX_IO_URING_H) |
---|
| 60 | struct __attribute__((aligned(64))) __stats_io_t{ |
---|
| 61 | struct { |
---|
| 62 | struct { |
---|
| 63 | volatile uint64_t rdy; |
---|
| 64 | volatile uint64_t csm; |
---|
| 65 | volatile uint64_t avl; |
---|
| 66 | volatile uint64_t cnt; |
---|
| 67 | } submit_avg; |
---|
| 68 | struct { |
---|
| 69 | volatile uint64_t val; |
---|
| 70 | volatile uint64_t cnt; |
---|
| 71 | volatile uint64_t block; |
---|
| 72 | } look_avg; |
---|
| 73 | struct { |
---|
| 74 | volatile uint64_t val; |
---|
| 75 | volatile uint64_t cnt; |
---|
| 76 | volatile uint64_t block; |
---|
| 77 | } alloc_avg; |
---|
| 78 | } submit_q; |
---|
| 79 | struct { |
---|
| 80 | struct { |
---|
[13c5e19] | 81 | volatile uint64_t val; |
---|
| 82 | volatile uint64_t slow_cnt; |
---|
| 83 | volatile uint64_t fast_cnt; |
---|
[8834751] | 84 | } completed_avg; |
---|
| 85 | } complete_q; |
---|
| 86 | }; |
---|
| 87 | #endif |
---|
| 88 | |
---|
[37ba662] | 89 | struct __attribute__((aligned(128))) __stats_t { |
---|
[8834751] | 90 | __stats_readQ_t ready; |
---|
| 91 | #if defined(HAVE_LINUX_IO_URING_H) |
---|
| 92 | __stats_io_t io; |
---|
| 93 | #endif |
---|
| 94 | }; |
---|
| 95 | |
---|
| 96 | void __init_stats ( struct __stats_t * ); |
---|
| 97 | void __tally_stats( struct __stats_t *, struct __stats_t * ); |
---|
| 98 | void __print_stats( struct __stats_t * ); |
---|
| 99 | #endif |
---|
| 100 | |
---|