public CpuDuration elapsedTime() {
    long currentWallTime = System.nanoTime();
    long currentCpuTime = THREAD_MX_BEAN.getCurrentThreadCpuTime();
    long currentUserTime = THREAD_MX_BEAN.getCurrentThreadUserTime();

    return new CpuDuration(
        nanosBetween(wallStartTime, currentWallTime),
        nanosBetween(cpuStartTime, currentCpuTime),
        nanosBetween(userStartTime, currentUserTime));
  }
this class is copied from
https://github.com/airlift/airlift/blob/214/stats/src/main/java/io/airlift/stats/CpuTimer.java as
it doesn't support Java8.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/stats/CpuTimer.java