optimize getAvgCountOfEachEvent