Changes between Version 9 and Version 10 of CreditStats


Ignore:
Timestamp:
Jun 3, 2008, 9:01:31 PM (16 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CreditStats

    v9 v10  
    3939http://boinc.berkeley.edu/svn/trunk/boinc_stats
    4040}}}
     41
     42== Computing the current value of Recent Average Credit ==
     43BOINC updates 'recent average credit' (RAC) only when new credit is granted. Interfaces that export RAC also export that time at which it was last updated. To obtain the current value of RAC, you must 'decay' it based on the time that has elapsed since it was updated:
     44
     45{{{
     46function decay_average($avg, $avg_time, $now = 0) {
     47   $M_LN2 = 0.693147180559945309417;
     48   $credit_half_life = 86400 * 7;
     49   if ($now == 0) {
     50       $now = time();
     51   }
     52   $diff = $now - $avg_time;
     53   $weight = exp(-$diff * $M_LN2/$credit_half_life);
     54   $avg *= $weight;
     55   return $avg;
     56}
     57}}}
     58If you don't apply this decay, inactive entities will have incorrectly high RAC.
     59
     60PHP code for the decay function can be found in [source:trunk/boinc/html/inc/credit.inc html/inc/credit.inc] and [source:trunk/boinc/html/inc/host.inc html/inc/host.inc].