[8834751] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | #include <stdint.h>
|
---|
| 4 |
|
---|
[b7664a03] | 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 |
|
---|
| 34 | // Pop statistic
|
---|
| 35 | struct {
|
---|
| 36 | // number of reads of the mask
|
---|
| 37 | // picking an empty __cfa_readyQ_mask_t counts here
|
---|
| 38 | // but not as an attempt
|
---|
| 39 | volatile uint64_t probe;
|
---|
| 40 |
|
---|
| 41 | // number of attemps at poping something
|
---|
| 42 | volatile uint64_t attempt;
|
---|
| 43 |
|
---|
| 44 | // number of successes at poping
|
---|
| 45 | volatile uint64_t success;
|
---|
[52769ba] | 46 |
|
---|
| 47 | // number of attemps at poping something to preferred queues
|
---|
| 48 | volatile uint64_t local;
|
---|
| 49 |
|
---|
| 50 | // number of successes at poping to preferred queues
|
---|
| 51 | volatile uint64_t lsuccess;
|
---|
[8834751] | 52 | } pop;
|
---|
| 53 | } pick;
|
---|
[29cb302] | 54 | struct {
|
---|
| 55 | volatile uint64_t migration;
|
---|
| 56 | } threads;
|
---|
[68f36f4] | 57 | struct {
|
---|
| 58 | volatile uint64_t halts;
|
---|
| 59 | volatile uint64_t cancels;
|
---|
| 60 | volatile uint64_t wakes;
|
---|
| 61 | volatile uint64_t exits;
|
---|
| 62 | } sleep;
|
---|
[8834751] | 63 | };
|
---|
| 64 |
|
---|
[5751a56] | 65 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
[8834751] | 66 | struct __attribute__((aligned(64))) __stats_io_t{
|
---|
| 67 | struct {
|
---|
| 68 | struct {
|
---|
| 69 | volatile uint64_t rdy;
|
---|
| 70 | volatile uint64_t csm;
|
---|
| 71 | volatile uint64_t avl;
|
---|
| 72 | volatile uint64_t cnt;
|
---|
| 73 | } submit_avg;
|
---|
| 74 | struct {
|
---|
| 75 | volatile uint64_t val;
|
---|
| 76 | volatile uint64_t cnt;
|
---|
| 77 | volatile uint64_t block;
|
---|
| 78 | } look_avg;
|
---|
| 79 | struct {
|
---|
| 80 | volatile uint64_t val;
|
---|
| 81 | volatile uint64_t cnt;
|
---|
| 82 | volatile uint64_t block;
|
---|
| 83 | } alloc_avg;
|
---|
[e46c753] | 84 | volatile uint64_t helped;
|
---|
| 85 | volatile uint64_t leader;
|
---|
[8bb239d] | 86 | volatile uint64_t busy;
|
---|
[8834751] | 87 | } submit_q;
|
---|
| 88 | struct {
|
---|
| 89 | struct {
|
---|
[13c5e19] | 90 | volatile uint64_t val;
|
---|
[dcb5f8d] | 91 | volatile uint64_t cnt;
|
---|
[8834751] | 92 | } completed_avg;
|
---|
[dcb5f8d] | 93 | volatile uint64_t blocks;
|
---|
[8834751] | 94 | } complete_q;
|
---|
| 95 | };
|
---|
| 96 | #endif
|
---|
| 97 |
|
---|
[37ba662] | 98 | struct __attribute__((aligned(128))) __stats_t {
|
---|
[8834751] | 99 | __stats_readQ_t ready;
|
---|
[5751a56] | 100 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
[8834751] | 101 | __stats_io_t io;
|
---|
| 102 | #endif
|
---|
| 103 | };
|
---|
| 104 |
|
---|
| 105 | void __init_stats ( struct __stats_t * );
|
---|
| 106 | void __tally_stats( struct __stats_t *, struct __stats_t * );
|
---|
[1b033b8] | 107 | void __print_stats( struct __stats_t *, int, const char *, const char *, void * );
|
---|
[8834751] | 108 | #endif
|
---|
| 109 |
|
---|