- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel/cluster.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/cluster.hfa
r741e22c rb035046 24 24 // Calc moving average based on existing average, before and current time. 25 25 static 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 ); 26 28 /* paranoid */ verifyf( old_avg < 15000000000000, "Suspiciously large previous average: %'llu (%llx)\n", old_avg, old_avg ); 27 29 … … 37 39 if (ts_next == ULLONG_MAX) return; 38 40 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); 42 44 } 43 45 … … 59 61 if(ptsc != ULLONG_MAX) { 60 62 /* 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); 62 64 if(tsc > max) max = tsc; 63 65 }
Note:
See TracChangeset
for help on using the changeset viewer.