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 *, int, bool, const char *, void * ) {}
|
---|
10 | #else
|
---|
11 | enum {
|
---|
12 | CFA_STATS_READY_Q = 0x01,
|
---|
13 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
14 | CFA_STATS_IO = 0x02,
|
---|
15 | #endif
|
---|
16 | };
|
---|
17 |
|
---|
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;
|
---|
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;
|
---|
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;
|
---|
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;
|
---|
53 | } pop;
|
---|
54 | } pick;
|
---|
55 | struct {
|
---|
56 | volatile uint64_t migration;
|
---|
57 | } threads;
|
---|
58 | struct {
|
---|
59 | volatile uint64_t halts;
|
---|
60 | volatile uint64_t cancels;
|
---|
61 | volatile uint64_t wakes;
|
---|
62 | volatile uint64_t exits;
|
---|
63 | } sleep;
|
---|
64 | };
|
---|
65 |
|
---|
66 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
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;
|
---|
85 | volatile uint64_t helped;
|
---|
86 | volatile uint64_t leader;
|
---|
87 | volatile uint64_t busy;
|
---|
88 | } submit_q;
|
---|
89 | struct {
|
---|
90 | struct {
|
---|
91 | volatile uint64_t val;
|
---|
92 | volatile uint64_t cnt;
|
---|
93 | } completed_avg;
|
---|
94 | volatile uint64_t blocks;
|
---|
95 | } complete_q;
|
---|
96 | };
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | struct __attribute__((aligned(128))) __stats_t {
|
---|
100 | __stats_readQ_t ready;
|
---|
101 | #if defined(CFA_HAVE_LINUX_IO_URING_H)
|
---|
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 * );
|
---|
108 | void __print_stats( struct __stats_t *, int, bool, const char *, void * );
|
---|
109 | #endif
|
---|
110 |
|
---|