Browse Source

Fix the bouncing short term value by allowing it to change dynamically when the latest value is very different from the rolling value, but damp the change when it gets close.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
8119595498
  1. 20
      main.c

20
main.c

@ -1355,10 +1355,24 @@ static inline int dev_from_id(int thr_id)
return thr_info[thr_id].cgpu->cpu_gpu; return thr_info[thr_id].cgpu->cpu_gpu;
} }
/* Simulate a rolling average by faking an exponential decay over 5 * log */ /* Make the change in the recent value adjust dynamically when the difference
static inline void decay_time(double *f, double fadd) * is large, but damp it when the values are closer together. This allows the
* value to change quickly, but not fluctuate too dramatically when it has
* stabilised. */
static void decay_time(double *f, double fadd)
{ {
*f = (fadd * .37 + *f) / 1.37; double ratio = 0;
if (likely(*f > 0)) {
ratio = fadd / *f;
if (ratio > 1)
ratio = 1 / ratio;
}
if (ratio > 0.9)
*f = (fadd * 0.1 + *f) / 1.1;
else
*f = (fadd + *f * 0.1) / 1.1;
} }
static int requests_staged(void) static int requests_staged(void)

Loading…
Cancel
Save