[8834751] | 1 | #pragma once |
---|
| 2 | |
---|
| 3 | #include <stdint.h> |
---|
| 4 | |
---|
[b7664a0] | 5 | enum { |
---|
| 6 | CFA_STATS_READY_Q = 0x01, |
---|
| 7 | CFA_STATS_IO = 0x02, |
---|
| 8 | }; |
---|
| 9 | |
---|
[8834751] | 10 | #if defined(__CFA_NO_STATISTICS__) |
---|
| 11 | struct __stats_t; |
---|
| 12 | static inline void __init_stats( struct __stats_t * ) {} |
---|
| 13 | static inline void __tally_stats( struct __stats_t *, struct __stats_t * ) {} |
---|
[1b033b8] | 14 | static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {} |
---|
[8834751] | 15 | #else |
---|
[69fbc61] | 16 | |
---|
[8834751] | 17 | struct __attribute__((aligned(64))) __stats_readQ_t { |
---|
| 18 | struct { |
---|
| 19 | // Push statistic |
---|
| 20 | struct { |
---|
| 21 | // number of attemps at pushing something |
---|
| 22 | volatile uint64_t attempt; |
---|
| 23 | |
---|
| 24 | // number of successes at pushing |
---|
| 25 | volatile uint64_t success; |
---|
[52769ba] | 26 | |
---|
| 27 | // number of attemps at pushing something to preferred queues |
---|
| 28 | volatile uint64_t local; |
---|
| 29 | |
---|
| 30 | // number of successes at pushing to preferred queues |
---|
| 31 | volatile uint64_t lsuccess; |
---|
[8834751] | 32 | } push; |
---|
| 33 | |
---|
[fd1f65e] | 34 | struct { |
---|
| 35 | // number of attemps at pushing something |
---|
| 36 | volatile uint64_t attempt; |
---|
| 37 | |
---|
| 38 | // number of successes at pushing |
---|
| 39 | volatile uint64_t success; |
---|
| 40 | |
---|
| 41 | // number of attemps at pushing something to preferred queues |
---|
| 42 | volatile uint64_t local; |
---|
| 43 | |
---|
| 44 | // number of successes at pushing to preferred queues |
---|
| 45 | volatile uint64_t lsuccess; |
---|
| 46 | } ext; |
---|
| 47 | |
---|
[8834751] | 48 | // Pop statistic |
---|
| 49 | struct { |
---|
| 50 | // number of reads of the mask |
---|
| 51 | // picking an empty __cfa_readyQ_mask_t counts here |
---|
| 52 | // but not as an attempt |
---|
| 53 | volatile uint64_t probe; |
---|
| 54 | |
---|
| 55 | // number of attemps at poping something |
---|
| 56 | volatile uint64_t attempt; |
---|
| 57 | |
---|
| 58 | // number of successes at poping |
---|
| 59 | volatile uint64_t success; |
---|
[52769ba] | 60 | |
---|
| 61 | // number of attemps at poping something to preferred queues |
---|
| 62 | volatile uint64_t local; |
---|
| 63 | |
---|
| 64 | // number of successes at poping to preferred queues |
---|
| 65 | volatile uint64_t lsuccess; |
---|
[8834751] | 66 | } pop; |
---|
| 67 | } pick; |
---|
[29cb302] | 68 | struct { |
---|
| 69 | volatile uint64_t migration; |
---|
[ec43cf9] | 70 | volatile int64_t threads; // number of threads in the system, includes only local change |
---|
[29cb302] | 71 | } threads; |
---|
[68f36f4] | 72 | struct { |
---|
| 73 | volatile uint64_t halts; |
---|
| 74 | volatile uint64_t cancels; |
---|
| 75 | volatile uint64_t wakes; |
---|
| 76 | volatile uint64_t exits; |
---|
| 77 | } sleep; |
---|
[8834751] | 78 | }; |
---|
| 79 | |
---|
[5751a56] | 80 | #if defined(CFA_HAVE_LINUX_IO_URING_H) |
---|
[8834751] | 81 | struct __attribute__((aligned(64))) __stats_io_t{ |
---|
| 82 | struct { |
---|
[d60d30e] | 83 | volatile uint64_t fast; |
---|
| 84 | volatile uint64_t slow; |
---|
| 85 | volatile uint64_t fail; |
---|
| 86 | volatile uint64_t revoke; |
---|
| 87 | volatile uint64_t block; |
---|
| 88 | } alloc; |
---|
[8834751] | 89 | struct { |
---|
[d60d30e] | 90 | volatile uint64_t fast; |
---|
| 91 | volatile uint64_t slow; |
---|
| 92 | } submit; |
---|
| 93 | struct { |
---|
| 94 | volatile uint64_t external; |
---|
| 95 | } flush; |
---|
| 96 | struct { |
---|
[dddb3dd0] | 97 | volatile uint64_t drain; |
---|
[d60d30e] | 98 | volatile uint64_t completed; |
---|
[dddb3dd0] | 99 | volatile uint64_t flush; |
---|
| 100 | volatile uint64_t submitted; |
---|
[d60d30e] | 101 | struct { |
---|
| 102 | volatile uint64_t busy; |
---|
| 103 | } errors; |
---|
| 104 | } calls; |
---|
[150d21a] | 105 | struct { |
---|
| 106 | volatile uint64_t sleeps; |
---|
| 107 | } poller; |
---|
[8834751] | 108 | }; |
---|
| 109 | #endif |
---|
| 110 | |
---|
[37ba662] | 111 | struct __attribute__((aligned(128))) __stats_t { |
---|
[8834751] | 112 | __stats_readQ_t ready; |
---|
[5751a56] | 113 | #if defined(CFA_HAVE_LINUX_IO_URING_H) |
---|
[8834751] | 114 | __stats_io_t io; |
---|
| 115 | #endif |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | void __init_stats ( struct __stats_t * ); |
---|
| 119 | void __tally_stats( struct __stats_t *, struct __stats_t * ); |
---|
[1b033b8] | 120 | void __print_stats( struct __stats_t *, int, const char *, const char *, void * ); |
---|
[8834751] | 121 | #endif |
---|
| 122 | |
---|