Changeset d2fadeb


Ignore:
Timestamp:
Apr 19, 2021, 5:07:16 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
59f3f61, 665edf40, ddd473f
Parents:
4aa495f
Message:

Changed stats to make sense with relaxed fifo and work stealing

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

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

    r4aa495f rd2fadeb  
    3535static const size_t cache_line_size = 64;
    3636
     37#if !defined(__CFA_NO_STATISTICS__)
     38        #define __STATS(...) __VA_ARGS__
     39#else
     40        #define __STATS(...)
     41#endif
     42
    3743// No overriden function, no environment variable, no define
    3844// fall back to a magic number
     
    5258#endif
    5359
     60static inline struct $thread * try_pop(struct cluster * cltr, unsigned w __STATS(, __stats_readyQ_pop_t & stats));
     61static inline struct $thread * try_pop(struct cluster * cltr, unsigned i, unsigned j __STATS(, __stats_readyQ_pop_t & stats));
     62static inline struct $thread * search(struct cluster * cltr);
    5463static inline [unsigned, bool] idx_from_r(unsigned r, unsigned preferred);
    55 static inline struct $thread * try_pop(struct cluster * cltr, unsigned w);
    56 static inline struct $thread * try_pop(struct cluster * cltr, unsigned i, unsigned j);
    57 static inline struct $thread * search(struct cluster * cltr);
    5864
    5965
     
    269275
    270276                        #if !defined(__CFA_NO_STATISTICS__)
    271                                 if(external) {
    272                                         if(local) __atomic_fetch_add(&cltr->stats->ready.pick.ext.local, 1, __ATOMIC_RELAXED);
    273                                         __atomic_fetch_add(&cltr->stats->ready.pick.ext.attempt, 1, __ATOMIC_RELAXED);
    274                                 }
    275                                 else {
    276                                         if(local) __tls_stats()->ready.pick.push.local++;
    277                                         __tls_stats()->ready.pick.push.attempt++;
    278                                 }
     277                                if(unlikely(external)) __atomic_fetch_add(&cltr->stats->ready.push.extrn.attempt, 1, __ATOMIC_RELAXED);
     278                                else if(local) __tls_stats()->ready.push.local.attempt++;
     279                                else __tls_stats()->ready.push.share.attempt++;
    279280                        #endif
    280281
     
    302303                // Update statistics
    303304                #if !defined(__CFA_NO_STATISTICS__)
    304                         if(external) {
    305                                 if(local) __atomic_fetch_add(&cltr->stats->ready.pick.ext.lsuccess, 1, __ATOMIC_RELAXED);
    306                                 __atomic_fetch_add(&cltr->stats->ready.pick.ext.success, 1, __ATOMIC_RELAXED);
    307                         }
    308                         else {
    309                                 if(local) __tls_stats()->ready.pick.push.lsuccess++;
    310                                 __tls_stats()->ready.pick.push.success++;
    311                         }
     305                        if(unlikely(external)) __atomic_fetch_add(&cltr->stats->ready.push.extrn.success, 1, __ATOMIC_RELAXED);
     306                        else if(local) __tls_stats()->ready.push.local.success++;
     307                        else __tls_stats()->ready.push.share.success++;
    312308                #endif
    313309        }
     
    334330                        [j, localj] = idx_from_r(rj, preferred);
    335331
    336                         #if !defined(__CFA_NO_STATISTICS__)
    337                                 if(locali && localj) {
    338                                         __tls_stats()->ready.pick.pop.local++;
    339                                 }
    340                         #endif
    341 
    342332                        i %= count;
    343333                        j %= count;
    344334
    345335                        // try popping from the 2 picked lists
    346                         struct $thread * thrd = try_pop(cltr, i, j);
     336                        struct $thread * thrd = try_pop(cltr, i, j __STATS(, *(locali || localj ? &__tls_stats()->ready.pop.local : &__tls_stats()->ready.pop.help)));
    347337                        if(thrd) {
    348                                 #if !defined(__CFA_NO_STATISTICS__)
    349                                         if( locali || localj ) __tls_stats()->ready.pick.pop.lsuccess++;
    350                                 #endif
    351338                                return thrd;
    352339                        }
     
    374361                unsigned i;
    375362                do {
     363                        #if !defined(__CFA_NO_STATISTICS__)
     364                                if(unlikely(external)) __atomic_fetch_add(&cltr->stats->ready.push.extrn.attempt, 1, __ATOMIC_RELAXED);
     365                                else __tls_stats()->ready.push.local.attempt++;
     366                        #endif
     367
    376368                        if(unlikely(external)) {
    377369                                i = __tls_rand() % lanes.count;
     
    398390                        // Unlock and return
    399391                        __atomic_unlock( &lanes.data[i].lock );
     392                #endif
     393
     394                #if !defined(__CFA_NO_STATISTICS__)
     395                        if(unlikely(external)) __atomic_fetch_add(&cltr->stats->ready.push.extrn.success, 1, __ATOMIC_RELAXED);
     396                        else __tls_stats()->ready.push.local.success++;
    400397                #endif
    401398
     
    422419                }
    423420                else if(lanes.tscs[proc->rdq.target].tv < proc->rdq.cutoff) {
    424                         $thread * t = try_pop(cltr, proc->rdq.target);
     421                        $thread * t = try_pop(cltr, proc->rdq.target __STATS(, __tls_stats()->ready.pop.help));
    425422                        proc->rdq.target = -1u;
    426423                        if(t) return t;
     
    429426                for(READYQ_SHARD_FACTOR) {
    430427                        unsigned i = proc->rdq.id + (--proc->rdq.itr % READYQ_SHARD_FACTOR);
    431                         if($thread * t = try_pop(cltr, i)) return t;
     428                        if($thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t;
    432429                }
    433430                return 0p;
     
    437434                for(25) {
    438435                        unsigned i = __tls_rand() % lanes.count;
    439                         $thread * t = try_pop(cltr, i);
     436                        $thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal));
    440437                        if(t) return t;
    441438                }
     
    453450//-----------------------------------------------------------------------
    454451// try to pop from a lane given by index w
    455 static inline struct $thread * try_pop(struct cluster * cltr, unsigned w) with (cltr->ready_queue) {
     452static inline struct $thread * try_pop(struct cluster * cltr, unsigned w __STATS(, __stats_readyQ_pop_t & stats)) with (cltr->ready_queue) {
     453        __STATS( stats.attempt++; )
     454
    456455        // Get relevant elements locally
    457456        __intrusive_lane_t & lane = lanes.data[w];
    458457
    459458        // If list looks empty retry
    460         if( is_empty(lane) ) return 0p;
     459        if( is_empty(lane) ) {
     460                __STATS( stats.espec++; )
     461                return 0p;
     462        }
    461463
    462464        // If we can't get the lock retry
    463         if( !__atomic_try_acquire(&lane.lock) ) return 0p;
     465        if( !__atomic_try_acquire(&lane.lock) ) {
     466                __STATS( stats.elock++; )
     467                return 0p;
     468        }
    464469
    465470        // If list is empty, unlock and retry
    466471        if( is_empty(lane) ) {
    467472                __atomic_unlock(&lane.lock);
     473                __STATS( stats.eempty++; )
    468474                return 0p;
    469475        }
     
    480486
    481487        // Update statistics
    482         #if !defined(__CFA_NO_STATISTICS__)
    483                 __tls_stats()->ready.pick.pop.success++;
    484         #endif
     488        __STATS( stats.success++; )
    485489
    486490        #if defined(USE_WORK_STEALING)
     
    501505        for(i; count) {
    502506                unsigned idx = (offset + i) % count;
    503                 struct $thread * thrd = try_pop(cltr, idx);
     507                struct $thread * thrd = try_pop(cltr, idx __STATS(, __tls_stats()->ready.pop.search));
    504508                if(thrd) {
    505509                        return thrd;
     
    539543//-----------------------------------------------------------------------
    540544// Given 2 indexes, pick the list with the oldest push an try to pop from it
    541 static inline struct $thread * try_pop(struct cluster * cltr, unsigned i, unsigned j) with (cltr->ready_queue) {
    542         #if !defined(__CFA_NO_STATISTICS__)
    543                 __tls_stats()->ready.pick.pop.attempt++;
    544         #endif
    545 
     545static inline struct $thread * try_pop(struct cluster * cltr, unsigned i, unsigned j __STATS(, __stats_readyQ_pop_t & stats)) with (cltr->ready_queue) {
    546546        // Pick the bet list
    547547        int w = i;
     
    550550        }
    551551
    552         return try_pop(cltr, w);
     552        return try_pop(cltr, w __STATS(, stats));
    553553}
    554554
  • libcfa/src/concurrency/stats.cfa

    r4aa495f rd2fadeb  
    1010#if !defined(__CFA_NO_STATISTICS__)
    1111        void __init_stats( struct __stats_t * stats ) {
    12                 stats->ready.pick.push.attempt  = 0;
    13                 stats->ready.pick.push.success  = 0;
    14                 stats->ready.pick.push.local    = 0;
    15                 stats->ready.pick.push.lsuccess = 0;
    16                 stats->ready.pick.ext.attempt  = 0;
    17                 stats->ready.pick.ext.success  = 0;
    18                 stats->ready.pick.ext.local    = 0;
    19                 stats->ready.pick.ext.lsuccess = 0;
    20                 stats->ready.pick.pop .probe    = 0;
    21                 stats->ready.pick.pop .attempt  = 0;
    22                 stats->ready.pick.pop .success  = 0;
    23                 stats->ready.pick.pop .local    = 0;
    24                 stats->ready.pick.pop .lsuccess = 0;
     12                stats->ready.push.local.attempt = 0;
     13                stats->ready.push.local.success = 0;
     14                stats->ready.push.share.attempt = 0;
     15                stats->ready.push.share.success = 0;
     16                stats->ready.push.extrn.attempt = 0;
     17                stats->ready.push.extrn.success = 0;
     18                stats->ready.pop.local .attempt = 0;
     19                stats->ready.pop.local .success = 0;
     20                stats->ready.pop.local .elock   = 0;
     21                stats->ready.pop.local .eempty  = 0;
     22                stats->ready.pop.local .espec   = 0;
     23                stats->ready.pop.help  .attempt = 0;
     24                stats->ready.pop.help  .success = 0;
     25                stats->ready.pop.help  .elock   = 0;
     26                stats->ready.pop.help  .eempty  = 0;
     27                stats->ready.pop.help  .espec   = 0;
     28                stats->ready.pop.steal .attempt = 0;
     29                stats->ready.pop.steal .success = 0;
     30                stats->ready.pop.steal .elock   = 0;
     31                stats->ready.pop.steal .eempty  = 0;
     32                stats->ready.pop.steal .espec   = 0;
     33                stats->ready.pop.search.attempt = 0;
     34                stats->ready.pop.search.success = 0;
     35                stats->ready.pop.search.elock   = 0;
     36                stats->ready.pop.search.eempty  = 0;
     37                stats->ready.pop.search.espec   = 0;
    2538                stats->ready.threads.migration = 0;
    2639                stats->ready.threads.threads   = 0;
     
    5467
    5568        void __tally_stats( struct __stats_t * cltr, struct __stats_t * proc ) {
    56                 __atomic_fetch_add( &cltr->ready.pick.push.attempt , proc->ready.pick.push.attempt , __ATOMIC_SEQ_CST ); proc->ready.pick.push.attempt  = 0;
    57                 __atomic_fetch_add( &cltr->ready.pick.push.success , proc->ready.pick.push.success , __ATOMIC_SEQ_CST ); proc->ready.pick.push.success  = 0;
    58                 __atomic_fetch_add( &cltr->ready.pick.push.local   , proc->ready.pick.push.local   , __ATOMIC_SEQ_CST ); proc->ready.pick.push.local    = 0;
    59                 __atomic_fetch_add( &cltr->ready.pick.push.lsuccess, proc->ready.pick.push.lsuccess, __ATOMIC_SEQ_CST ); proc->ready.pick.push.lsuccess = 0;
    60                 __atomic_fetch_add( &cltr->ready.pick.ext.attempt  , proc->ready.pick.ext.attempt  , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.attempt   = 0;
    61                 __atomic_fetch_add( &cltr->ready.pick.ext.success  , proc->ready.pick.ext.success  , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.success   = 0;
    62                 __atomic_fetch_add( &cltr->ready.pick.ext.local    , proc->ready.pick.ext.local    , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.local     = 0;
    63                 __atomic_fetch_add( &cltr->ready.pick.ext.lsuccess , proc->ready.pick.ext.lsuccess , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.lsuccess  = 0;
    64                 __atomic_fetch_add( &cltr->ready.pick.pop .probe   , proc->ready.pick.pop .probe   , __ATOMIC_SEQ_CST ); proc->ready.pick.pop .probe    = 0;
    65                 __atomic_fetch_add( &cltr->ready.pick.pop .attempt , proc->ready.pick.pop .attempt , __ATOMIC_SEQ_CST ); proc->ready.pick.pop .attempt  = 0;
    66                 __atomic_fetch_add( &cltr->ready.pick.pop .success , proc->ready.pick.pop .success , __ATOMIC_SEQ_CST ); proc->ready.pick.pop .success  = 0;
    67                 __atomic_fetch_add( &cltr->ready.pick.pop .local   , proc->ready.pick.pop .local   , __ATOMIC_SEQ_CST ); proc->ready.pick.pop .local    = 0;
    68                 __atomic_fetch_add( &cltr->ready.pick.pop .lsuccess, proc->ready.pick.pop .lsuccess, __ATOMIC_SEQ_CST ); proc->ready.pick.pop .lsuccess = 0;
     69                __atomic_fetch_add( &cltr->ready.push.local.attempt, proc->ready.push.local.attempt, __ATOMIC_SEQ_CST ); proc->ready.push.local.attempt = 0;
     70                __atomic_fetch_add( &cltr->ready.push.local.success, proc->ready.push.local.success, __ATOMIC_SEQ_CST ); proc->ready.push.local.success = 0;
     71                __atomic_fetch_add( &cltr->ready.push.share.attempt, proc->ready.push.share.attempt, __ATOMIC_SEQ_CST ); proc->ready.push.share.attempt = 0;
     72                __atomic_fetch_add( &cltr->ready.push.share.success, proc->ready.push.share.success, __ATOMIC_SEQ_CST ); proc->ready.push.share.success = 0;
     73                __atomic_fetch_add( &cltr->ready.push.extrn.attempt, proc->ready.push.extrn.attempt, __ATOMIC_SEQ_CST ); proc->ready.push.extrn.attempt = 0;
     74                __atomic_fetch_add( &cltr->ready.push.extrn.success, proc->ready.push.extrn.success, __ATOMIC_SEQ_CST ); proc->ready.push.extrn.success = 0;
     75                __atomic_fetch_add( &cltr->ready.pop.local .attempt, proc->ready.pop.local .attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.local .attempt = 0;
     76                __atomic_fetch_add( &cltr->ready.pop.local .success, proc->ready.pop.local .success, __ATOMIC_SEQ_CST ); proc->ready.pop.local .success = 0;
     77                __atomic_fetch_add( &cltr->ready.pop.local .elock  , proc->ready.pop.local .elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.local .elock   = 0;
     78                __atomic_fetch_add( &cltr->ready.pop.local .eempty , proc->ready.pop.local .eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.local .eempty  = 0;
     79                __atomic_fetch_add( &cltr->ready.pop.local .espec  , proc->ready.pop.local .espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.local .espec   = 0;
     80                __atomic_fetch_add( &cltr->ready.pop.help  .attempt, proc->ready.pop.help  .attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.help  .attempt = 0;
     81                __atomic_fetch_add( &cltr->ready.pop.help  .success, proc->ready.pop.help  .success, __ATOMIC_SEQ_CST ); proc->ready.pop.help  .success = 0;
     82                __atomic_fetch_add( &cltr->ready.pop.help  .elock  , proc->ready.pop.help  .elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.help  .elock   = 0;
     83                __atomic_fetch_add( &cltr->ready.pop.help  .eempty , proc->ready.pop.help  .eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.help  .eempty  = 0;
     84                __atomic_fetch_add( &cltr->ready.pop.help  .espec  , proc->ready.pop.help  .espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.help  .espec   = 0;
     85                __atomic_fetch_add( &cltr->ready.pop.steal .attempt, proc->ready.pop.steal .attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.steal .attempt = 0;
     86                __atomic_fetch_add( &cltr->ready.pop.steal .success, proc->ready.pop.steal .success, __ATOMIC_SEQ_CST ); proc->ready.pop.steal .success = 0;
     87                __atomic_fetch_add( &cltr->ready.pop.steal .elock  , proc->ready.pop.steal .elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.steal .elock   = 0;
     88                __atomic_fetch_add( &cltr->ready.pop.steal .eempty , proc->ready.pop.steal .eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.steal .eempty  = 0;
     89                __atomic_fetch_add( &cltr->ready.pop.steal .espec  , proc->ready.pop.steal .espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.steal .espec   = 0;
     90                __atomic_fetch_add( &cltr->ready.pop.search.attempt, proc->ready.pop.search.attempt, __ATOMIC_SEQ_CST ); proc->ready.pop.search.attempt = 0;
     91                __atomic_fetch_add( &cltr->ready.pop.search.success, proc->ready.pop.search.success, __ATOMIC_SEQ_CST ); proc->ready.pop.search.success = 0;
     92                __atomic_fetch_add( &cltr->ready.pop.search.elock  , proc->ready.pop.search.elock  , __ATOMIC_SEQ_CST ); proc->ready.pop.search.elock   = 0;
     93                __atomic_fetch_add( &cltr->ready.pop.search.eempty , proc->ready.pop.search.eempty , __ATOMIC_SEQ_CST ); proc->ready.pop.search.eempty  = 0;
     94                __atomic_fetch_add( &cltr->ready.pop.search.espec  , proc->ready.pop.search.espec  , __ATOMIC_SEQ_CST ); proc->ready.pop.search.espec   = 0;
    6995                __atomic_fetch_add( &cltr->ready.threads.migration , proc->ready.threads.migration , __ATOMIC_SEQ_CST ); proc->ready.threads.migration  = 0;
    7096                __atomic_fetch_add( &cltr->ready.threads.threads   , proc->ready.threads.threads   , __ATOMIC_SEQ_CST ); proc->ready.threads.threads    = 0;
     
    95121
    96122                if( flags & CFA_STATS_READY_Q ) {
    97                         double push_len = ((double)ready.pick.push.attempt) / ready.pick.push.success;
    98                         double ext_len  = ((double)ready.pick.ext .attempt) / ready.pick.ext .success;
    99                         double pop_len  = ((double)ready.pick.pop .attempt) / ready.pick.pop .success;
    100 
    101                         double lpush_len = ((double)ready.pick.push.local) / ready.pick.push.lsuccess;
    102                         double lext_len  = ((double)ready.pick.ext .local) / ready.pick.ext .lsuccess;
    103                         double lpop_len  = ((double)ready.pick.pop .local) / ready.pick.pop .lsuccess;
     123                        double push_len = ((double)ready.push.local.attempt + ready.push.share.attempt + ready.push.extrn.attempt) / (ready.push.local.success + ready.push.share.success + ready.push.extrn.success);
     124                        double sLcl_len = ready.push.local.success ? ((double)ready.push.local.attempt) / ready.push.local.success : 0;
     125                        double sOth_len = ready.push.share.success ? ((double)ready.push.share.attempt) / ready.push.share.success : 0;
     126                        double sExt_len = ready.push.extrn.success ? ((double)ready.push.extrn.attempt) / ready.push.extrn.success : 0;
     127
     128                        double rLcl_len  = ready.pop.local .success ? ((double)ready.pop.local .attempt) / ready.pop.local .success : 0;
     129                        double rHlp_len  = ready.pop.help  .success ? ((double)ready.pop.help  .attempt) / ready.pop.help  .success : 0;
     130                        double rStl_len  = ready.pop.steal .success ? ((double)ready.pop.steal .attempt) / ready.pop.steal .success : 0;
     131                        double rSch_len  = ready.pop.search.success ? ((double)ready.pop.search.attempt) / ready.pop.search.success : 0;
    104132
    105133                        __cfaabi_bits_print_safe( STDOUT_FILENO,
    106134                                "----- %s \"%s\" (%p) - Ready Q Stats -----\n"
    107                                 "- total threads  : %'15" PRIu64 "run, %'15" PRIu64 "schd (%'" PRIu64 "ext, %'" PRIu64 "mig, %'" PRId64 " )\n"
    108                                 "- push avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n"
    109                                 "- ext  avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n"
    110                                 "- pop  avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n"
    111                                 "- Idle Sleep     : %'15" PRIu64 "h, %'15" PRIu64 "c, %'15" PRIu64 "w, %'15" PRIu64 "e\n"
     135                                "- totals   : %'3" PRIu64 " run, %'3" PRIu64 " schd (%'" PRIu64 "ext, %'" PRIu64 "mig, %'" PRId64 " )\n"
     136                                "- push avg : %'3.2lf (l: %'3.2lf/%'" PRIu64 ", s: %'3.2lf/%'" PRIu64 ", e: %'3.2lf : %'" PRIu64 "e)\n"
     137                                "- local    : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     138                                "- help     : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     139                                "- steal    : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     140                                "- search   : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     141                                "- Idle Slp : %'3" PRIu64 "h, %'3" PRIu64 "c, %'3" PRIu64 "w, %'3" PRIu64 "e\n"
    112142                                "\n"
    113143                                , type, name, id
    114                                 , ready.pick.pop.success
    115                                 , ready.pick.push.success + ready.pick.ext.success
    116                                 , ready.pick.ext.success, ready.threads.migration, ready.threads.threads
    117                                 , push_len, lpush_len, ready.pick.push.attempt, ready.pick.push.local
    118                                 , ext_len , lext_len , ready.pick.ext .attempt, ready.pick.ext .local
    119                                 , pop_len , lpop_len , ready.pick.pop .attempt, ready.pick.pop .local
     144                                , ready.pop.local.success + ready.pop.help.success + ready.pop.steal.success + ready.pop.search.success
     145                                , ready.push.local.success + ready.push.share.success + ready.push.extrn.success
     146                                , ready.push.extrn.success, ready.threads.migration, ready.threads.threads
     147                                , push_len, sLcl_len, ready.push.local.attempt, sOth_len, ready.push.share.attempt, sExt_len, ready.push.extrn.attempt
     148                                , rLcl_len, ready.pop.local .attempt, ready.pop.local .espec, ready.pop.local .elock, ready.pop.local .eempty
     149                                , rHlp_len, ready.pop.help  .attempt, ready.pop.help  .espec, ready.pop.help  .elock, ready.pop.help  .eempty
     150                                , rStl_len, ready.pop.steal .attempt, ready.pop.steal .espec, ready.pop.steal .elock, ready.pop.steal .eempty
     151                                , rSch_len, ready.pop.search.attempt, ready.pop.search.espec, ready.pop.search.elock, ready.pop.search.eempty
    120152                                , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits
    121153                        );
  • libcfa/src/concurrency/stats.hfa

    r4aa495f rd2fadeb  
    1616        static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {}
    1717#else
     18        struct __stats_readyQ_pop_t {
     19                // number of attemps at poping something
     20                volatile uint64_t attempt;
    1821
    19         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
    2037                struct {
    21                         // Push statistic
    2238                        struct {
    23                                 // number of attemps at pushing something
     39                                // number of attemps at pushing something to preferred queues
    2440                                volatile uint64_t attempt;
    2541
    26                                 // number of successes at pushing
     42                                // number of successes at pushing to preferred queues
    2743                                volatile uint64_t success;
     44                        }
     45                        // Stats for local queue within cluster
     46                        local,
    2847
    29                                 // number of attemps at pushing something to preferred queues
    30                                 volatile uint64_t local;
     48                        // Stats for non-local queues within cluster
     49                        share,
    3150
    32                                 // number of successes at pushing to preferred queues
    33                                 volatile uint64_t lsuccess;
    34                         } push;
     51                        // Stats from outside cluster
     52                        extrn;
     53                } push;
    3554
    36                         struct {
    37                                 // number of attemps at pushing something
    38                                 volatile uint64_t attempt;
     55                // Pop statistic
     56                struct {
     57                        // pop from local queue
     58                        __stats_readyQ_pop_t local;
    3959
    40                                 // number of successes at pushing
    41                                 volatile uint64_t success;
     60                        // pop before looking at local queue
     61                        __stats_readyQ_pop_t help;
    4262
    43                                 // number of attemps at pushing something to preferred queues
    44                                 volatile uint64_t local;
     63                        // pop from some other queue
     64                        __stats_readyQ_pop_t steal;
    4565
    46                                 // number of successes at pushing to preferred queues
    47                                 volatile uint64_t lsuccess;
    48                         } ext;
     66                        // pop when searching queues sequentially
     67                        __stats_readyQ_pop_t search;
     68                } pop;
    4969
    50                         // Pop statistic
    51                         struct {
    52                                 // number of reads of the mask
    53                                 // picking an empty __cfa_readyQ_mask_t counts here
    54                                 // but not as an attempt
    55                                 volatile uint64_t probe;
    56 
    57                                 // number of attemps at poping something
    58                                 volatile uint64_t attempt;
    59 
    60                                 // number of successes at poping
    61                                 volatile uint64_t success;
    62 
    63                                 // number of attemps at poping something to preferred queues
    64                                 volatile uint64_t local;
    65 
    66                                 // number of successes at poping to preferred queues
    67                                 volatile uint64_t lsuccess;
    68                         } pop;
    69                 } pick;
    7070                struct {
    7171                        volatile uint64_t migration;
     
    119119
    120120        struct __attribute__((aligned(128))) __stats_t {
    121                 __stats_readQ_t ready;
     121                __stats_readyQ_t ready;
    122122                #if defined(CFA_HAVE_LINUX_IO_URING_H)
    123123                        __stats_io_t    io;
Note: See TracChangeset for help on using the changeset viewer.