fiber.top(): alter exponential moving average calculation
When fiber EMA is 0 and first non-zero observation is added to it, we assumed that EMA should be equal to this observation (i.e. average value should be the same as the observed one). This breaks the following invariant: sum of clock EMAs of all fibers equals clock EMA of the thread. If one of the fibers is just spawned and has a big clock delta, it will assign this delta to its EMA, while the thread will calculate the new EMA as 15 * EMA / 16 + delta / 16, which may lead to a situation when fiber EMA is greater than cord EMA. This caused occasional test failures: ``` [001] Test failed! Result content mismatch: [001] --- app/fiber.result Mon Nov 18 17:00:48 2019 [001] +++ app/fiber.reject Mon Nov 18 17:33:10 2019 [001] @@ -1511,7 +1511,7 @@ [001] -- not exact due to accumulated integer division errors [001] sum_avg > 99 and sum_avg < 101 or sum_avg [001] --- [001] -- true [001] +- 187.59585601717 [001] ... [001] tbl = nil [001] --- ``` Follow-up #2694
Loading
Please register or sign in to comment