@Test public void testTime()throws Exception { List<Future> futureList = new ArrayList(); CountDownLatch latch = new CountDownLatch(100); for (int i = 0; i < 100; i++) { futureList.add(executor.submit(() -> { try{ long time = SystemClock.now(); for (long j = 0; j < 100l; j++) { SystemClock.now(); } return SystemClock.now() - time; }finally { latch.countDown(); } })); } latch.await(); long max =0; long total = 0; for (Future<Long> future:futureList){ if (future.isDone()) { long cost = future.get(); if (max < cost) { max = cost; } total += cost; } } System.out.println("max:" + max ); System.out.println("total:" + total); System.out.println("avg:" + total/100.0); }
public static long now() { return instance.getTime(); }
SystemClock { public static long now() { return instance.getTime(); } }
SystemClock { public static long now() { return instance.getTime(); } SystemClock();  SystemClock(long precision); }
SystemClock { public static long now() { return instance.getTime(); } SystemClock();  SystemClock(long precision); static SystemClock getInstance(); long getTime(); static long now(); long precision(); }
SystemClock { public static long now() { return instance.getTime(); } SystemClock();  SystemClock(long precision); static SystemClock getInstance(); long getTime(); static long now(); long precision();  }