From 6a06cd749a0b8d3d5312ab416a2e91dc23d76fc3 Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Tue, 16 Jul 2019 14:20:45 +0300 Subject: [PATCH] ensure dumps stopped even on recursive edt events GitOrigin-RevId: 31cf07b0685ea5009822ed54a338fc95baa76048 --- .../intellij/diagnostic/PerformanceWatcher.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platform/core-impl/src/com/intellij/diagnostic/PerformanceWatcher.java b/platform/core-impl/src/com/intellij/diagnostic/PerformanceWatcher.java index 4fed7876677a..10a3b29f7e80 100644 --- a/platform/core-impl/src/com/intellij/diagnostic/PerformanceWatcher.java +++ b/platform/core-impl/src/com/intellij/diagnostic/PerformanceWatcher.java @@ -225,6 +225,7 @@ public class PerformanceWatcher implements Disposable { private void edtFrozenPrecise(long start) { myFreezeStart = start; myPublisher.uiFreezeStarted(); + stopDumping(); myDumpTask = myExecutor.scheduleWithFixedDelay(this::dumpThreads, 0, getDumpInterval(), TimeUnit.MILLISECONDS); } @@ -241,12 +242,16 @@ public class PerformanceWatcher implements Disposable { return new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date(timeMs)); } - private void edtResponds(long currentMillis) { - if (myFreezeStart != 0) { - if (myDumpTask != null) { - myDumpTask.cancel(false); - } + private void stopDumping() { + if (myDumpTask != null) { + myDumpTask.cancel(false); + } + } + private void edtResponds(long currentMillis) { + stopDumping(); + + if (myFreezeStart != 0) { int unresponsiveDuration = (int)(currentMillis - myFreezeStart) / 1000; File dir = new File(myLogDir, getFreezeFolderName(myFreezeStart)); File reportDir = null;