Changeset 52769ba


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

Location:
libcfa/src/concurrency
Files:
3 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
  • libcfa/src/concurrency/stats.cfa

    rde917da3 r52769ba  
    88#if !defined(__CFA_NO_STATISTICS__)
    99        void __init_stats( struct __stats_t * stats ) {
    10                 stats->ready.pick.push.attempt = 0;
    11                 stats->ready.pick.push.success = 0;
    12                 stats->ready.pick.pop .probe   = 0;
    13                 stats->ready.pick.pop .attempt = 0;
    14                 stats->ready.pick.pop .local   = 0;
    15                 stats->ready.pick.pop .success = 0;
     10                stats->ready.pick.push.attempt  = 0;
     11                stats->ready.pick.push.success  = 0;
     12                stats->ready.pick.push.local    = 0;
     13                stats->ready.pick.push.lsuccess = 0;
     14                stats->ready.pick.pop .probe    = 0;
     15                stats->ready.pick.pop .attempt  = 0;
     16                stats->ready.pick.pop .success  = 0;
     17                stats->ready.pick.pop .local    = 0;
     18                stats->ready.pick.pop .lsuccess = 0;
    1619                stats->ready.sleep.halts   = 0;
    1720                stats->ready.sleep.cancels = 0;
     
    3740
    3841        void __tally_stats( struct __stats_t * cltr, struct __stats_t * proc ) {
    39                 __atomic_fetch_add( &cltr->ready.pick.push.attempt, proc->ready.pick.push.attempt, __ATOMIC_SEQ_CST );
    40                 __atomic_fetch_add( &cltr->ready.pick.push.local  , proc->ready.pick.push.local  , __ATOMIC_SEQ_CST );
    41                 __atomic_fetch_add( &cltr->ready.pick.push.success, proc->ready.pick.push.success, __ATOMIC_SEQ_CST );
    42                 __atomic_fetch_add( &cltr->ready.pick.pop .probe  , proc->ready.pick.pop .probe  , __ATOMIC_SEQ_CST );
    43                 __atomic_fetch_add( &cltr->ready.pick.pop .attempt, proc->ready.pick.pop .attempt, __ATOMIC_SEQ_CST );
    44                 __atomic_fetch_add( &cltr->ready.pick.pop .local  , proc->ready.pick.pop .local  , __ATOMIC_SEQ_CST );
    45                 __atomic_fetch_add( &cltr->ready.pick.pop .success, proc->ready.pick.pop .success, __ATOMIC_SEQ_CST );
     42                __atomic_fetch_add( &cltr->ready.pick.push.attempt , proc->ready.pick.push.attempt , __ATOMIC_SEQ_CST );
     43                __atomic_fetch_add( &cltr->ready.pick.push.success , proc->ready.pick.push.success , __ATOMIC_SEQ_CST );
     44                __atomic_fetch_add( &cltr->ready.pick.push.local   , proc->ready.pick.push.local   , __ATOMIC_SEQ_CST );
     45                __atomic_fetch_add( &cltr->ready.pick.push.lsuccess, proc->ready.pick.push.lsuccess, __ATOMIC_SEQ_CST );
     46                __atomic_fetch_add( &cltr->ready.pick.pop .probe   , proc->ready.pick.pop .probe   , __ATOMIC_SEQ_CST );
     47                __atomic_fetch_add( &cltr->ready.pick.pop .attempt , proc->ready.pick.pop .attempt , __ATOMIC_SEQ_CST );
     48                __atomic_fetch_add( &cltr->ready.pick.pop .success , proc->ready.pick.pop .success , __ATOMIC_SEQ_CST );
     49                __atomic_fetch_add( &cltr->ready.pick.pop .local   , proc->ready.pick.pop .local   , __ATOMIC_SEQ_CST );
     50                __atomic_fetch_add( &cltr->ready.pick.pop .lsuccess, proc->ready.pick.pop .lsuccess, __ATOMIC_SEQ_CST );
    4651                __atomic_fetch_add( &cltr->ready.sleep.halts  , proc->ready.sleep.halts  , __ATOMIC_SEQ_CST );
    4752                __atomic_fetch_add( &cltr->ready.sleep.cancels, proc->ready.sleep.cancels, __ATOMIC_SEQ_CST );
     
    7479                double pop_len  = ((double)ready.pick.pop .attempt) / ready.pick.pop .success;
    7580
     81                double lpush_sur = (100.0 * ((double)ready.pick.push.lsuccess) / ready.pick.push.local);
     82                double lpop_sur  = (100.0 * ((double)ready.pick.pop .lsuccess) / ready.pick.pop .local);
     83
     84                double lpush_len = ((double)ready.pick.push.local) / ready.pick.push.lsuccess;
     85                double lpop_len  = ((double)ready.pick.pop .local) / ready.pick.pop .lsuccess;
     86
    7687                #if defined(HAVE_LINUX_IO_URING_H)
    7788                        double avgrdy = ((double)io.submit_q.submit_avg.rdy) / io.submit_q.submit_avg.cnt;
     
    98109                        "- total threads run      : %'15lu\n"
    99110                        "- total threads scheduled: %'15lu\n"
    100                         "- push average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts, %'15lu local)\n"
    101                         "- pop  average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts, %'15lu local)\n"
     111                        "- push average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"
     112                        "- pop  average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"
     113                        "- local push avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"
     114                        "- local pop  avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"
    102115                        "- Idle Sleep -\n"
    103116                        "-- halts                 : %'15lu\n"
     
    123136                        , ready.pick.pop.success
    124137                        , ready.pick.push.success
    125                         , push_len, push_sur, ready.pick.push.attempt, ready.pick.push.local
    126                         , pop_len , pop_sur , ready.pick.pop .attempt, ready.pick.pop .local
     138                        , push_len, push_sur, ready.pick.push.attempt
     139                        , pop_len , pop_sur , ready.pick.pop .attempt
     140                        , lpush_len, lpush_sur, ready.pick.push.local
     141                        , lpop_len , lpop_sur , ready.pick.pop .local
    127142                        , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits
    128143                        #if defined(HAVE_LINUX_IO_URING_H)
  • libcfa/src/concurrency/stats.hfa

    rde917da3 r52769ba  
    1616                                volatile uint64_t attempt;
    1717
    18                                 // number of attemps at pushing something something to preferred queues
     18                                // number of successes at pushing
     19                                volatile uint64_t success;
     20
     21                                // number of attemps at pushing something to preferred queues
    1922                                volatile uint64_t local;
    2023
    21                                 // number of successes at pushing
    22                                 volatile uint64_t success;
     24                                // number of successes at pushing to preferred queues
     25                                volatile uint64_t lsuccess;
    2326                        } push;
    2427
     
    3336                                volatile uint64_t attempt;
    3437
    35                                 // number of attemps at poping something from preferred queues
     38                                // number of successes at poping
     39                                volatile uint64_t success;
     40
     41                                // number of attemps at poping something to preferred queues
    3642                                volatile uint64_t local;
    3743
    38                                 // number of successes at poping
    39                                 volatile uint64_t success;
     44                                // number of successes at poping to preferred queues
     45                                volatile uint64_t lsuccess;
    4046                        } pop;
    4147                } pick;
Note: See TracChangeset for help on using the changeset viewer.