Changeset efdd18c


Ignore:
Timestamp:
Mar 30, 2023, 3:49:10 PM (20 months ago)
Author:
caparson <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
a45e21c
Parents:
9319a23
Message:

updated actor header to use better name for stat toggling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/actor.hfa

    r9319a23 refdd18c  
    3535
    3636// show stats
    37 // #define STATS
     37// #define ACTOR_STATS
    3838
    3939// forward decls
     
    122122    copy_queue * c_queue;           // current queue
    123123    volatile bool being_processed;  // flag to prevent concurrent processing
    124     #ifdef STATS
     124    #ifdef ACTOR_STATS
    125125    unsigned int id;
    126126    size_t missed;                  // transfers skipped due to being_processed flag being up
     
    132132    c_queue = owned_queue;
    133133    being_processed = false;
    134     #ifdef STATS
     134    #ifdef ACTOR_STATS
    135135    id = i;
    136136    missed = 0;
     
    153153    // check if queue is being processed elsewhere
    154154    if ( unlikely( being_processed ) ) {
    155         #ifdef STATS
     155        #ifdef ACTOR_STATS
    156156        missed++;
    157157        #endif
     
    175175struct worker_info {
    176176    volatile unsigned long long stamp;
    177     #ifdef STATS
     177    #ifdef ACTOR_STATS
    178178    size_t stolen_from, try_steal, stolen, failed_swaps, msgs_stolen;
    179179    unsigned long long processed;
     
    182182};
    183183static inline void ?{}( worker_info & this ) {
    184     #ifdef STATS
     184    #ifdef ACTOR_STATS
    185185    this.stolen_from = 0;
    186186    this.try_steal = 0;                             // attempts to steal
     
    194194}
    195195
    196 // #ifdef STATS
     196// #ifdef ACTOR_STATS
    197197// unsigned int * stolen_arr;
    198198// unsigned int * replaced_queue;
     
    206206};
    207207
    208 #ifdef STATS
     208#ifdef ACTOR_STATS
    209209// aggregate counters for statistics
    210210size_t __total_tries = 0, __total_stolen = 0, __total_workers, __all_gulps = 0,
     
    235235}; // executor
    236236
    237 // #ifdef STATS
     237// #ifdef ACTOR_STATS
    238238// __spinlock_t out_lock;
    239239// #endif
    240240static inline void ^?{}( worker & mutex this ) with(this) {
    241     #ifdef STATS
     241    #ifdef ACTOR_STATS
    242242    __atomic_add_fetch(&__all_gulps, executor_->w_infos[id].gulps,__ATOMIC_SEQ_CST);
    243243    __atomic_add_fetch(&__all_processed, executor_->w_infos[id].processed,__ATOMIC_SEQ_CST);
     
    276276        no_steal = true;
    277277   
    278     #ifdef STATS
     278    #ifdef ACTOR_STATS
    279279    // stolen_arr = aalloc( nrqueues );
    280280    // replaced_queue = aalloc( nrqueues );
     
    341341    } // for
    342342
    343     #ifdef STATS
     343    #ifdef ACTOR_STATS
    344344    size_t misses = 0;
    345345    for ( i; nrqueues ) {
     
    358358    if ( seperate_clus ) delete( cluster );
    359359
    360     #ifdef STATS // print formatted stats
     360    #ifdef ACTOR_STATS // print formatted stats
    361361    printf("    Actor System Stats:\n");
    362362    printf("\tActors Created:\t\t\t\t%lu\n\tMessages Sent:\t\t\t\t%lu\n", __num_actors_stats, __all_processed);
     
    404404    ticket = __get_next_ticket( *__actor_executor_ );
    405405    __atomic_fetch_add( &__num_actors_, 1, __ATOMIC_RELAXED );
    406     #ifdef STATS
     406    #ifdef ACTOR_STATS
    407407    __atomic_fetch_add( &__num_actors_stats, 1, __ATOMIC_SEQ_CST );
    408408    #endif
     
    513513            continue;
    514514
    515         #ifdef STATS
     515        #ifdef ACTOR_STATS
    516516        curr_steal_queue = try_swap_queues( this, i + vic_start, swap_idx );
    517517        if ( curr_steal_queue ) {
     
    526526        #else
    527527        curr_steal_queue = try_swap_queues( this, i + vic_start, swap_idx );
    528         #endif // STATS
     528        #endif // ACTOR_STATS
    529529
    530530        return;
     
    558558
    559559void main( worker & this ) with(this) {
    560     // #ifdef STATS
     560    // #ifdef ACTOR_STATS
    561561    // for ( i; executor_->nrqueues ) {
    562562    //     replaced_queue[i] = 0;
     
    587587        }
    588588        transfer( *curr_work_queue, &current_queue );
    589         #ifdef STATS
     589        #ifdef ACTOR_STATS
    590590        executor_->w_infos[id].gulps++;
    591         #endif // STATS
     591        #endif // ACTOR_STATS
    592592        #ifdef __STEAL
    593593        if ( isEmpty( *current_queue ) ) {
     
    599599            __atomic_store_n( &executor_->w_infos[id].stamp, rdtscl(), __ATOMIC_RELAXED );
    600600           
    601             #ifdef STATS
     601            #ifdef ACTOR_STATS
    602602            executor_->w_infos[id].try_steal++;
    603             #endif // STATS
     603            #endif // ACTOR_STATS
    604604           
    605605            steal_work( this, start + prng( range ) );
     
    608608        #endif // __STEAL
    609609        while ( ! isEmpty( *current_queue ) ) {
    610             #ifdef STATS
     610            #ifdef ACTOR_STATS
    611611            executor_->w_infos[id].processed++;
    612612            #endif
     
    636636
    637637static inline void __reset_stats() {
    638     #ifdef STATS
     638    #ifdef ACTOR_STATS
    639639    __total_tries = 0;
    640640    __total_stolen = 0;
Note: See TracChangeset for help on using the changeset viewer.