Changeset da77728 for libcfa/src
- Timestamp:
- Sep 29, 2022, 3:23:14 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 33e4968e
- Parents:
- 2e94d94f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/cluster.hfa
r2e94d94f rda77728 21 21 #include <limits.h> 22 22 23 #include "clock.hfa" 24 23 25 //----------------------------------------------------------------------- 24 26 // Calc moving average based on existing average, before and current time. 25 27 static inline unsigned long long moving_average(unsigned long long currtsc, unsigned long long instsc, unsigned long long old_avg, bool strict) { 26 28 (void)strict; // disable the warning around the fact this is unused in release. 29 /* paranoid */ warnf( !strict || old_avg < 11_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'ldms \n", old_avg, old_avg, program()`ms ); 27 30 28 31 const unsigned long long new_val = currtsc > instsc ? currtsc - instsc : 0; … … 31 34 const unsigned long long old_weight = total_weight - new_weight; 32 35 const unsigned long long ret = ((new_weight * new_val) + (old_weight * old_avg)) / total_weight; 36 37 /* paranoid */ warnf( !strict || ret < 11_000_000_000, "Suspiciously large new average after %'ldms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, instsc, new_val, new_val / 1000000, old_avg ); 33 38 return ret; 34 39 }
Note: See TracChangeset
for help on using the changeset viewer.