Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/stats.hfa

    rb7664a03 r3bd4293  
    11#pragma once
     2
     3// #define CFA_STATS_ARRAY 10000
    24
    35#include <stdint.h>
     
    1416        static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {}
    1517#else
     18        struct __stats_readyQ_pop_t {
     19                // number of attemps at poping something
     20                volatile uint64_t attempt;
    1621
    17         struct __attribute__((aligned(64))) __stats_readQ_t {
     22                // number of successes at poping
     23                volatile uint64_t success;
     24
     25                // number of attempts failed due to the lock being held
     26                volatile uint64_t elock;
     27
     28                // number of attempts failed due to the queue being empty (lock held)
     29                volatile uint64_t eempty;
     30
     31                // number of attempts failed due to the queue looking empty (lock not held)
     32                volatile uint64_t espec;
     33        };
     34
     35        struct __attribute__((aligned(64))) __stats_readyQ_t {
     36                // Push statistic
    1837                struct {
    19                         // Push statistic
    2038                        struct {
    21                                 // number of attemps at pushing something
     39                                // number of attemps at pushing something to preferred queues
    2240                                volatile uint64_t attempt;
    2341
    24                                 // number of successes at pushing
     42                                // number of successes at pushing to preferred queues
    2543                                volatile uint64_t success;
     44                        }
     45                        // Stats for local queue within cluster
     46                        local,
    2647
    27                                 // number of attemps at pushing something to preferred queues
    28                                 volatile uint64_t local;
     48                        // Stats for non-local queues within cluster
     49                        share,
    2950
    30                                 // number of successes at pushing to preferred queues
    31                                 volatile uint64_t lsuccess;
    32                         } push;
     51                        // Stats from outside cluster
     52                        extrn;
     53                } push;
    3354
    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;
     55                // Pop statistic
     56                struct {
     57                        // pop from local queue
     58                        __stats_readyQ_pop_t local;
    4059
    41                                 // number of attemps at poping something
    42                                 volatile uint64_t attempt;
     60                        // pop before looking at local queue
     61                        __stats_readyQ_pop_t help;
    4362
    44                                 // number of successes at poping
    45                                 volatile uint64_t success;
     63                        // pop from some other queue
     64                        __stats_readyQ_pop_t steal;
    4665
    47                                 // number of attemps at poping something to preferred queues
    48                                 volatile uint64_t local;
     66                        // pop when searching queues sequentially
     67                        __stats_readyQ_pop_t search;
     68                } pop;
    4969
    50                                 // number of successes at poping to preferred queues
    51                                 volatile uint64_t lsuccess;
    52                         } pop;
    53                 } pick;
    5470                struct {
    5571                        volatile uint64_t migration;
     72                        volatile uint64_t extunpark;
     73                        volatile  int64_t threads; // number of threads in the system, includes only local change
    5674                } threads;
    5775                struct {
     
    6684                struct __attribute__((aligned(64))) __stats_io_t{
    6785                        struct {
     86                                volatile uint64_t fast;
     87                                volatile uint64_t slow;
     88                                volatile uint64_t fail;
     89                                volatile uint64_t revoke;
     90                                volatile uint64_t block;
     91                        } alloc;
     92                        struct {
     93                                volatile uint64_t fast;
     94                                volatile uint64_t slow;
     95                        } submit;
     96                        struct {
     97                                volatile uint64_t external;
     98                        } flush;
     99                        struct {
     100                                volatile uint64_t drain;
     101                                volatile uint64_t completed;
     102                                volatile uint64_t flush;
     103                                volatile uint64_t submitted;
    68104                                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;
    84                                 volatile uint64_t helped;
    85                                 volatile uint64_t leader;
    86                                 volatile uint64_t busy;
    87                         } submit_q;
     105                                        volatile uint64_t busy;
     106                                } errors;
     107                        } calls;
    88108                        struct {
    89                                 struct {
    90                                         volatile uint64_t val;
    91                                         volatile uint64_t cnt;
    92                                 } completed_avg;
    93                                 volatile uint64_t blocks;
    94                         } complete_q;
     109                                volatile uint64_t sleeps;
     110                        } poller;
     111                };
     112        #endif
     113
     114        #if defined(CFA_STATS_ARRAY)
     115                struct __stats_elem_t {
     116                        long long int ts;
     117                        int64_t value;
    95118                };
    96119        #endif
    97120
    98121        struct __attribute__((aligned(128))) __stats_t {
    99                 __stats_readQ_t ready;
     122                __stats_readyQ_t ready;
    100123                #if defined(CFA_HAVE_LINUX_IO_URING_H)
    101124                        __stats_io_t    io;
    102125                #endif
     126
     127                #if defined(CFA_STATS_ARRAY)
     128                        struct {
     129                                __stats_elem_t * values;
     130                                volatile size_t cnt;
     131                        } array;
     132                #endif
     133
    103134        };
    104135
     
    106137        void __tally_stats( struct __stats_t *, struct __stats_t * );
    107138        void __print_stats( struct __stats_t *, int, const char *, const char *, void * );
     139        #if defined(CFA_STATS_ARRAY)
     140                void __push_stat ( struct __stats_t *, int64_t value, bool external, const char * name, void * handle);
     141                void __flush_stat( struct __stats_t *, const char *, void * );
     142        #else
     143                static inline void __push_stat ( struct __stats_t *, int64_t, bool, const char *, void * ) {}
     144                static inline void __flush_stat( struct __stats_t *, const char *, void * ) {}
     145        #endif
    108146#endif
    109147
Note: See TracChangeset for help on using the changeset viewer.