JitUsageResult () { long timeNow = System.nanoTime(); long jitNow = CpuUsageData.getTotalCompilationMillis(); long elapsedMillis = TimeUnit.NANOSECONDS.toMillis(timeNow - lastJitStamp); if (lastJitStamp >= 0) { if (elapsedMillis >= 3_000) { if (jitNow - lastJitUsage <= elapsedMillis / 10) { return JitUsageResult.DEFINITELY_LOW; } } else { // don't update stamps too frequently, // because JIT times are quite discrete: they only change after a compilation is finished, // and some compilations take a second or even more return JitUsageResult.UNCLEAR; } } lastJitStamp = timeNow; lastJitUsage = jitNow; return JitUsageResult.UNCLEAR; }