Ignore:
File:
1 edited

Legend:

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

    r78ea291 rbbbd2c4  
    1919                stats->ready.pop.local .attempt = 0;
    2020                stats->ready.pop.local .success = 0;
     21                stats->ready.pop.local .elock   = 0;
     22                stats->ready.pop.local .eempty  = 0;
     23                stats->ready.pop.local .espec   = 0;
    2124                stats->ready.pop.help  .attempt = 0;
    2225                stats->ready.pop.help  .success = 0;
     26                stats->ready.pop.help  .elock   = 0;
     27                stats->ready.pop.help  .eempty  = 0;
     28                stats->ready.pop.help  .espec   = 0;
    2329                stats->ready.pop.steal .attempt = 0;
    2430                stats->ready.pop.steal .success = 0;
     31                stats->ready.pop.steal .elock   = 0;
     32                stats->ready.pop.steal .eempty  = 0;
     33                stats->ready.pop.steal .espec   = 0;
    2534                stats->ready.pop.search.attempt = 0;
    2635                stats->ready.pop.search.success = 0;
     36                stats->ready.pop.search.elock   = 0;
     37                stats->ready.pop.search.eempty  = 0;
     38                stats->ready.pop.search.espec   = 0;
    2739                stats->ready.threads.migration = 0;
    28                 stats->ready.threads.extunpark = 0;
    2940                stats->ready.threads.threads   = 0;
    30                 stats->ready.threads.cthreads  = 0;
    3141                stats->ready.sleep.halts   = 0;
    3242                stats->ready.sleep.cancels = 0;
     
    4858                        stats->io.calls.completed   = 0;
    4959                        stats->io.calls.errors.busy = 0;
     60                        stats->io.poller.sleeps     = 0;
    5061                #endif
    5162
     
    5667        }
    5768
    58         static inline void tally_one( volatile uint64_t * agg, volatile uint64_t * val) {
    59                 uint64_t add = __atomic_exchange_n(val, 0_l64u, __ATOMIC_RELAXED);
    60                 __atomic_fetch_add(agg, add, __ATOMIC_RELAXED);
    61         }
    62 
    63         static inline void tally_one( volatile int64_t * agg, volatile int64_t * val) {
    64                 int64_t add = __atomic_exchange_n(val, 0_l64, __ATOMIC_RELAXED);
    65                 __atomic_fetch_add(agg, add, __ATOMIC_RELAXED);
    66         }
    67 
    6869        void __tally_stats( struct __stats_t * cltr, struct __stats_t * proc ) {
    69                 tally_one( &cltr->ready.push.local.attempt, &proc->ready.push.local.attempt );
    70                 tally_one( &cltr->ready.push.local.success, &proc->ready.push.local.success );
    71                 tally_one( &cltr->ready.push.share.attempt, &proc->ready.push.share.attempt );
    72                 tally_one( &cltr->ready.push.share.success, &proc->ready.push.share.success );
    73                 tally_one( &cltr->ready.push.extrn.attempt, &proc->ready.push.extrn.attempt );
    74                 tally_one( &cltr->ready.push.extrn.success, &proc->ready.push.extrn.success );
    75                 tally_one( &cltr->ready.pop.local .attempt, &proc->ready.pop.local .attempt );
    76                 tally_one( &cltr->ready.pop.local .success, &proc->ready.pop.local .success );
    77                 tally_one( &cltr->ready.pop.help  .attempt, &proc->ready.pop.help  .attempt );
    78                 tally_one( &cltr->ready.pop.help  .success, &proc->ready.pop.help  .success );
    79                 tally_one( &cltr->ready.pop.steal .attempt, &proc->ready.pop.steal .attempt );
    80                 tally_one( &cltr->ready.pop.steal .success, &proc->ready.pop.steal .success );
    81                 tally_one( &cltr->ready.pop.search.attempt, &proc->ready.pop.search.attempt );
    82                 tally_one( &cltr->ready.pop.search.success, &proc->ready.pop.search.success );
    83                 tally_one( &cltr->ready.threads.migration , &proc->ready.threads.migration  );
    84                 tally_one( &cltr->ready.threads.extunpark , &proc->ready.threads.extunpark  );
    85                 tally_one( &cltr->ready.threads.threads   , &proc->ready.threads.threads    );
    86                 tally_one( &cltr->ready.threads.cthreads  , &proc->ready.threads.cthreads   );
    87                 tally_one( &cltr->ready.sleep.halts       , &proc->ready.sleep.halts        );
    88                 tally_one( &cltr->ready.sleep.cancels     , &proc->ready.sleep.cancels      );
    89                 tally_one( &cltr->ready.sleep.wakes       , &proc->ready.sleep.wakes        );
    90                 tally_one( &cltr->ready.sleep.exits       , &proc->ready.sleep.exits        );
     70                __atomic_fetch_add( &cltr->ready.push.local.attempt, proc->ready.push.local.attempt, __ATOMIC_SEQ_CST ); proc->ready.push.local.attempt = 0;
     71                __atomic_fetch_add( &cltr->ready.push.local.success, proc->ready.push.local.success, __ATOMIC_SEQ_CST ); proc->ready.push.local.success = 0;
     72                __atomic_fetch_add( &cltr->ready.push.share.attempt, proc->ready.push.share.attempt, __ATOMIC_SEQ_CST ); proc->ready.push.share.attempt = 0;
     73                __atomic_fetch_add( &cltr->ready.push.share.success, proc->ready.push.share.success, __ATOMIC_SEQ_CST ); proc->ready.push.share.success = 0;
     74                __atomic_fetch_add( &cltr->ready.push.extrn.attempt, proc->ready.push.extrn.attempt, __ATOMIC_SEQ_CST ); proc->ready.push.extrn.attempt = 0;
     75                __atomic_fetch_add( &cltr->ready.push.extrn.success, proc->ready.push.extrn.success, __ATOMIC_SEQ_CST ); proc->ready.push.extrn.success = 0;
     76                __atomic_fetch_add( &cltr->ready.pop.local .attempt, proc->ready.pop.local .attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.local .attempt = 0;
     77                __atomic_fetch_add( &cltr->ready.pop.local .success, proc->ready.pop.local .success, __ATOMIC_SEQ_CST ); proc->ready.pop.local .success = 0;
     78                __atomic_fetch_add( &cltr->ready.pop.local .elock  , proc->ready.pop.local .elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.local .elock   = 0;
     79                __atomic_fetch_add( &cltr->ready.pop.local .eempty , proc->ready.pop.local .eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.local .eempty  = 0;
     80                __atomic_fetch_add( &cltr->ready.pop.local .espec  , proc->ready.pop.local .espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.local .espec   = 0;
     81                __atomic_fetch_add( &cltr->ready.pop.help  .attempt, proc->ready.pop.help  .attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.help  .attempt = 0;
     82                __atomic_fetch_add( &cltr->ready.pop.help  .success, proc->ready.pop.help  .success, __ATOMIC_SEQ_CST ); proc->ready.pop.help  .success = 0;
     83                __atomic_fetch_add( &cltr->ready.pop.help  .elock  , proc->ready.pop.help  .elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.help  .elock   = 0;
     84                __atomic_fetch_add( &cltr->ready.pop.help  .eempty , proc->ready.pop.help  .eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.help  .eempty  = 0;
     85                __atomic_fetch_add( &cltr->ready.pop.help  .espec  , proc->ready.pop.help  .espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.help  .espec   = 0;
     86                __atomic_fetch_add( &cltr->ready.pop.steal .attempt, proc->ready.pop.steal .attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.steal .attempt = 0;
     87                __atomic_fetch_add( &cltr->ready.pop.steal .success, proc->ready.pop.steal .success, __ATOMIC_SEQ_CST ); proc->ready.pop.steal .success = 0;
     88                __atomic_fetch_add( &cltr->ready.pop.steal .elock  , proc->ready.pop.steal .elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.steal .elock   = 0;
     89                __atomic_fetch_add( &cltr->ready.pop.steal .eempty , proc->ready.pop.steal .eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.steal .eempty  = 0;
     90                __atomic_fetch_add( &cltr->ready.pop.steal .espec  , proc->ready.pop.steal .espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.steal .espec   = 0;
     91                __atomic_fetch_add( &cltr->ready.pop.search.attempt, proc->ready.pop.search.attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.search.attempt = 0;
     92                __atomic_fetch_add( &cltr->ready.pop.search.success, proc->ready.pop.search.success, __ATOMIC_SEQ_CST ); proc->ready.pop.search.success = 0;
     93                __atomic_fetch_add( &cltr->ready.pop.search.elock  , proc->ready.pop.search.elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.search.elock   = 0;
     94                __atomic_fetch_add( &cltr->ready.pop.search.eempty , proc->ready.pop.search.eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.search.eempty  = 0;
     95                __atomic_fetch_add( &cltr->ready.pop.search.espec  , proc->ready.pop.search.espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.search.espec   = 0;
     96                __atomic_fetch_add( &cltr->ready.threads.migration , proc->ready.threads.migration , __ATOMIC_SEQ_CST ); proc->ready.threads.migration  = 0;
     97                __atomic_fetch_add( &cltr->ready.threads.threads   , proc->ready.threads.threads   , __ATOMIC_SEQ_CST ); proc->ready.threads.threads    = 0;
     98                __atomic_fetch_add( &cltr->ready.sleep.halts       , proc->ready.sleep.halts       , __ATOMIC_SEQ_CST ); proc->ready.sleep.halts        = 0;
     99                __atomic_fetch_add( &cltr->ready.sleep.cancels     , proc->ready.sleep.cancels     , __ATOMIC_SEQ_CST ); proc->ready.sleep.cancels      = 0;
     100                __atomic_fetch_add( &cltr->ready.sleep.wakes       , proc->ready.sleep.wakes       , __ATOMIC_SEQ_CST ); proc->ready.sleep.wakes        = 0;
     101                __atomic_fetch_add( &cltr->ready.sleep.exits       , proc->ready.sleep.exits       , __ATOMIC_SEQ_CST ); proc->ready.sleep.exits        = 0;
    91102
    92103                #if defined(CFA_HAVE_LINUX_IO_URING_H)
    93                         tally_one( &cltr->io.alloc.fast       , &proc->io.alloc.fast        );
    94                         tally_one( &cltr->io.alloc.slow       , &proc->io.alloc.slow        );
    95                         tally_one( &cltr->io.alloc.fail       , &proc->io.alloc.fail        );
    96                         tally_one( &cltr->io.alloc.revoke     , &proc->io.alloc.revoke      );
    97                         tally_one( &cltr->io.alloc.block      , &proc->io.alloc.block       );
    98                         tally_one( &cltr->io.submit.fast      , &proc->io.submit.fast       );
    99                         tally_one( &cltr->io.submit.slow      , &proc->io.submit.slow       );
    100                         tally_one( &cltr->io.flush.external   , &proc->io.flush.external    );
    101                         tally_one( &cltr->io.calls.flush      , &proc->io.calls.flush       );
    102                         tally_one( &cltr->io.calls.submitted  , &proc->io.calls.submitted   );
    103                         tally_one( &cltr->io.calls.drain      , &proc->io.calls.drain       );
    104                         tally_one( &cltr->io.calls.completed  , &proc->io.calls.completed   );
    105                         tally_one( &cltr->io.calls.errors.busy, &proc->io.calls.errors.busy );
     104                        __atomic_fetch_add( &cltr->io.alloc.fast       , proc->io.alloc.fast       , __ATOMIC_SEQ_CST ); proc->io.alloc.fast        = 0;
     105                        __atomic_fetch_add( &cltr->io.alloc.slow       , proc->io.alloc.slow       , __ATOMIC_SEQ_CST ); proc->io.alloc.slow        = 0;
     106                        __atomic_fetch_add( &cltr->io.alloc.fail       , proc->io.alloc.fail       , __ATOMIC_SEQ_CST ); proc->io.alloc.fail        = 0;
     107                        __atomic_fetch_add( &cltr->io.alloc.revoke     , proc->io.alloc.revoke     , __ATOMIC_SEQ_CST ); proc->io.alloc.revoke      = 0;
     108                        __atomic_fetch_add( &cltr->io.alloc.block      , proc->io.alloc.block      , __ATOMIC_SEQ_CST ); proc->io.alloc.block       = 0;
     109                        __atomic_fetch_add( &cltr->io.submit.fast      , proc->io.submit.fast      , __ATOMIC_SEQ_CST ); proc->io.submit.fast       = 0;
     110                        __atomic_fetch_add( &cltr->io.submit.slow      , proc->io.submit.slow      , __ATOMIC_SEQ_CST ); proc->io.submit.slow       = 0;
     111                        __atomic_fetch_add( &cltr->io.flush.external   , proc->io.flush.external   , __ATOMIC_SEQ_CST ); proc->io.flush.external    = 0;
     112                        __atomic_fetch_add( &cltr->io.calls.flush      , proc->io.calls.flush      , __ATOMIC_SEQ_CST ); proc->io.calls.flush       = 0;
     113                        __atomic_fetch_add( &cltr->io.calls.submitted  , proc->io.calls.submitted  , __ATOMIC_SEQ_CST ); proc->io.calls.submitted   = 0;
     114                        __atomic_fetch_add( &cltr->io.calls.drain      , proc->io.calls.drain      , __ATOMIC_SEQ_CST ); proc->io.calls.drain       = 0;
     115                        __atomic_fetch_add( &cltr->io.calls.completed  , proc->io.calls.completed  , __ATOMIC_SEQ_CST ); proc->io.calls.completed   = 0;
     116                        __atomic_fetch_add( &cltr->io.calls.errors.busy, proc->io.calls.errors.busy, __ATOMIC_SEQ_CST ); proc->io.calls.errors.busy = 0;
     117                        __atomic_fetch_add( &cltr->io.poller.sleeps    , proc->io.poller.sleeps    , __ATOMIC_SEQ_CST ); proc->io.poller.sleeps     = 0;
    106118                #endif
    107119        }
     
    116128                if( flags & CFA_STATS_READY_Q ) {
    117129
    118                         sstr | "----- " | type | " \"" | name | "\" (" | "" | id | "" | ") - Ready Q Stats -----";
     130                        sstr | "----- " | type | "\"" | name | "\" (" | "" | id | "" | ") - Ready Q Stats -----";
    119131
    120132                        uint64_t totalR = ready.pop.local.success + ready.pop.help.success + ready.pop.steal.success + ready.pop.search.success;
    121133                        uint64_t totalS = ready.push.local.success + ready.push.share.success + ready.push.extrn.success;
    122                         sstr | "- totals   : " | eng3(totalR) | "run," | eng3(totalS) | "schd (" | eng3(ready.push.extrn.success) | "ext,"
    123                              | eng3(ready.threads.migration) | "mig," | eng3(ready.threads.extunpark) | " eupk," | ready.threads.threads | " t," | ready.threads.cthreads | " cthr)";
     134                        sstr | "- totals   : " | eng3(totalR) | "run," | eng3(totalS) | "schd (" | eng3(ready.push.extrn.success) | "ext," | eng3(ready.threads.migration) | "mig)";
    124135
    125136                        double push_len = ((double)ready.push.local.attempt + ready.push.share.attempt + ready.push.extrn.attempt) / totalS;
     
    134145                        double rLcl_pc = (100.0 * (double)ready.pop.local .success) / totalR;
    135146                        sstr | "- local    : " | eng3(ready.pop.local .success) | "-"| ws(3, 3, rLcl_pc) | '%'
    136                              | " (" | eng3(ready.pop.local .attempt) | " try)";
     147                             | " (" | eng3(ready.pop.local .attempt) | " try," | eng3(ready.pop.local .espec) | " spc," | eng3(ready.pop.local .elock) | " lck," | eng3(ready.pop.local .eempty) | " ept)";
    137148                        double rHlp_pc = (100.0 * (double)ready.pop.help  .success) / totalR;
    138149                        sstr | "- help     : " | eng3(ready.pop.help  .success) | "-"| ws(3, 3, rHlp_pc) | '%'
    139                              | " (" | eng3(ready.pop.help  .attempt) | " try)";
     150                             | " (" | eng3(ready.pop.help  .attempt) | " try," | eng3(ready.pop.help  .espec) | " spc," | eng3(ready.pop.help  .elock) | " lck," | eng3(ready.pop.help  .eempty) | " ept)";
    140151                        double rStl_pc = (100.0 * (double)ready.pop.steal .success) / totalR;
    141152                        sstr | "- steal    : " | eng3(ready.pop.steal .success) | "-"| ws(3, 3, rStl_pc) | '%'
    142                              | " (" | eng3(ready.pop.steal .attempt) | " try)";
     153                             | " (" | eng3(ready.pop.steal .attempt) | " try," | eng3(ready.pop.steal .espec) | " spc," | eng3(ready.pop.steal .elock) | " lck," | eng3(ready.pop.steal .eempty) | " ept)";
    143154                        double rSch_pc = (100.0 * (double)ready.pop.search.success) / totalR;
    144155                        sstr | "- search   : " | eng3(ready.pop.search.success) | "-"| ws(3, 3, rSch_pc) | '%'
    145                              | " (" | eng3(ready.pop.search.attempt) | " try)";
     156                             | " (" | eng3(ready.pop.search.attempt) | " try," | eng3(ready.pop.search.espec) | " spc," | eng3(ready.pop.search.elock) | " lck," | eng3(ready.pop.search.eempty) | " ept)";
    146157
    147158                        sstr | "- Idle Slp : " | eng3(ready.sleep.halts) | "halt," | eng3(ready.sleep.cancels) | "cancel," | eng3(ready.sleep.wakes) | "wake," | eng3(ready.sleep.exits) | "exit";
     
    151162                #if defined(CFA_HAVE_LINUX_IO_URING_H)
    152163                        if( flags & CFA_STATS_IO ) {
    153                                 sstr | "----- " | type | " \"" | name | "\" (" | "" | id | "" | ") - I/O Stats -----";
     164                                sstr | "----- " | type | "\"" | name | "\" (" | "" | id | "" | ") - I/O Stats -----";
    154165
    155166                                uint64_t total_allocs = io.alloc.fast + io.alloc.slow;
     167                                double avgfasta = (100.0 * (double)io.alloc.fast) / total_allocs;
     168                                sstr | "- total allocations : " | eng3(io.alloc.fast) | "fast," | eng3(io.alloc.slow) | "slow (" | ws(3, 3, avgfasta) | "%)";
     169                                sstr | "-     failures      : " | eng3(io.alloc.fail) | "oom, " | eng3(io.alloc.revoke) | "rvk, " | eng3(io.alloc.block) | "blk";
    156170
    157171                                uint64_t total_submits = io.submit.fast + io.submit.slow;
    158                                 sstr | "- totals : allc" | eng3(io.alloc .fast) | nonl;
    159                                 if(io.alloc.slow) {
    160                                         double avgfasta = (100.0 * (double)io.alloc.fast) / total_allocs;
    161                                         sstr | "fast," | eng3(io.alloc .slow) | "slow (" | ws(3, 3, avgfasta) | "%)" | nonl;
    162                                 }
    163                                 sstr | " - subm" | eng3(io.submit.fast) | nonl;
    164                                 if(io.alloc.slow) {
    165                                         double avgfasts = (100.0 * (double)io.submit.fast) / total_submits;
    166                                         sstr | "fast," | eng3(io.submit.slow) | "slow (" | ws(3, 3, avgfasts) | "%)" | nonl;
    167                                 }
    168                                 sstr | nl;
    169 
    170                                 if(io.alloc.fail || io.alloc.revoke || io.alloc.block)
    171                                         sstr | "-     failures      : " | eng3(io.alloc.fail) | "oom, " | eng3(io.alloc.revoke) | "rvk, " | eng3(io.alloc.block) | "blk";
    172                                 if(io.flush.external)
    173                                         sstr | "- flush external    : " | eng3(io.flush.external);
     172                                double avgfasts = (100.0 * (double)io.submit.fast) / total_submits;
     173                                sstr | "- total submits     : " | eng3(io.submit.fast) | "fast," | eng3(io.submit.slow) | "slow (" | ws(3, 3, avgfasts) | "%)";
     174                                sstr | "- flush external    : " | eng3(io.flush.external);
     175
     176                                sstr | "- io_uring_enter    : " | eng3(io.calls.flush) | " (" | eng3(io.calls.drain) | ", " | eng3(io.calls.errors.busy) | " EBUSY)";
    174177
    175178                                double avgsubs = ((double)io.calls.submitted) / io.calls.flush;
    176179                                double avgcomp = ((double)io.calls.completed) / io.calls.drain;
    177                                 sstr | "- syscll : "
    178                                      |   " sub " | eng3(io.calls.flush) | "/" | eng3(io.calls.submitted) | "(" | ws(3, 3, avgsubs) | "/flush)"
    179                                      | " - cmp " | eng3(io.calls.drain) | "/" | eng3(io.calls.completed) | "(" | ws(3, 3, avgcomp) | "/drain)"
    180                                      | " - " | eng3(io.calls.errors.busy) | " EBUSY";
     180                                sstr | "-     submits       : " | eng3(io.calls.submitted) | "(" | ws(3, 3, avgsubs) | "/flush)";
     181                                sstr | "-     completes     : " | eng3(io.calls.completed) | "(" | ws(3, 3, avgcomp) | "/drain)";
     182
     183                                sstr | "- poller sleeping   : " | eng3(io.poller.sleeps);
    181184                                sstr | nl;
    182185                        }
Note: See TracChangeset for help on using the changeset viewer.