Changeset fd1f65e


Ignore:
Timestamp:
Apr 1, 2021, 8:02:19 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:
a344425
Parents:
b580bcc
Message:

Stats now keep track of external pushes separately

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

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

    rb580bcc rfd1f65e  
    244244        __cfadbg_print_safe(ready_queue, "Kernel : Pushing %p on cluster %p\n", thrd, cltr);
    245245
     246        #if !defined(__CFA_NO_STATISTICS__)
     247                const bool external = cltr == kernelTLS().this_processor->cltr;
     248        #endif
     249
    246250        // write timestamp
    247251        thrd->link.ts = rdtscl();
     
    266270                [i, local] = idx_from_r(r, preferred);
    267271
     272                i %= __atomic_load_n( &lanes.count, __ATOMIC_RELAXED );
     273
    268274                #if !defined(__CFA_NO_STATISTICS__)
    269                         if(local) {
    270                                 __tls_stats()->ready.pick.push.local++;
    271                         }
    272                 #endif
    273 
    274                 i %= __atomic_load_n( &lanes.count, __ATOMIC_RELAXED );
    275 
    276                 #if !defined(__CFA_NO_STATISTICS__)
    277                         __tls_stats()->ready.pick.push.attempt++;
     275                        if(external) {
     276                                if(local) __atomic_fetch_add(&cltr->stats->ready.pick.ext.local, 1, __ATOMIC_RELAXED);
     277                                __atomic_fetch_add(&cltr->stats->ready.pick.ext.attempt, 1, __ATOMIC_RELAXED);
     278                        }
     279                        else {
     280                                if(local) __tls_stats()->ready.pick.push.local++;
     281                                __tls_stats()->ready.pick.push.attempt++;
     282                        }
    278283                #endif
    279284
     
    310315        // Update statistics
    311316        #if !defined(__CFA_NO_STATISTICS__)
    312                 #if defined(BIAS)
    313                         if( local ) __tls_stats()->ready.pick.push.lsuccess++;
    314                 #endif
    315                 __tls_stats()->ready.pick.push.success++;
     317                if(external) {
     318                        if(local) __atomic_fetch_add(&cltr->stats->ready.pick.ext.lsuccess, 1, __ATOMIC_RELAXED);
     319                        __atomic_fetch_add(&cltr->stats->ready.pick.ext.success, 1, __ATOMIC_RELAXED);
     320                }
     321                else {
     322                        if(local) __tls_stats()->ready.pick.push.lsuccess++;
     323                        __tls_stats()->ready.pick.push.success++;
     324                }
    316325        #endif
    317326
  • libcfa/src/concurrency/stats.cfa

    rb580bcc rfd1f65e  
    1313                stats->ready.pick.push.local    = 0;
    1414                stats->ready.pick.push.lsuccess = 0;
     15                stats->ready.pick.ext.attempt  = 0;
     16                stats->ready.pick.ext.success  = 0;
     17                stats->ready.pick.ext.local    = 0;
     18                stats->ready.pick.ext.lsuccess = 0;
    1519                stats->ready.pick.pop .probe    = 0;
    1620                stats->ready.pick.pop .attempt  = 0;
     
    4751                __atomic_fetch_add( &cltr->ready.pick.push.local   , proc->ready.pick.push.local   , __ATOMIC_SEQ_CST ); proc->ready.pick.push.local    = 0;
    4852                __atomic_fetch_add( &cltr->ready.pick.push.lsuccess, proc->ready.pick.push.lsuccess, __ATOMIC_SEQ_CST ); proc->ready.pick.push.lsuccess = 0;
     53                __atomic_fetch_add( &cltr->ready.pick.ext.attempt  , proc->ready.pick.ext.attempt  , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.attempt   = 0;
     54                __atomic_fetch_add( &cltr->ready.pick.ext.success  , proc->ready.pick.ext.success  , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.success   = 0;
     55                __atomic_fetch_add( &cltr->ready.pick.ext.local    , proc->ready.pick.ext.local    , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.local     = 0;
     56                __atomic_fetch_add( &cltr->ready.pick.ext.lsuccess , proc->ready.pick.ext.lsuccess , __ATOMIC_SEQ_CST ); proc->ready.pick.ext.lsuccess  = 0;
    4957                __atomic_fetch_add( &cltr->ready.pick.pop .probe   , proc->ready.pick.pop .probe   , __ATOMIC_SEQ_CST ); proc->ready.pick.pop .probe    = 0;
    5058                __atomic_fetch_add( &cltr->ready.pick.pop .attempt , proc->ready.pick.pop .attempt , __ATOMIC_SEQ_CST ); proc->ready.pick.pop .attempt  = 0;
     
    8088                if( flags & CFA_STATS_READY_Q ) {
    8189                        double push_len = ((double)ready.pick.push.attempt) / ready.pick.push.success;
     90                        double ext_len  = ((double)ready.pick.ext .attempt) / ready.pick.ext .success;
    8291                        double pop_len  = ((double)ready.pick.pop .attempt) / ready.pick.pop .success;
    8392
    8493                        double lpush_len = ((double)ready.pick.push.local) / ready.pick.push.lsuccess;
     94                        double lext_len  = ((double)ready.pick.ext .local) / ready.pick.ext .lsuccess;
    8595                        double lpop_len  = ((double)ready.pick.pop .local) / ready.pick.pop .lsuccess;
    8696
     
    8999                                "- total threads  : %'15" PRIu64 "run, %'15" PRIu64 "schd (%'" PRIu64 "mig )\n"
    90100                                "- push avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n"
     101                                "- ext  avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n"
    91102                                "- pop  avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n"
    92103                                "- Idle Sleep     : %'15" PRIu64 "h, %'15" PRIu64 "c, %'15" PRIu64 "w, %'15" PRIu64 "e\n"
     
    97108                                , ready.threads.migration
    98109                                , push_len, lpush_len, ready.pick.push.attempt, ready.pick.push.local
     110                                , ext_len , lext_len , ready.pick.ext .attempt, ready.pick.ext .local
    99111                                , pop_len , lpop_len , ready.pick.pop .attempt, ready.pick.pop .local
    100112                                , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits
  • libcfa/src/concurrency/stats.hfa

    rb580bcc rfd1f65e  
    3131                                volatile uint64_t lsuccess;
    3232                        } push;
     33
     34                        struct {
     35                                // number of attemps at pushing something
     36                                volatile uint64_t attempt;
     37
     38                                // number of successes at pushing
     39                                volatile uint64_t success;
     40
     41                                // number of attemps at pushing something to preferred queues
     42                                volatile uint64_t local;
     43
     44                                // number of successes at pushing to preferred queues
     45                                volatile uint64_t lsuccess;
     46                        } ext;
    3347
    3448                        // Pop statistic
Note: See TracChangeset for help on using the changeset viewer.