Changeset c42b8a1 for libcfa/src/concurrency/kernel_private.hfa
- Timestamp:
- Mar 11, 2022, 1:31:58 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 884f3f67
- Parents:
- 3c4bf05
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel_private.hfa
r3c4bf05 rc42b8a1 365 365 void ready_queue_shrink(struct cluster * cltr); 366 366 367 //----------------------------------------------------------------------- 368 // Calc moving average based on existing average, before and current time. 369 static inline unsigned long long moving_average(unsigned long long currtsc, unsigned long long instsc, unsigned long long old_avg) { 370 /* paranoid */ verifyf( currtsc < 45000000000000000, "Suspiciously large current time: %'llu (%llx)\n", currtsc, currtsc ); 371 /* paranoid */ verifyf( instsc < 45000000000000000, "Suspiciously large insert time: %'llu (%llx)\n", instsc, instsc ); 372 /* paranoid */ verifyf( old_avg < 15000000000000, "Suspiciously large previous average: %'llu (%llx)\n", old_avg, old_avg ); 373 374 const unsigned long long new_val = currtsc > instsc ? currtsc - instsc : 0; 375 const unsigned long long total_weight = 16; 376 const unsigned long long new_weight = 4; 377 const unsigned long long old_weight = total_weight - new_weight; 378 const unsigned long long ret = ((new_weight * new_val) + (old_weight * old_avg)) / total_weight; 379 return ret; 380 } 381 382 static const unsigned __readyq_shard_factor = 2; 367 383 368 384 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.