Why does MicroMeter Timer returns zero?
问题 Consider the following code: public static void main(String[] args) { Timer timer = Metrics.timer("item.processing"); for (int i = 0; i < 100; i++) { timer.record(i, TimeUnit.SECONDS); } System.out.println(timer.count()); System.out.println(timer.mean(TimeUnit.SECONDS)); } The output is zero for both prints, but of course it is expected to be a positive number. I'm using the globalRegistry but I don't think it should make a difference. 回答1: The reason you are seeing the results you're seeing