- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel/cluster.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/cluster.hfa
rb035046 r741e22c 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 );28 26 /* paranoid */ verifyf( old_avg < 15000000000000, "Suspiciously large previous average: %'llu (%llx)\n", old_avg, old_avg ); 29 27 … … 39 37 if (ts_next == ULLONG_MAX) return; 40 38 unsigned long long now = rdtscl(); 41 unsigned long long pma = __atomic_load_n(&tscs[ idx ]. ma, __ATOMIC_RELAXED);42 __atomic_store_n(&tscs[ idx ].t v, ts_next, __ATOMIC_RELAXED);43 __atomic_store_n(&tscs[ idx ]. ma, moving_average(now, ts_prev, pma), __ATOMIC_RELAXED);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); 44 42 } 45 43 … … 61 59 if(ptsc != ULLONG_MAX) { 62 60 /* paranoid */ verify( start + i < count ); 63 unsigned long long tsc = moving_average(ctsc, ptsc, tscs[start + i]. ma);61 unsigned long long tsc = moving_average(ctsc, ptsc, tscs[start + i].t.ma); 64 62 if(tsc > max) max = tsc; 65 63 }
Note:
See TracChangeset
for help on using the changeset viewer.