Ignore:
Timestamp:
Jun 24, 2020, 1:40:35 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c7816be
Parents:
de917da3
Message:

Added statistics for local success when biased

File:
1 edited

Legend:

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

    rde917da3 r52769ba  
    219219        thrd->link.ts = rdtscl();
    220220
     221        #if defined(BIAS) && !defined(__CFA_NO_STATISTICS__)
     222                bool local = false;
     223        #endif
     224
    221225        // Try to pick a lane and lock it
    222226        unsigned i;
     
    234238
    235239                                #if !defined(__CFA_NO_STATISTICS__)
     240                                        local = true;
    236241                                        __tls_stats()->ready.pick.push.local++;
    237242                                #endif
     
    241246                                // Use all queues
    242247                                i = rhigh;
     248                                local = false;
    243249                        }
    244250                #else
     
    276282        // Update statistics
    277283        #if !defined(__CFA_NO_STATISTICS__)
     284                #if defined(BIAS)
     285                        if( local ) __tls_stats()->ready.pick.push.lsuccess++;
     286                #endif
    278287                __tls_stats()->ready.pick.push.success++;
    279288        #endif
     
    299308                unsigned i,j;
    300309                #if defined(BIAS)
     310                        #if !defined(__CFA_NO_STATISTICS__)
     311                                bool local = false;
     312                        #endif
    301313                        uint64_t r = __tls_rand();
    302314                        unsigned rlow  = r % BIAS;
     
    313325
    314326                                #if !defined(__CFA_NO_STATISTICS__)
     327                                        local = true;
    315328                                        __tls_stats()->ready.pick.pop.local++;
    316329                                #endif
     
    332345                // try popping from the 2 picked lists
    333346                struct $thread * thrd = try_pop(cltr, i, j);
    334                 if(thrd) return thrd;
     347                if(thrd) {
     348                        #if defined(BIAS) && !defined(__CFA_NO_STATISTICS__)
     349                                if( local ) __tls_stats()->ready.pick.pop.lsuccess++;
     350                        #endif
     351                        return thrd;
     352                }
    335353        }
    336354
Note: See TracChangeset for help on using the changeset viewer.