[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 * ) {}
|
---|
[69fbc61] | 9 | static inline void __print_stats( struct __stats_t *, int, bool, const char *, void * ) {}
|
---|
[8834751] | 10 | #else
|
---|
[69fbc61] | 11 | enum {
|
---|
| 12 | CFA_STATS_READY_Q = 0x01,
|
---|
[5751a56] | 13 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
[69fbc61] | 14 | CFA_STATS_IO = 0x02,
|
---|
| 15 | #endif
|
---|
| 16 | };
|
---|
| 17 |
|
---|
[8834751] | 18 | struct __attribute__((aligned(64))) __stats_readQ_t {
|
---|
| 19 | struct {
|
---|
| 20 | // Push statistic
|
---|
| 21 | struct {
|
---|
| 22 | // number of attemps at pushing something
|
---|
| 23 | volatile uint64_t attempt;
|
---|
| 24 |
|
---|
| 25 | // number of successes at pushing
|
---|
| 26 | volatile uint64_t success;
|
---|
[52769ba] | 27 |
|
---|
| 28 | // number of attemps at pushing something to preferred queues
|
---|
| 29 | volatile uint64_t local;
|
---|
| 30 |
|
---|
| 31 | // number of successes at pushing to preferred queues
|
---|
| 32 | volatile uint64_t lsuccess;
|
---|
[8834751] | 33 | } push;
|
---|
| 34 |
|
---|
| 35 | // Pop statistic
|
---|
| 36 | struct {
|
---|
| 37 | // number of reads of the mask
|
---|
| 38 | // picking an empty __cfa_readyQ_mask_t counts here
|
---|
| 39 | // but not as an attempt
|
---|
| 40 | volatile uint64_t probe;
|
---|
| 41 |
|
---|
| 42 | // number of attemps at poping something
|
---|
| 43 | volatile uint64_t attempt;
|
---|
| 44 |
|
---|
| 45 | // number of successes at poping
|
---|
| 46 | volatile uint64_t success;
|
---|
[52769ba] | 47 |
|
---|
| 48 | // number of attemps at poping something to preferred queues
|
---|
| 49 | volatile uint64_t local;
|
---|
| 50 |
|
---|
| 51 | // number of successes at poping to preferred queues
|
---|
| 52 | volatile uint64_t lsuccess;
|
---|
[8834751] | 53 | } pop;
|
---|
| 54 | } pick;
|
---|
[29cb302] | 55 | struct {
|
---|
| 56 | volatile uint64_t migration;
|
---|
| 57 | } threads;
|
---|
[68f36f4] | 58 | struct {
|
---|
| 59 | volatile uint64_t halts;
|
---|
| 60 | volatile uint64_t cancels;
|
---|
| 61 | volatile uint64_t wakes;
|
---|
| 62 | volatile uint64_t exits;
|
---|
| 63 | } sleep;
|
---|
[8834751] | 64 | };
|
---|
| 65 |
|
---|
[5751a56] | 66 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
[8834751] | 67 | struct __attribute__((aligned(64))) __stats_io_t{
|
---|
| 68 | struct {
|
---|
| 69 | struct {
|
---|
| 70 | volatile uint64_t rdy;
|
---|
| 71 | volatile uint64_t csm;
|
---|
| 72 | volatile uint64_t avl;
|
---|
| 73 | volatile uint64_t cnt;
|
---|
| 74 | } submit_avg;
|
---|
| 75 | struct {
|
---|
| 76 | volatile uint64_t val;
|
---|
| 77 | volatile uint64_t cnt;
|
---|
| 78 | volatile uint64_t block;
|
---|
| 79 | } look_avg;
|
---|
| 80 | struct {
|
---|
| 81 | volatile uint64_t val;
|
---|
| 82 | volatile uint64_t cnt;
|
---|
| 83 | volatile uint64_t block;
|
---|
| 84 | } alloc_avg;
|
---|
[e46c753] | 85 | volatile uint64_t helped;
|
---|
| 86 | volatile uint64_t leader;
|
---|
[8bb239d] | 87 | volatile uint64_t busy;
|
---|
[8834751] | 88 | } submit_q;
|
---|
| 89 | struct {
|
---|
| 90 | struct {
|
---|
[13c5e19] | 91 | volatile uint64_t val;
|
---|
[dcb5f8d] | 92 | volatile uint64_t cnt;
|
---|
[8834751] | 93 | } completed_avg;
|
---|
[dcb5f8d] | 94 | volatile uint64_t blocks;
|
---|
[8834751] | 95 | } complete_q;
|
---|
| 96 | };
|
---|
| 97 | #endif
|
---|
| 98 |
|
---|
[37ba662] | 99 | struct __attribute__((aligned(128))) __stats_t {
|
---|
[8834751] | 100 | __stats_readQ_t ready;
|
---|
[5751a56] | 101 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
[8834751] | 102 | __stats_io_t io;
|
---|
| 103 | #endif
|
---|
| 104 | };
|
---|
| 105 |
|
---|
| 106 | void __init_stats ( struct __stats_t * );
|
---|
| 107 | void __tally_stats( struct __stats_t *, struct __stats_t * );
|
---|
[69fbc61] | 108 | void __print_stats( struct __stats_t *, int, bool, const char *, void * );
|
---|
[8834751] | 109 | #endif
|
---|
| 110 |
|
---|