[freeze reports] use monotonic nanoTime instead of currentTimeMillis

GitOrigin-RevId: 198a4f7b22ab7d4e0b3e4267d885456ec7058afc
This commit is contained in:
Egor Ushakov
2019-12-20 14:44:33 +00:00
committed by intellij-monorepo-bot
parent aeb963f21b
commit 964a09d371
@@ -29,7 +29,7 @@ public class SamplingTask {
public SamplingTask(int intervalMs, int maxDurationMs) {
myDumpInterval = intervalMs;
myMaxDumps = maxDurationMs / intervalMs;
myCurrentTime = myStartTime = System.currentTimeMillis();
myCurrentTime = myStartTime = System.nanoTime();
myGcCurrentTime = myGcStartTime = currentGcTime();
myOsAverageLoad = OS_MX_BEAN.getSystemLoadAverage();
ScheduledExecutorService executor = PerformanceWatcher.getInstance().getExecutor();
@@ -37,7 +37,7 @@ public class SamplingTask {
}
private void dumpThreads() {
myCurrentTime = System.currentTimeMillis();
myCurrentTime = System.nanoTime();
myGcCurrentTime = currentGcTime();
ThreadInfo[] infos = ThreadDumper.getThreadInfos(THREAD_MX_BEAN, false);
if (!myFuture.isCancelled()) {
@@ -69,7 +69,7 @@ public class SamplingTask {
}
public long getTotalTime() {
return myCurrentTime - myStartTime;
return TimeUnit.NANOSECONDS.toMillis(myCurrentTime - myStartTime);
}
public long getGcTime() {