Added long to double typecast in addDuration method to increase precision after division operations.
Change-Id: I4cba5661c9b634db86d25b2286e7f9cd4fa84b6c
Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
long newTotal = currentTotal + 1;
// Calculate moving cumulative average.
- double newAve = currentAve * currentTotal / newTotal + duration / newTotal;
+ double newAve = currentAve * (double)currentTotal / (double)newTotal + (double)duration / (double)newTotal;
averageDuration.compareAndSet(currentAve, newAve);
totalDurations.compareAndSet(currentTotal, newTotal);