Changeset da77728 for libcfa/src


Ignore:
Timestamp:
Sep 29, 2022, 3:23:14 PM (19 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
33e4968e
Parents:
2e94d94f
Message:

Added runtime warning for the leader_spin issue

File:
1 edited

Legend:

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

    r2e94d94f rda77728  
    2121#include <limits.h>
    2222
     23#include "clock.hfa"
     24
    2325//-----------------------------------------------------------------------
    2426// Calc moving average based on existing average, before and current time.
    2527static inline unsigned long long moving_average(unsigned long long currtsc, unsigned long long instsc, unsigned long long old_avg, bool strict) {
    2628        (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 );
    2730
    2831        const unsigned long long new_val = currtsc > instsc ? currtsc - instsc : 0;
     
    3134        const unsigned long long old_weight = total_weight - new_weight;
    3235        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 );
    3338        return ret;
    3439}
Note: See TracChangeset for help on using the changeset viewer.