void () { prevTime = now = 0; final long warmupEnd = System.currentTimeMillis() + 1000; final LongArrayList times = new LongArrayList(); final long end = warmupEnd + 1000; ApplicationManagerEx.getApplicationEx().runProcessWithProgressSynchronously(() -> { final Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, getTestRootDisposable()); ProgressIndicatorEx indicator = (ProgressIndicatorEx)ProgressIndicatorProvider.getGlobalProgressIndicator(); prevTime = System.currentTimeMillis(); assert indicator != null; indicator.addStateDelegate(new ProgressIndicatorStub() { @Override public void checkCanceled() throws ProcessCanceledException { now = System.currentTimeMillis(); if (now > warmupEnd) { int delta = (int)(now - prevTime); times.add(delta); } prevTime = now; } }); while (System.currentTimeMillis() < end) { ProgressManager.checkCanceled(); } alarm.cancelAllRequests(); }, "", false, true, getProject(), null, ""); long averageDelay = ArrayUtil.averageAmongMedians(times.toLongArray(), 5); LOG.debug("averageDelay = " + averageDelay); assertTrue(averageDelay < CoreProgressManager.CHECK_CANCELED_DELAY_MILLIS *3); }