[statistic] Implement moving average for statistics.