Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/cluster.hfa

    r741e22c rb035046  
    2424// Calc moving average based on existing average, before and current time.
    2525static inline unsigned long long moving_average(unsigned long long currtsc, unsigned long long instsc, unsigned long long old_avg) {
     26        /* paranoid */ verifyf( currtsc < 45000000000000000, "Suspiciously large current time: %'llu (%llx)\n", currtsc, currtsc );
     27        /* paranoid */ verifyf( instsc  < 45000000000000000, "Suspiciously large insert time: %'llu (%llx)\n", instsc, instsc );
    2628        /* paranoid */ verifyf( old_avg < 15000000000000, "Suspiciously large previous average: %'llu (%llx)\n", old_avg, old_avg );
    2729
     
    3739        if (ts_next == ULLONG_MAX) return;
    3840        unsigned long long now = rdtscl();
    39         unsigned long long pma = __atomic_load_n(&tscs[ idx ].t.ma, __ATOMIC_RELAXED);
    40         __atomic_store_n(&tscs[ idx ].t.tv, ts_next, __ATOMIC_RELAXED);
    41         __atomic_store_n(&tscs[ idx ].t.ma, moving_average(now, ts_prev, pma), __ATOMIC_RELAXED);
     41        unsigned long long pma = __atomic_load_n(&tscs[ idx ].ma, __ATOMIC_RELAXED);
     42        __atomic_store_n(&tscs[ idx ].tv, ts_next, __ATOMIC_RELAXED);
     43        __atomic_store_n(&tscs[ idx ].ma, moving_average(now, ts_prev, pma), __ATOMIC_RELAXED);
    4244}
    4345
     
    5961                if(ptsc != ULLONG_MAX) {
    6062                        /* paranoid */ verify( start + i < count );
    61                         unsigned long long tsc = moving_average(ctsc, ptsc, tscs[start + i].t.ma);
     63                        unsigned long long tsc = moving_average(ctsc, ptsc, tscs[start + i].ma);
    6264                        if(tsc > max) max = tsc;
    6365                }
Note: See TracChangeset for help on using the changeset viewer.