diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/JavaCommentByLineTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/JavaCommentByLineTest.java index 716ffeb7f215..0a88e5aab7fa 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/JavaCommentByLineTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/JavaCommentByLineTest.java @@ -131,8 +131,8 @@ public class JavaCommentByLineTest extends CommentByLineTestBase { source.append("}"); configureFromFileText(getTestName(false) + ".java", source.toString()); executeAction(IdeActions.ACTION_SELECT_ALL); - PlatformTestUtil.startPerformanceTest("Uncommenting large file", CommentByLineTestBase::performAction) + PlatformTestUtil.newPerformanceTest("Uncommenting large file", CommentByLineTestBase::performAction) .setup(CommentByLineTestBase::performAction) - .assertTiming(); + .start(); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerformanceTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerformanceTest.java index 0412a7db37e3..c388dbe76810 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerformanceTest.java @@ -54,13 +54,13 @@ public class DaemonRespondToChangesPerformanceTest extends DaemonAnalyzerTestCas text.append(".toString();}"); configureByText(JavaFileType.INSTANCE, text.toString()); - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { List infos = highlightErrors(); assertEmpty(infos); type("k"); assertNotEmpty(highlightErrors()); backspace(); - }).assertTiming(); + }).start(); } public void testExpressionListsWithManyStringLiteralsHighlightingPerformance() { @@ -75,14 +75,14 @@ public class DaemonRespondToChangesPerformanceTest extends DaemonAnalyzerTestCas PlatformTestUtil.maskExtensions(MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME, getProject(), Collections.emptyList(), getTestRootDisposable()); ExtensionTestUtil.maskExtensions(LanguageInjector.EXTENSION_POINT_NAME, Collections.emptyList(), getTestRootDisposable()); ExtensionTestUtil.maskExtensions(new ExtensionPointName<>(LanguageAnnotators.INSTANCE.getName()), Collections.emptyList(), getTestRootDisposable()); - PlatformTestUtil.startPerformanceTest("highlighting many string literals", () -> { + PlatformTestUtil.newPerformanceTest("highlighting many string literals", () -> { assertEmpty(highlightErrors()); type("k"); assertNotEmpty(highlightErrors()); backspace(); - }).assertTiming(); + }).start(); } public void testPerformanceOfHighlightingLongCallChainWithHierarchyAndGenerics() { @@ -97,14 +97,14 @@ public class DaemonRespondToChangesPerformanceTest extends DaemonAnalyzerTestCas ".toString(); } }"; configureByText(JavaFileType.INSTANCE, text); - PlatformTestUtil.startPerformanceTest("highlighting deep call chain", () -> { + PlatformTestUtil.newPerformanceTest("highlighting deep call chain", () -> { assertEmpty(highlightErrors()); type("k"); assertNotEmpty(highlightErrors()); backspace(); - }).assertTiming(); + }).start(); } public void testReactivityPerformance() throws Throwable { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsagePerformanceTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsagePerformanceTest.java index 411571c026b6..9b5b326bf330 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsagePerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsagePerformanceTest.java @@ -10,12 +10,12 @@ import com.intellij.testFramework.SkipSlowTestLocally; public class CreateMethodFromUsagePerformanceTest extends LightQuickFixTestCase { public void testWithHugeNumberOfParameters() { - PlatformTestUtil.startPerformanceTest("5000 args for a new method", () -> { + PlatformTestUtil.newPerformanceTest("5000 args for a new method", () -> { String text = "class Foo {{ foo(" + StringUtil.repeat("\"a\", ", 5000) + " \"a\");}}"; configureFromFileText("Foo.java", text); doAction("Create method 'foo' in 'Foo'"); }) - .assertTiming(); + .start(); } @Override diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/JoinLinesPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/JoinLinesPerformanceTest.java index 769c7f2e08c1..311600832753 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/JoinLinesPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/JoinLinesPerformanceTest.java @@ -5,7 +5,6 @@ import com.intellij.JavaTestUtil; import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.testFramework.LightJavaCodeInsightTestCase; import com.intellij.testFramework.PlatformTestUtil; -import com.intellij.util.ThrowableRunnable; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -27,9 +26,9 @@ public class JoinLinesPerformanceTest extends LightJavaCodeInsightTestCase { }"""; String inputText = text.replace("$bytes$", bytesOriginal); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> executeAction(IdeActions.ACTION_EDITOR_JOIN_LINES)) + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> executeAction(IdeActions.ACTION_EDITOR_JOIN_LINES)) .setup(() -> configureFromFileText("X.java", inputText)) - .assertTiming(); + .start(); String outputText = text.replace("$bytes$", bytesResult); checkResultByText(outputText); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/NormalCompletionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/NormalCompletionTest.java index 31bd386efbcb..82e51f825c5a 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/NormalCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/NormalCompletionTest.java @@ -2316,7 +2316,7 @@ public class NormalCompletionTest extends NormalCompletionTestCase { "localVx }" + "}"; myFixture.configureByText("a.java", text); - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { assertEquals(1, myFixture.completeBasic().length); }).setup(() -> { LookupImpl lookup = getLookup(); @@ -2324,7 +2324,7 @@ public class NormalCompletionTest extends NormalCompletionTestCase { myFixture.type("\bV"); getPsiManager().dropPsiCaches(); assertNull(getLookup()); - }).assertTiming(); + }).start(); } public void testPerformanceWithManyMatchingStaticallyImportedDeclarations() { @@ -2336,7 +2336,7 @@ public class NormalCompletionTest extends NormalCompletionTestCase { "}"; myFixture.addClass(constantClass); myFixture.configureByText("a.java", "import static Constants.*; class C { { fieldx } }"); - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { int length = myFixture.completeBasic().length; assertTrue(String.valueOf(length), length > 100); }).setup(() -> { @@ -2345,7 +2345,7 @@ public class NormalCompletionTest extends NormalCompletionTestCase { myFixture.type("\bd"); getPsiManager().dropPsiCaches(); assertNull(getLookup()); - }).assertTiming(); + }).start(); } public void testNoExceptionsWhenCompletingInapplicableClassNameAfterNew() { doTest("\n"); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SecondSmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SecondSmartTypeCompletionTest.java index b69a5f2bd3c1..b5b000a5bf99 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SecondSmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SecondSmartTypeCompletionTest.java @@ -114,14 +114,14 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas public void testChainingPerformance() throws Throwable { myFixture.configureByFile(getTestName(false) + ".java"); - PlatformTestUtil.startPerformanceTest(getTestName(false), new ThrowableRunnable() { + PlatformTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() { @Override public void run() throws Exception { configure(); assertNotNull(myItems); LookupManager.getInstance(getProject()).hideActiveLookup(); } - }).assertTiming(); + }).start(); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java index 28f66a8c00e8..0ab823ff7c9d 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java @@ -67,9 +67,9 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest assertNotNull(getFile().getText()); //to load text CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject()); - PlatformTestUtil.startPerformanceTest(getTestName(false), this::doHighlighting) + PlatformTestUtil.newPerformanceTest(getTestName(false), this::doHighlighting) .setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches()) - .assertTiming(); + .start(); } public void testAThinlet() { @@ -120,7 +120,7 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest assertNotNull(ProjectCoreUtil.theOnlyOpenProject()); getFile().accept(new PsiRecursiveElementVisitor() {}); Project myProject = getProject(); - PlatformTestUtil.startPerformanceTest("getProject() for nested elements", () -> { + PlatformTestUtil.newPerformanceTest("getProject() for nested elements", () -> { for (int k=0; k<5; k++) { getFile().accept(new PsiRecursiveElementVisitor() { int c; @@ -136,6 +136,6 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest } }); } - }).assertTiming(); + }).start(); } } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/RecursiveVisitorTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/RecursiveVisitorTest.java index 2ca84f070834..db4bee17c053 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/RecursiveVisitorTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/RecursiveVisitorTest.java @@ -21,7 +21,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase { final PsiElement expression = JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text.toString(), null); final int[] n = {0}; - PlatformTestUtil.startPerformanceTest(getTestName(false), new ThrowableRunnable() { + PlatformTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() { @Override public void run() { n[0] = 0; @@ -36,7 +36,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase { }); assertEquals(N+2, n[0]); } - }).assertTiming(); + }).start(); } public void testHugeMethodChainingVisitingPerformance() throws IncorrectOperationException { StringBuilder text = new StringBuilder("Object s = new StringBuilder()"); @@ -48,7 +48,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase { final PsiElement expression = JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text.toString(), null); final int[] n = {0}; - PlatformTestUtil.startPerformanceTest(getTestName(false), new ThrowableRunnable() { + PlatformTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() { @Override public void run() { n[0] = 0; @@ -61,7 +61,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase { }); assertEquals(N, n[0]); } - }).assertTiming(); + }).start(); } public void testStopWalking() { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/indentGuide/JavaTextBlockIndentGuidePerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/indentGuide/JavaTextBlockIndentGuidePerformanceTest.java index 9570d09233eb..faca01f92b65 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/indentGuide/JavaTextBlockIndentGuidePerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/indentGuide/JavaTextBlockIndentGuidePerformanceTest.java @@ -24,9 +24,9 @@ public class JavaTextBlockIndentGuidePerformanceTest extends LightDaemonAnalyzer String text = "class X {\n" + createCodeBlocks(n, nLines) + "\n}"; - PlatformTestUtil.startPerformanceTest(getTestName(false), this::doHighlighting) + PlatformTestUtil.newPerformanceTest(getTestName(false), this::doHighlighting) .setup(() -> configureFromFileText("X.java", text)) - .assertTiming(); + .start(); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/InferencePerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/InferencePerformanceTest.java index a573ad9bbcfa..ca94aaa67788 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/InferencePerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/InferencePerformanceTest.java @@ -32,19 +32,19 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase { @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/performance"; public void testPolyMethodCallArgumentPassedToVarargs() { - PlatformTestUtil.startPerformanceTest("50 poly method calls passed to Arrays.asList", this::doTest).assertTiming(); + PlatformTestUtil.newPerformanceTest("50 poly method calls passed to Arrays.asList", this::doTest).start(); } public void testDiamondConstructorCallPassedToVarargs() { - PlatformTestUtil.startPerformanceTest("50 diamond constructor calls passed to Arrays.asList", this::doTest).assertTiming(); + PlatformTestUtil.newPerformanceTest("50 diamond constructor calls passed to Arrays.asList", this::doTest).start(); } public void testDiamondConstructorCallPassedToEnumConstantWithVarargs() { - PlatformTestUtil.startPerformanceTest("10 enum constants with vararg diamonds", this::doTest).assertTiming(); + PlatformTestUtil.newPerformanceTest("10 enum constants with vararg diamonds", this::doTest).start(); } public void testLeastUpperBoundWithLotsOfSupers() { - PlatformTestUtil.startPerformanceTest("7 unrelated intersection conjuncts", this::doTest).assertTiming(); + PlatformTestUtil.newPerformanceTest("7 unrelated intersection conjuncts", this::doTest).start(); } public void testVarArgPoly() { @@ -66,24 +66,24 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase { int count = 70; String entries = IntStreamEx.range(count).mapToObj(i -> "entry(" + i + ", String.class)").joining(",\n "); configureFromFileText("Test.java", template.replace("$entries$", entries)); - PlatformTestUtil.startPerformanceTest(count + " arguments to Map.ofEntries", () -> doHighlighting()) + PlatformTestUtil.newPerformanceTest(count + " arguments to Map.ofEntries", () -> doHighlighting()) .setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches()) - .assertTiming(); + .start(); assertEmpty(highlightErrors()); } public void testLongQualifierChainInsideLambda() { - PlatformTestUtil.startPerformanceTest("long qualifier chain", this::doTest).assertTiming(); + PlatformTestUtil.newPerformanceTest("long qualifier chain", this::doTest).start(); } public void testLongQualifierChainInsideLambdaWithOverloads() { - PlatformTestUtil.startPerformanceTest("long qualifier chain", () -> { + PlatformTestUtil.newPerformanceTest("long qualifier chain", () -> { configureByFile(BASE_PATH + "/" + getTestName(false) + ".java"); PsiMethodCallExpression callExpression = PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiMethodCallExpression.class); assertNotNull(callExpression); assertNotNull(callExpression.getText(), callExpression.getType()); - }).assertTiming(); + }).start(); } public void testLongQualifierChainInsideLambdaInTypeCast() { @@ -117,9 +117,9 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase { String entries = "foo(snippet.valueOf(foo))\n" +//to trick injection StringUtil.repeat(".foo(snippet.valueOf(foo))\n", count); configureFromFileText("Test.java", template.replace("$chain$", entries)); - PlatformTestUtil.startPerformanceTest(count + " chain in type cast", () -> doHighlighting()) + PlatformTestUtil.newPerformanceTest(count + " chain in type cast", () -> doHighlighting()) .setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches()) - .assertTiming(); + .start(); assertEmpty(highlightErrors()); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java index 676e62ca4716..65823c4533c6 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java @@ -86,11 +86,11 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase { } public void testManyOverloadsWithVarargs() { - PlatformTestUtil.startPerformanceTest("Overload resolution with 14 overloads", () -> doTest(false)).assertTiming(); + PlatformTestUtil.newPerformanceTest("Overload resolution with 14 overloads", () -> doTest(false)).start(); } public void testConstructorOverloadsWithDiamonds() { - PlatformTestUtil.startPerformanceTest("Overload resolution with chain constructor calls with diamonds", () -> doTest(false)).assertTiming(); + PlatformTestUtil.newPerformanceTest("Overload resolution with chain constructor calls with diamonds", () -> doTest(false)).start(); } public void testMultipleOverloadsWithNestedGeneric() { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/psi/ControlFlowPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/psi/ControlFlowPerformanceTest.java index b7e500914e97..d573f38da60c 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/psi/ControlFlowPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/psi/ControlFlowPerformanceTest.java @@ -12,12 +12,12 @@ import one.util.streamex.StreamEx; public class ControlFlowPerformanceTest extends LightJavaCodeInsightTestCase { public void testHugeMethodChainControlFlow() { - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { int size = 2500; String source = StreamEx.constant(".toString()", size).joining("", "\"\"", ""); PsiExpression expression = JavaPsiFacade.getElementFactory(getProject()).createExpressionFromText(source, null); ControlFlow flow = ControlFlowFactory.getInstance(getProject()).getControlFlow(expression, new LocalsControlFlowPolicy(expression), false); assertEquals(size, flow.getSize()); - }).attempts(2).assertTiming(); + }).attempts(2).start(); } } diff --git a/java/java-tests/testSrc/com/intellij/java/execution/filters/ConsoleViewExceptionFilterPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/execution/filters/ConsoleViewExceptionFilterPerformanceTest.java index 699d2a6fb22b..2e7b8f911983 100644 --- a/java/java-tests/testSrc/com/intellij/java/execution/filters/ConsoleViewExceptionFilterPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/execution/filters/ConsoleViewExceptionFilterPerformanceTest.java @@ -43,7 +43,7 @@ public class ConsoleViewExceptionFilterPerformanceTest extends LightJavaCodeInsi } } }"""); - PlatformTestUtil.startPerformanceTest("Many exceptions", () -> { + PlatformTestUtil.newPerformanceTest("Many exceptions", () -> { // instantiate console with exception filters only to avoid failures due to Node/Ruby/etc dog-slow sloppy regex-based filters TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(getProject()); consoleBuilder.filters(ExceptionFilters.getFilters(GlobalSearchScope.allScope(getProject()))); @@ -75,6 +75,6 @@ public class ConsoleViewExceptionFilterPerformanceTest extends LightJavaCodeInsi finally { Disposer.dispose(console); } - }).assertTiming(); + }).start(); } } diff --git a/java/java-tests/testSrc/com/intellij/java/find/FindInEditorTest.java b/java/java-tests/testSrc/com/intellij/java/find/FindInEditorTest.java index 5fae8007455f..8acf6b3c9fe8 100644 --- a/java/java-tests/testSrc/com/intellij/java/find/FindInEditorTest.java +++ b/java/java-tests/testSrc/com/intellij/java/find/FindInEditorTest.java @@ -326,7 +326,7 @@ public class FindInEditorTest extends LightPlatformCodeInsightTestCase { myFindModel.setReplaceState(true); myFindModel.setPromptOnReplace(false); - PlatformTestUtil.startPerformanceTest("replace", ()->{ + PlatformTestUtil.newPerformanceTest("replace", ()->{ for (int i=0; i<25; i++) { myFindModel. setStringToFind(aas); myFindModel.setStringToReplace(bbs); @@ -337,7 +337,7 @@ public class FindInEditorTest extends LightPlatformCodeInsightTestCase { FindUtil.replace(editor.getProject(), editor, 0, myFindModel); assertEquals(text, editor.getDocument().getText()); } - }).assertTiming(); + }).start(); } finally { EditorFactory.getInstance().releaseEditor(editor); diff --git a/java/java-tests/testSrc/com/intellij/java/navigation/GotoImplementationHandlerTest.java b/java/java-tests/testSrc/com/intellij/java/navigation/GotoImplementationHandlerTest.java index 66a282d48e4e..e76624315501 100644 --- a/java/java-tests/testSrc/com/intellij/java/navigation/GotoImplementationHandlerTest.java +++ b/java/java-tests/testSrc/com/intellij/java/navigation/GotoImplementationHandlerTest.java @@ -94,10 +94,10 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas final PsiFile file = myFixture.addFileToProject("Foo.java", fileText); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { PsiElement[] impls = getTargets(file); assertEquals(3, impls.length); - }).assertTiming(); + }).start(); } public void testToStringOnQualifiedPerformance() { @@ -125,10 +125,10 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas final PsiFile file = myFixture.addFileToProject("Foo.java", fileText); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { PsiElement[] impls = getTargets(file); assertEquals(3, impls.length); - }).assertTiming(); + }).start(); } public void testShowSelfNonAbstract() { diff --git a/java/java-tests/testSrc/com/intellij/java/psi/JavaReparseTest.java b/java/java-tests/testSrc/com/intellij/java/psi/JavaReparseTest.java index c81693de23c9..d9690f7dff0a 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/JavaReparseTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/JavaReparseTest.java @@ -293,7 +293,7 @@ public class JavaReparseTest extends AbstractReparseTestCase { Document document = pdm.getDocument(file); WriteCommandAction.runWriteCommandAction(getProject(), () -> { - PlatformTestUtil.startPerformanceTest("deep reparse", () -> { + PlatformTestUtil.newPerformanceTest("deep reparse", () -> { document.insertString(document.getTextLength() - suffix.length(), call1); pdm.commitDocument(document); @@ -302,7 +302,7 @@ public class JavaReparseTest extends AbstractReparseTestCase { document.insertString(document.getTextLength() - suffix.length(), "\n"); pdm.commitDocument(document); - }).assertTiming(); + }).start(); PsiTestUtil.checkFileStructure(file); }); diff --git a/java/java-tests/testSrc/com/intellij/java/psi/JavaStubBuilderTest.java b/java/java-tests/testSrc/com/intellij/java/psi/JavaStubBuilderTest.java index 0116f682003c..2bc4a202fa3a 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/JavaStubBuilderTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/JavaStubBuilderTest.java @@ -831,7 +831,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase { String text = FileUtil.loadFile(new File(path)); PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", text); String message = "Source file size: " + text.length(); - PlatformTestUtil.startPerformanceTest(message, () -> myBuilder.buildStubTree(file)).assertTiming(); + PlatformTestUtil.newPerformanceTest(message, () -> myBuilder.buildStubTree(file)).start(); } private void doTest(/*@Language("JAVA")*/ String source, @Language("TEXT") String expected) { diff --git a/java/java-tests/testSrc/com/intellij/java/psi/codeStyle/autodetect/JavaAutoDetectIndentPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/psi/codeStyle/autodetect/JavaAutoDetectIndentPerformanceTest.java index 830788db87ae..8677b4e60296 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/codeStyle/autodetect/JavaAutoDetectIndentPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/codeStyle/autodetect/JavaAutoDetectIndentPerformanceTest.java @@ -63,8 +63,8 @@ public class JavaAutoDetectIndentPerformanceTest extends AbstractIndentAutoDetec detectIndentOptions(getVFile(), getEditor().getDocument()); PlatformTestUtil - .startPerformanceTest("Detecting indent on hot file", () -> detectIndentOptions(getVFile(), getEditor().getDocument())) - .assertTiming(); + .newPerformanceTest("Detecting indent on hot file", () -> detectIndentOptions(getVFile(), getEditor().getDocument())) + .start(); } public void testBigOneLineFile() { diff --git a/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaEnterActionTest.java b/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaEnterActionTest.java index 130508b16884..59516ec2b16f 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaEnterActionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaEnterActionTest.java @@ -1131,11 +1131,11 @@ public class JavaEnterActionTest extends AbstractBasicJavaEnterActionTest { public void testPerformance() { configureByFile("/codeInsight/enterAction/Performance.java"); - PlatformTestUtil.startPerformanceTest("enter in " + getFile(), () -> { + PlatformTestUtil.newPerformanceTest("enter in " + getFile(), () -> { performAction(); deleteLine(); caretUp(); - }).assertTiming(); + }).start(); } @@ -1145,6 +1145,6 @@ public class JavaEnterActionTest extends AbstractBasicJavaEnterActionTest { " u." + StringUtil.repeat("\n a('b').c(new Some()).", 500)) + "\n" + " x(); } }"); - PlatformTestUtil.startPerformanceTest("enter", this::performAction).assertTiming(); + PlatformTestUtil.newPerformanceTest("enter", this::performAction).start(); } } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaFormatterPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaFormatterPerformanceTest.java index 654af963558d..42f1256dcc71 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaFormatterPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaFormatterPerformanceTest.java @@ -45,23 +45,23 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase { FormatterImpl formatter = (FormatterImpl)FormatterEx.getInstanceEx(); CommonCodeStyleSettings.IndentOptions options = settings.getIndentOptions(JavaFileType.INSTANCE); - PlatformTestUtil.startPerformanceTest("Java Formatting [1]", () -> { + PlatformTestUtil.newPerformanceTest("Java Formatting [1]", () -> { FormattingModel model = LanguageFormatting.INSTANCE.forContext(file).createModel(FormattingContext.create(file, settings)); formatter.formatWithoutModifications(model.getDocumentModel(), model.getRootBlock(), settings, options, file.getTextRange()); }) .warmupIterations(50) .attempts(200) - .assertTiming(); + .start(); // attempt.min.ms varies ~3% (from experiments) } public void testPerformance2() { getSettings().setDefaultRightMargin(120); - PlatformTestUtil.startPerformanceTest("Java Formatting [2]", () -> doTest()) + PlatformTestUtil.newPerformanceTest("Java Formatting [2]", () -> doTest()) .warmupIterations(5) .attempts(20) - .assertTiming(); + .start(); // attempt.min.ms varies ~50% (from experiments) } @@ -76,10 +76,10 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase { indentOptions.USE_TAB_CHARACTER = true; indentOptions.TAB_SIZE = 4; - PlatformTestUtil.startPerformanceTest("Java Formatting [3]", () -> doTest()) + PlatformTestUtil.newPerformanceTest("Java Formatting [3]", () -> doTest()) .warmupIterations(100) .attempts(300) - .assertTiming(); + .start(); // attempt.min.ms varies ~5% (from experiments) } diff --git a/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaSmartReformatPerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaSmartReformatPerformanceTest.java index f92c3f2b82cd..728ed6563747 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaSmartReformatPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/formatter/performance/JavaSmartReformatPerformanceTest.java @@ -7,16 +7,12 @@ import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.Document; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.util.ThrowableRunnable; -import java.util.Collections; -import java.util.List; - public class JavaSmartReformatPerformanceTest extends AbstractJavaFormatterTest { public void testSmartReformatPerformanceInLargeFile_AsUsedInPostponedFormatting() { Project project = getProject(); @@ -42,11 +38,11 @@ public class JavaSmartReformatPerformanceTest extends AbstractJavaFormatterTest }; PlatformTestUtil - .startPerformanceTest("smart reformat on big file", test) + .newPerformanceTest("smart reformat on big file", test) .setup(setup) .warmupIterations(50) .attempts(100) - .assertTiming(); + .start(); // attempt.min.ms varies below the measurement threshold } } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/psi/resolve/ResolvePerformanceTest.java b/java/java-tests/testSrc/com/intellij/java/psi/resolve/ResolvePerformanceTest.java index a50875753dca..5dca8edbf642 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/resolve/ResolvePerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/resolve/ResolvePerformanceTest.java @@ -106,10 +106,10 @@ public class ResolvePerformanceTest extends JavaResolveTestCase { PsiReference ref = configureByFile("class/" + getTestName(false) + ".java"); ensureIndexUpToDate(); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> assertNull(ref.resolve())) + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> assertNull(ref.resolve())) .warmupIterations(20) .attempts(50) - .assertTiming(); + .start(); // attempt.min.ms varies below the measurement threshold } @@ -131,7 +131,7 @@ public class ResolvePerformanceTest extends JavaResolveTestCase { List refs = SyntaxTraverser.psiTraverser(file).filter(PsiJavaCodeReferenceElement.class).toList(); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (PsiJavaCodeReferenceElement ref : refs) { assertNotNull(ref.resolve()); } @@ -139,7 +139,7 @@ public class ResolvePerformanceTest extends JavaResolveTestCase { .setup(getPsiManager()::dropPsiCaches) .warmupIterations(100) .attempts(500) - .assertTiming(); + .start(); // attempt.min.ms varies ~7% (from experiments) } @@ -173,22 +173,22 @@ public class ResolvePerformanceTest extends JavaResolveTestCase { } ensureIndexUpToDate(); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> assertNull(ref.resolve())) + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> assertNull(ref.resolve())) .warmupIterations(20) .attempts(50) - .assertTiming(); + .start(); // attempt.min.ms varies below the measurement threshold } public void testLongIdentifierDotChain() { - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { PsiFile file = createDummyFile("a.java", "class C { { " + StringUtil.repeat("obj.", 100) + "foo } }"); PsiReference ref = file.findReferenceAt(file.getText().indexOf("foo")); assertNull(ref.resolve()); }) .warmupIterations(100) .attempts(300) - .assertTiming(); + .start(); // attempt.min.ms varies below the measurement threshold } } diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java index de40e1c63c4a..00e66d1e902f 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java @@ -682,7 +682,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase { final Document document = file.getViewProvider().getDocument(); assertNotNull(document); - WriteAction.run(() -> PlatformTestUtil.startPerformanceTest("smart pointer range update", () -> { + WriteAction.run(() -> PlatformTestUtil.newPerformanceTest("smart pointer range update", () -> { for (int i = 0; i < 10000; i++) { document.insertString(i * 20 + 100, "x\n"); assertFalse(PsiDocumentManager.getInstance(myProject).isCommitted(document)); @@ -691,7 +691,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase { }).setup(() -> { document.setText(text); assertEquals(range, pointer.getRange()); - }).assertTiming()); + }).start()); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); assertEquals(range, pointer.getRange()); @@ -882,7 +882,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase { XmlFile file = (XmlFile)createFile("a.xml", "\n" + StringUtil.repeat(eachTag, 500) + ""); List tags = new ArrayList<>(PsiTreeUtil.findChildrenOfType(file.getDocument(), XmlTag.class)); List pointers = ContainerUtil.map(tags, this::createPointer); - ApplicationManager.getApplication().runWriteAction(() -> PlatformTestUtil.startPerformanceTest("smart pointer range update after PSI change", () -> { + ApplicationManager.getApplication().runWriteAction(() -> PlatformTestUtil.newPerformanceTest("smart pointer range update after PSI change", () -> { for (int i = 0; i < tags.size(); i++) { XmlTag tag = tags.get(i); SmartPsiElementPointer pointer = pointers.get(i); @@ -894,7 +894,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase { assertEquals(tag.getName().length(), TextRange.create(pointer.getPsiRange()).getLength()); } PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting(); - }).assertTiming()); + }).start()); } @NotNull @@ -949,7 +949,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase { String text = StringUtil.repeatSymbol(' ', 100000); PsiFile file = createFile("a.txt", text); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { List pointers = new ArrayList<>(); for (int i = 0; i < text.length() - 1; i++) { pointers.add(getPointerManager().createSmartPsiFileRangePointer(file, new TextRange(i, i + 1))); @@ -958,7 +958,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase { for (SmartPsiFileRange pointer : pointers) { getPointerManager().removePointer(pointer); } - }).assertTiming(); + }).start(); } public void testDifferentHashCodesForDifferentElementsInOneFile() throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java index f52bba83fc6d..1c4de84c7e44 100644 --- a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java @@ -407,12 +407,12 @@ public class RootsChangedTest extends JavaModuleTestCase { VirtualFile xxx = createChildDirectory(temp, dirName); - PlatformTestUtil.startPerformanceTest("time wasted in ProjectRootManagerComponent.before/afterValidityChanged()", ()->{ + PlatformTestUtil.newPerformanceTest("time wasted in ProjectRootManagerComponent.before/afterValidityChanged()", ()->{ for (int i = 0; i < 100; i++) { rename(xxx, "yyy"); rename(xxx, dirName); } - }).assertTiming(); + }).start(); } // create ".idea" - based project because it's 1) needed for testShelveChangesMustNotLeadToRootsChangedEvent and 2) is more common diff --git a/java/java-tests/testSrc/com/intellij/unscramble/ThreadDumpParserTest.groovy b/java/java-tests/testSrc/com/intellij/unscramble/ThreadDumpParserTest.groovy index c8cc41d08633..aff064b0485f 100644 --- a/java/java-tests/testSrc/com/intellij/unscramble/ThreadDumpParserTest.groovy +++ b/java/java-tests/testSrc/com/intellij/unscramble/ThreadDumpParserTest.groovy @@ -373,14 +373,14 @@ Thread 7381: (state = BLOCKED) void "test very long line parsing performance"() { def spaces = ' ' * 1_000_000 def letters = 'a' * 1_000_000 - PlatformTestUtil.startPerformanceTest('parsing spaces', { + PlatformTestUtil.newPerformanceTest('parsing spaces', { def threads = ThreadDumpParser.parse(spaces) assert threads.empty - }).assertTimingAsSubtest() + }).startAsSubtest() - PlatformTestUtil.startPerformanceTest('parsing letters', { + PlatformTestUtil.newPerformanceTest('parsing letters', { def threads = ThreadDumpParser.parse(letters) assert threads.empty - }).assertTimingAsSubtest() + }).startAsSubtest() } } diff --git a/java/java-tests/testSrc/com/intellij/util/indexing/IndexTest.java b/java/java-tests/testSrc/com/intellij/util/indexing/IndexTest.java index acc23e3d99ec..0f0a08c79341 100644 --- a/java/java-tests/testSrc/com/intellij/util/indexing/IndexTest.java +++ b/java/java-tests/testSrc/com/intellij/util/indexing/IndexTest.java @@ -965,7 +965,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { final String filename = "A.java"; myFixture.addFileToProject("foo/bar/" + filename, "class A {}"); - PlatformTestUtil.startPerformanceTest("Vfs Event Processing By Index", () -> { + PlatformTestUtil.newPerformanceTest("Vfs Event Processing By Index", () -> { PsiFile[] files = FilenameIndex.getFilesByName(getProject(), filename, GlobalSearchScope.moduleScope(getModule())); assertEquals(1, files.length); @@ -991,7 +991,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase { files = FilenameIndex.getFilesByName(getProject(), filename, GlobalSearchScope.moduleScope(getModule())); assertEquals(1, files.length); - }).assertTiming(); + }).start(); } public void test_class_file_in_src_content_isn_t_returned_from_index() throws IOException { diff --git a/json/tests/test/com/intellij/json/JsonFormattingTest.java b/json/tests/test/com/intellij/json/JsonFormattingTest.java index 51d1bebedbcd..a2855a0270cf 100644 --- a/json/tests/test/com/intellij/json/JsonFormattingTest.java +++ b/json/tests/test/com/intellij/json/JsonFormattingTest.java @@ -99,7 +99,7 @@ public class JsonFormattingTest extends JsonTestCase { public void testHugeJsonFile() { // IDEA-195340 bad JSON kills IntelliJ myFixture.configureByFile(getTestName(false) + ".json"); - PlatformTestUtil.startPerformanceTest(getTestName(false), this::reformatAndCheck).attempts(1).assertTiming(); + PlatformTestUtil.newPerformanceTest(getTestName(false), this::reformatAndCheck).attempts(1).start(); } private void doTest() { diff --git a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java index 7ec3725a306f..6b197e03e1e2 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java @@ -20,7 +20,6 @@ import org.junit.Assert; import java.io.File; import java.io.IOException; import java.util.Collections; -import java.util.concurrent.TimeUnit; import static com.jetbrains.jsonSchema.JsonSchemaHighlightingTestBase.registerJsonSchema; @@ -74,14 +73,14 @@ public class JsonSchemaPerformanceTest extends JsonSchemaHeavyAbstractTest { myFixture.doHighlighting(); } }); - PlatformTestUtil.startPerformanceTest(getTestName(false), test).assertTiming(); + PlatformTestUtil.newPerformanceTest(getTestName(false), test).start(); } public void testEslintHighlightingPerformance() { myFixture.configureByFile(getTestName(true) + "/.eslintrc.json"); PsiFile psiFile = myFixture.getFile(); - PlatformTestUtil.startPerformanceTest(getTestName(true), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(true), () -> { for (int i = 0; i < 10; i++) { myFixture.doHighlighting(); @@ -101,6 +100,6 @@ public class JsonSchemaPerformanceTest extends JsonSchemaHeavyAbstractTest { WriteCommandAction.runWriteCommandAction(getProject(), (Runnable)() -> camelcase.getValue().replace(a.getValue())); myFixture.doHighlighting(); } - }).assertTiming(); + }).start(); } } diff --git a/json/tests/test/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManagerTest.java b/json/tests/test/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManagerTest.java index cbb80f962c78..296c699a2663 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManagerTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManagerTest.java @@ -55,12 +55,12 @@ public class JsonSchemaCatalogManagerTest extends BasePlatformTestCase { VirtualFile file = myFixture.addFileToProject("some/unknown.json", "").getVirtualFile(); VirtualFile schemaFile = myCatalogManager.getSchemaFileForFile(file); Assert.assertNull(schemaFile); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (int i = 0; i < 1000000; i++) { VirtualFile result = myCatalogManager.getSchemaFileForFile(file); Assert.assertNull(result); } - }).assertTiming(); + }).start(); } private void doTest(@NotNull String filePath, @Nullable String expectedSchemaUrl) { diff --git a/platform/diff-impl/tests/testSrc/com/intellij/diff/util/DiffPerformanceTest.kt b/platform/diff-impl/tests/testSrc/com/intellij/diff/util/DiffPerformanceTest.kt index 3ff0d415f3c3..407d998d9b73 100644 --- a/platform/diff-impl/tests/testSrc/com/intellij/diff/util/DiffPerformanceTest.kt +++ b/platform/diff-impl/tests/testSrc/com/intellij/diff/util/DiffPerformanceTest.kt @@ -220,10 +220,10 @@ class DiffPerformanceTest : TestCase() { private inline fun testCpu(iterations: Int, crossinline test: () -> Unit) { - PlatformTestUtil.startPerformanceTest(PlatformTestUtil.getTestName(name, true)) { + PlatformTestUtil.newPerformanceTest(PlatformTestUtil.getTestName(name, true)) { for (i in 0..iterations) { test() } - }.assertTiming() + }.start() } } diff --git a/platform/lang-impl/testSources/com/intellij/find/FindInEditorPerformanceTest.java b/platform/lang-impl/testSources/com/intellij/find/FindInEditorPerformanceTest.java index f243de550e7e..a5d56bf34b91 100644 --- a/platform/lang-impl/testSources/com/intellij/find/FindInEditorPerformanceTest.java +++ b/platform/lang-impl/testSources/com/intellij/find/FindInEditorPerformanceTest.java @@ -11,10 +11,10 @@ public class FindInEditorPerformanceTest extends AbstractFindInEditorTest { setTextToFind("s"); assertEquals(9999 + 1 /* cursor highlighting */, getEditor().getMarkupModel().getAllHighlighters().length); getEditor().getCaretModel().moveToOffset(0); - PlatformTestUtil.startPerformanceTest("typing in editor when a lot of search results are highlighted", () -> { + PlatformTestUtil.newPerformanceTest("typing in editor when a lot of search results are highlighted", () -> { for (int i = 0; i < 100; i++) { myFixture.type(' '); } - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEditingTest.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEditingTest.java index 57d5950b3933..db6fb7e31fe1 100644 --- a/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEditingTest.java +++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEditingTest.java @@ -301,13 +301,13 @@ public class PlainTextEditingTest extends EditingTestBase { public void testCalculatingLongLinesPositionPerformanceInEditorWithNoTabs() { final String longLine = StringUtil.repeatSymbol(' ', 1000000); configureFromFileText("x.txt", longLine); - PlatformTestUtil.startPerformanceTest("calcOffset", () -> { + PlatformTestUtil.newPerformanceTest("calcOffset", () -> { for (int i = 0; i < 1000; i++) { int off = getEditor().logicalPositionToOffset(new LogicalPosition(0, longLine.length() - 1)); assertEquals(longLine.length() - 1, off); int col = getEditor().offsetToLogicalPosition(longLine.length() - 1).column; assertEquals(longLine.length() - 1, col); } - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/execution/filters/UrlFilterTest.java b/platform/platform-tests/testSrc/com/intellij/execution/filters/UrlFilterTest.java index 665ac38066e7..a01c5a43d684 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/filters/UrlFilterTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/filters/UrlFilterTest.java @@ -44,12 +44,12 @@ public class UrlFilterTest extends BasePlatformTestCase { public void testPerformanceSimple() { List expected = List.of(new FileLinkInfo(7, 30, "/home/file.txt", 3, 1), new FileLinkInfo(34, 62, "/home/result.txt", 3, 30)); - PlatformTestUtil.startPerformanceTest("Find file hyperlinks", () -> { + PlatformTestUtil.newPerformanceTest("Find file hyperlinks", () -> { for (int i = 0; i < 100_000; i++) { Filter.Result result = applyFilter("before file:///home/file.txt:3 -> file:///home/result.txt:3:30 after"); assertHyperlinks(result, expected); } - }).assertTiming(); + }).start(); } public void testUrlEncodedFileLinks() { diff --git a/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java b/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java index 5cefe0e692ce..4d7aa9505a74 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java @@ -268,7 +268,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase { public void testPerformance() { withCycleConsoleNoFolding(100, console -> - PlatformTestUtil.startPerformanceTest("console print", () -> { + PlatformTestUtil.newPerformanceTest("console print", () -> { console.clear(); for (int i=0; i<10_000_000; i++) { console.print("xxx\n", ConsoleViewContentType.NORMAL_OUTPUT); @@ -277,24 +277,24 @@ public class ConsoleViewImplTest extends LightPlatformTestCase { } LightPlatformCodeInsightTestCase.type('\n', console.getEditor(), getProject()); console.waitAllRequests(); - }).assertTiming()); + }).start()); } public void testLargeConsolePerformance() { withCycleConsoleNoFolding(UISettings.getInstance().getConsoleCycleBufferSizeKb(), console -> - PlatformTestUtil.startPerformanceTest("console print", () -> { + PlatformTestUtil.newPerformanceTest("console print", () -> { console.clear(); for (int i=0; i<20_000_000; i++) { console.print("hello\n", ConsoleViewContentType.NORMAL_OUTPUT); } PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue(); console.waitAllRequests(); - }).assertTiming()); + }).start()); } public void testPerformanceOfMergeableTokens() { withCycleConsoleNoFolding(1000, console -> - PlatformTestUtil.startPerformanceTest("console print with mergeable tokens", () -> { + PlatformTestUtil.newPerformanceTest("console print with mergeable tokens", () -> { console.clear(); for (int i=0; i<10_000_000; i++) { console.print("xxx\n", ConsoleViewContentType.NORMAL_OUTPUT); @@ -304,7 +304,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase { MarkupModel model = DocumentMarkupModel.forDocument(console.getEditor().getDocument(), getProject(), true); RangeHighlighter highlighter = assertOneElement(model.getAllHighlighters()); assertEquals(new TextRange(0, console.getEditor().getDocument().getTextLength()), highlighter.getTextRange()); - }).assertTiming()); + }).start()); } private void withCycleConsoleNoFolding(int capacityKB, Consumer runnable) { @@ -696,7 +696,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase { public void testBackspacePerformance() { int nCopies = 10000; String in = StringUtil.repeat("\na\nb\bc", nCopies); - PlatformTestUtil.startPerformanceTest("print newlines with backspace", () -> { + PlatformTestUtil.newPerformanceTest("print newlines with backspace", () -> { for (int i = 0; i < 2; i++) { myConsole.clear(); int printCount = ConsoleBuffer.getCycleBufferSize() / in.length(); @@ -707,7 +707,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase { myConsole.waitAllRequests(); assertEquals((long) printCount * nCopies * "\na\nc".length(), myConsole.getContentSize()); } - }).assertTiming(); + }).start(); } public void testBackspaceChangesHighlightingRanges1() { diff --git a/platform/platform-tests/testSrc/com/intellij/execution/impl/MockProcessStreamsSynchronizerTest.java b/platform/platform-tests/testSrc/com/intellij/execution/impl/MockProcessStreamsSynchronizerTest.java index 1935de289d83..e251b0785f3b 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/impl/MockProcessStreamsSynchronizerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/impl/MockProcessStreamsSynchronizerTest.java @@ -96,7 +96,7 @@ public class MockProcessStreamsSynchronizerTest extends LightPlatformTestCase { } public void testPerformanceSingleStream() { - PlatformTestUtil.startPerformanceTest("single stream", () -> { + PlatformTestUtil.newPerformanceTest("single stream", () -> { mySynchronizer = new MockProcessStreamsSynchronizer(getTestRootDisposable()); long nowTimeMillis = 10; for (int i = 0; i < 10_000_000; i++) { @@ -116,11 +116,11 @@ public class MockProcessStreamsSynchronizerTest extends LightPlatformTestCase { assertNoPendingChunks(); nowTimeMillis += 8; } - }).assertTiming(); + }).start(); } public void testPerformanceTwoStreams() { - PlatformTestUtil.startPerformanceTest("two streams", () -> { + PlatformTestUtil.newPerformanceTest("two streams", () -> { mySynchronizer = new MockProcessStreamsSynchronizer(getTestRootDisposable()); long nowTimeMillis = 10; for (int i = 0; i < 10_000_000; i++) { @@ -140,7 +140,7 @@ public class MockProcessStreamsSynchronizerTest extends LightPlatformTestCase { assertNoPendingChunks(); nowTimeMillis += 8 + 2 * AWAIT_SAME_STREAM_TEXT_MILLIS; } - }).assertTiming(); + }).start(); } private void assertFlushedChunks(FlushedChunk @NotNull ... expectedFlushedChunks) { diff --git a/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java b/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java index 01f68a5cc722..ecd67ae21654 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java @@ -287,14 +287,14 @@ public class AnsiEscapeDecoderTest extends LightPlatformTestCase { //noinspection CodeBlock2Expr withProcessHandlerFrom(testProcess, handler -> { - PlatformTestUtil.startPerformanceTest("ansi color", () -> { + PlatformTestUtil.newPerformanceTest("ansi color", () -> { for (int i = 0; i < 2_000_000; i++) { handler.notifyTextAvailable(i + "Chrome 35.0.1916 (Linux): Executed 0 of 1\u001B[32m SUCCESS\u001B[39m (0 secs / 0 secs)\n", ProcessOutputTypes.STDOUT); handler.notifyTextAvailable(i + "Plain\u001B[32mGreen\u001B[39mNormal\u001B[1A\u001B[2K\u001B[31mRed\u001B[39m\n", ProcessOutputTypes.SYSTEM); } - }).assertTiming(); + }).start(); }); } diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/LocalHistoryStorageTest.java b/platform/platform-tests/testSrc/com/intellij/history/integration/LocalHistoryStorageTest.java index 2a19782b2c4d..eb8d68a4dfa9 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/LocalHistoryStorageTest.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/LocalHistoryStorageTest.java @@ -41,9 +41,9 @@ public class LocalHistoryStorageTest extends IntegrationTestCase { () -> VirtualFileManager.getInstance().findFileByUrl("temp:///").createChildData(null, "testChangesAccumulationPerformance.txt") ); try { - PlatformTestUtil.startPerformanceTest("local history changes accumulation", () -> { + PlatformTestUtil.newPerformanceTest("local history changes accumulation", () -> { doChangesAccumulationPerformanceTest(f); - }).assertTiming(); + }).start(); } finally { WriteAction.run(() -> { diff --git a/platform/platform-tests/testSrc/com/intellij/ide/IdeEventQueueTest.java b/platform/platform-tests/testSrc/com/intellij/ide/IdeEventQueueTest.java index 97da7cfe7fef..c6b97b3e4ed1 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/IdeEventQueueTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ide/IdeEventQueueTest.java @@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class IdeEventQueueTest extends LightPlatformTestCase { public void testManyEventsStress() { int N = 100000; - PlatformTestUtil.startPerformanceTest("Event queue dispatch", () -> { + PlatformTestUtil.newPerformanceTest("Event queue dispatch", () -> { UIUtil.dispatchAllInvocationEvents(); AtomicInteger count = new AtomicInteger(); for (int i = 0; i < N; i++) { @@ -42,7 +42,7 @@ public class IdeEventQueueTest extends LightPlatformTestCase { } UIUtil.dispatchAllInvocationEvents(); assertEquals(N, count.get()); - }).assertTiming(); + }).start(); } public void testKeyboardEventsAreDetected() throws InterruptedException { diff --git a/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.kt b/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.kt index a9407a0dd9be..22c3aba7fc79 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.kt @@ -508,11 +508,11 @@ NUMBER ('0yabc0') } } - PlatformTestUtil.startPerformanceTest(name) { + PlatformTestUtil.newPerformanceTest(name) { val charAts = IntRef() LexerTestCase.printTokens(countingCharSequence(text, charAts), 0, CustomFileTypeLexer(table)) assertTrue(charAts.get() < text.length * 4) - }.assertTiming() + }.start() } private fun countingCharSequence(text: CharSequence, charAts: IntRef): CharSequence { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java index 55da1ce74452..994a77f9e525 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java @@ -75,7 +75,7 @@ public class ApplicationImplTest extends LightPlatformTestCase { ThreadingAssertions.assertEventDispatchThread(); try { - PlatformTestUtil.startPerformanceTest("lock/unlock "+getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest("lock/unlock " + getTestName(false), () -> { final int numOfThreads = JobSchedulerImpl.getJobPoolParallelism(); List> threads = new ArrayList<>(numOfThreads); for (int i = 0; i < numOfThreads; i++) { @@ -94,7 +94,7 @@ public class ApplicationImplTest extends LightPlatformTestCase { }); } waitWithTimeout(threads); - }).assertTiming(); + }).start(); } finally { Disposer.dispose(disposable); @@ -475,12 +475,12 @@ public class ApplicationImplTest extends LightPlatformTestCase { } }); - PlatformTestUtil.startPerformanceTest("RWLock/unlock", ()-> { + PlatformTestUtil.newPerformanceTest("RWLock/unlock", ()-> { ThreadingAssertions.assertEventDispatchThread(); assertFalse(ApplicationManager.getApplication().isWriteAccessAllowed()); List> futures = AppExecutorUtil.getAppExecutorService().invokeAll(callables); ConcurrencyUtil.getAll(futures); - }).assertTiming(); + }).start(); } private static void pumpEventsFor(int timeOut, @NotNull TimeUnit unit) throws Throwable { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java index a7a903aba54d..d230a304128e 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java @@ -590,7 +590,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase { AtomicInteger counter = new AtomicInteger(); Runnable r = () -> counter.incrementAndGet(); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (int i = 0; i < N; i++) { if (i % 8192 == 0) { // decrease GC pressure, we're not measuring that @@ -600,7 +600,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase { } SwingUtilities.invokeAndWait(EmptyRunnable.getInstance()); assertEquals(N, counter.getAndSet(0)); - }).assertTiming(); + }).start(); } @IgnoreJUnit3 @@ -608,7 +608,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase { int N = 1_000_000; AtomicInteger counter = new AtomicInteger(); Runnable r = () -> counter.incrementAndGet(); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { Application application = ApplicationManager.getApplication(); for (int i = 0; i < N; i++) { if (i % 8192 == 0) { @@ -619,7 +619,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase { } application.invokeAndWait(EmptyRunnable.getInstance()); assertEquals(N, counter.getAndSet(0)); - }).assertTiming(); + }).start(); } @IgnoreJUnit3 @@ -629,7 +629,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase { Runnable r = () -> counter.incrementAndGet(); Application application = ApplicationManager.getApplication(); application.invokeAndWait(r); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { counter.set(0); UIUtil.invokeAndWaitIfNeeded(() -> LaterInvocator.enterModal(myWindow1)); for (int i = 0; i < N; i++) { @@ -639,7 +639,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase { UIUtil.invokeAndWaitIfNeeded(() -> LaterInvocator.leaveModal(myWindow1)); application.invokeAndWait(EmptyRunnable.getInstance()); assertEquals(N, counter.get()); - }).assertTiming(); + }).start(); } private final JDialog myModalDialog = new JDialog((Dialog)null, true); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/NonBlockingReadActionTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/NonBlockingReadActionTest.java index 6299a9413883..2dfce7739e69 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/NonBlockingReadActionTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/NonBlockingReadActionTest.java @@ -401,13 +401,13 @@ public class NonBlockingReadActionTest extends LightPlatformTestCase { } public void testCancellationPerformance() { - PlatformTestUtil.startPerformanceTest("NBRA cancellation", () -> { + PlatformTestUtil.newPerformanceTest("NBRA cancellation", () -> { WriteAction.run(() -> { for (int i = 0; i < 100_000; i++) { ReadAction.nonBlocking(() -> {}).coalesceBy(this).submit(AppExecutorUtil.getAppExecutorService()).cancel(); } }); - }).assertTiming(); + }).start(); } public void testExceptionInsideAsyncComputationIsLogged() throws Exception { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorCreationPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorCreationPerformanceTest.java index f7f671341c75..354795cd8937 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorCreationPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorCreationPerformanceTest.java @@ -24,7 +24,7 @@ public class EditorCreationPerformanceTest extends AbstractEditorTest { public void testOpeningEditorWithManyLines() { Document document = EditorFactory.getInstance().createDocument(StringUtil.repeat(LOREM_IPSUM + '\n', 15000)); - PlatformTestUtil.startPerformanceTest("Editor creation", () -> { + PlatformTestUtil.newPerformanceTest("Editor creation", () -> { Editor editor = EditorFactory.getInstance().createEditor(document); try { LOG.debug(String.valueOf(editor.getContentComponent().getPreferredSize())); @@ -35,14 +35,14 @@ public class EditorCreationPerformanceTest extends AbstractEditorTest { }) .warmupIterations(50) .attempts(100) - .assertTiming(); + .start(); // attempt.min.ms varies ~57% (from experiments) } public void testOpeningEditorWithLongLine() { Document document = EditorFactory.getInstance().createDocument(StringUtil.repeat(LOREM_IPSUM, 30000)); - PlatformTestUtil.startPerformanceTest("Editor creation", () -> { + PlatformTestUtil.newPerformanceTest("Editor creation", () -> { Editor editor = EditorFactory.getInstance().createEditor(document); try { EditorTestUtil.setEditorVisibleSize(editor, 100, 100); @@ -54,7 +54,7 @@ public class EditorCreationPerformanceTest extends AbstractEditorTest { }) .warmupIterations(50) .attempts(100) - .assertTiming(); + .start(); // attempt.min.ms varies ~17% (from experiments) } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretPerformanceTest.java index 53f3190abc37..77f19473b64b 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretPerformanceTest.java @@ -26,11 +26,11 @@ public class EditorMultiCaretPerformanceTest extends AbstractEditorTest { int charactersToType = 100; String initialText = StringUtil.repeat("\n", caretCount); initText(initialText); - PlatformTestUtil.startPerformanceTest("Typing with large number of carets", () -> { + PlatformTestUtil.newPerformanceTest("Typing with large number of carets", () -> { for (int i = 0; i < charactersToType; i++) { type('a'); } - }).warmupIterations(0).attempts(1).assertTiming(); + }).warmupIterations(0).attempts(1).start(); checkResultByText(StringUtil.repeat(StringUtil.repeat("a", charactersToType) + "\n", caretCount)); } @@ -44,11 +44,11 @@ public class EditorMultiCaretPerformanceTest extends AbstractEditorTest { addFoldRegion(getEditor().getDocument().getLineStartOffset(i), getEditor().getDocument().getLineEndOffset(i), "..."); } }); - PlatformTestUtil.startPerformanceTest("Typing with large number of carets with a lot of fold regions", () -> { + PlatformTestUtil.newPerformanceTest("Typing with large number of carets with a lot of fold regions", () -> { for (int i = 0; i < charactersToType; i++) { type('a'); } - }).warmupIterations(0).attempts(1).assertTiming(); + }).warmupIterations(0).attempts(1).start(); checkResultByText(StringUtil.repeat(' ' + StringUtil.repeat("a", charactersToType) + " \n", caretCount)); } @@ -57,11 +57,11 @@ public class EditorMultiCaretPerformanceTest extends AbstractEditorTest { int charactersToType = 100; String initialText = "\n" + StringUtil.repeat(" \n", caretCount) + ""; init(initialText, StdFileTypes.XML); - PlatformTestUtil.startPerformanceTest("Typing in XML with large number of carets", () -> { + PlatformTestUtil.newPerformanceTest("Typing in XML with large number of carets", () -> { for (int i = 0; i < charactersToType; i++) { type('a'); } - }).warmupIterations(0).attempts(1).assertTiming(); + }).warmupIterations(0).attempts(1).start(); checkResultByText("\n" + StringUtil.repeat(" " + StringUtil.repeat("a", charactersToType) + "\n", caretCount) + ""); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingPerformanceTest.java index 8cb8f1244beb..4dfccf9f4c61 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingPerformanceTest.java @@ -45,7 +45,7 @@ public class EditorPaintingPerformanceTest extends AbstractEditorTest { EditorImpl editor = (EditorImpl)getEditor(); int editorHeight = editor.getPreferredHeight(); int[] result = {0}; - PlatformTestUtil.startPerformanceTest(message, () -> { + PlatformTestUtil.newPerformanceTest(message, () -> { for (int y = 0; y < editorHeight; y += 1000) { Rectangle clip = new Rectangle(0, y, EDITOR_WIDTH_PX, 1000); NullGraphics2D g = new NullGraphics2D(clip); @@ -54,7 +54,7 @@ public class EditorPaintingPerformanceTest extends AbstractEditorTest { } }).warmupIterations(50) .attempts(100) - .assertTiming(); + .start(); LOG.debug(String.valueOf(result[0])); } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPerformanceTest.java index 8d6882e60944..5bcf7315257c 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPerformanceTest.java @@ -19,14 +19,14 @@ public class EditorPerformanceTest extends AbstractEditorTest { getEditor().getMarkupModel().addRangeHighlighter(offset, offset + 1, 0, attributes, HighlighterTargetArea.EXACT_RANGE); } getEditor().getCaretModel().moveToOffset(0); - PlatformTestUtil.startPerformanceTest("Editing with a lot of highlighters", () -> { + PlatformTestUtil.newPerformanceTest("Editing with a lot of highlighters", () -> { for (int i = 0; i < 50; i++) { executeAction(IdeActions.ACTION_EDITOR_ENTER); UIUtil.dispatchAllInvocationEvents(); // let gutter update its width } }).warmupIterations(50) .attempts(100) - .assertTiming(); + .start(); // attempt.min.ms varies ~15% (from experiments) } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java index f7ed7fcce1b4..e4bc54475d6d 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java @@ -87,13 +87,13 @@ public class FoldingStressTest extends LightPlatformTestCase { Editor editor = EditorFactory.getInstance().createEditor(doc); try { FoldingModelEx model = (FoldingModelEx)editor.getFoldingModel(); - PlatformTestUtil.startPerformanceTest("restoring many fold regions", () -> model.runBatchFoldingOperation(() -> { + PlatformTestUtil.newPerformanceTest("restoring many fold regions", () -> model.runBatchFoldingOperation(() -> { for (int i = 0; i < N; i++) { addAndCollapseFoldRegion(model, i, i+1, "/*...*/"); } })) .setup(()-> model.runBatchFoldingOperation(model::clearFoldRegions)) - .assertTiming(); + .start(); } finally { EditorFactory.getInstance().releaseEditor(editor); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/LineSetIncrementalUpdateTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/LineSetIncrementalUpdateTest.java index ac76030d94b2..c053961d4644 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/LineSetIncrementalUpdateTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/LineSetIncrementalUpdateTest.java @@ -53,14 +53,14 @@ public class LineSetIncrementalUpdateTest extends UsefulTestCase { public void testTypingInLongLinePerformance() { String longLine = StringUtil.repeat("a ", 200000); - PlatformTestUtil.startPerformanceTest("Document changes in a long line", () -> { + PlatformTestUtil.newPerformanceTest("Document changes in a long line", () -> { Document document = new DocumentImpl("a\n" + longLine + "" + longLine + "\n", true); for (int i = 0; i < 1000; i++) { int offset = i * 2 + longLine.length(); assertEquals(1, document.getLineNumber(offset)); document.insertString(offset, "b"); } - }).assertTiming(); + }).start(); } } \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/RangeMarkerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/RangeMarkerTest.java index 4505ddfdc6bd..0cedd0445a82 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/RangeMarkerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/RangeMarkerTest.java @@ -1118,7 +1118,7 @@ public class RangeMarkerTest extends LightPlatformTestCase { } markupModel.addRangeHighlighter(null, N / 2, N / 2 + 1, 0, HighlighterTargetArea.LINES_IN_RANGE); - PlatformTestUtil.startPerformanceTest("highlighters lookup", () -> { + PlatformTestUtil.newPerformanceTest("highlighters lookup", () -> { List list = new ArrayList<>(); CommonProcessors.CollectProcessor coll = new CommonProcessors.CollectProcessor<>(list); for (int i=0; i{ + PlatformTestUtil.newPerformanceTest("RM.getStartOffset", ()->{ insertString(doc, 0, " "); for (int i=0; i<1000; i++) { for (RangeMarker rm : markers) { @@ -1334,7 +1334,7 @@ public class RangeMarkerTest extends LightPlatformTestCase { } } deleteString(doc, 0, 1); - }).assertTiming(); + }).start(); } public void testGetOffsetDuringModificationsPerformance() { @@ -1347,7 +1347,7 @@ public class RangeMarkerTest extends LightPlatformTestCase { RangeMarker marker = doc.createRangeMarker(start, end); markers.add(marker); } - PlatformTestUtil.startPerformanceTest("RM.getStartOffset", ()->{ + PlatformTestUtil.newPerformanceTest("RM.getStartOffset", ()->{ insertString(doc, 0, " "); for (int i=0; i<1000; i++) { for (int j = 0; j < markers.size(); j++) { @@ -1359,7 +1359,7 @@ public class RangeMarkerTest extends LightPlatformTestCase { } } deleteString(doc, 0, 1); - }).assertTiming(); + }).start(); } public void testDocModificationPerformance() { @@ -1372,12 +1372,12 @@ public class RangeMarkerTest extends LightPlatformTestCase { RangeMarker marker = doc.createRangeMarker(start, end); markers.add(marker); } - PlatformTestUtil.startPerformanceTest("insert/delete string", ()->{ + PlatformTestUtil.newPerformanceTest("insert/delete string", ()->{ for (int i=0; i<15000; i++) { insertString(doc, 0, " "); deleteString(doc, 0, 1); } - }).assertTiming(); + }).start(); for (RangeMarker rm : markers) { assertTrue(rm.isValid()); } @@ -1387,7 +1387,7 @@ public class RangeMarkerTest extends LightPlatformTestCase { DocumentEx doc = new DocumentImpl(StringUtil.repeat("blah", 1000)); int N = 100_000; List markers = new ArrayList<>(N); - PlatformTestUtil.startPerformanceTest("createRM", ()->{ + PlatformTestUtil.newPerformanceTest("createRM", ()->{ for (int i = 0; i < N; i++) { int start = i % doc.getTextLength(); int end = start + 1; @@ -1397,7 +1397,7 @@ public class RangeMarkerTest extends LightPlatformTestCase { for (RangeMarker marker : markers) { marker.dispose(); } - }).assertTiming(); + }).start(); } public void testProcessOverlappingPerformance() { @@ -1410,14 +1410,14 @@ public class RangeMarkerTest extends LightPlatformTestCase { RangeMarker marker = doc.createRangeMarker(start, end); markers.add(marker); } - PlatformTestUtil.startPerformanceTest(getTestName(false), ()->{ + PlatformTestUtil.newPerformanceTest(getTestName(false), ()->{ for (int it = 0; it < 2_000; it++) { for (int i = 1; i < doc.getTextLength() - 1; i++) { boolean result = doc.processRangeMarkersOverlappingWith(i, i + 1, __ -> false); assertFalse(result); } } - }).assertTiming(); + }).start(); assertNotEmpty(markers); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java index 74547afb1f5b..34c9104fcf41 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java @@ -340,12 +340,12 @@ public class ProgressIndicatorTest extends LightPlatformTestCase { } public void testProgressPerformance() { - PlatformTestUtil.startPerformanceTest("executeProcessUnderProgress", () -> { + PlatformTestUtil.newPerformanceTest("executeProcessUnderProgress", () -> { EmptyProgressIndicator indicator = new EmptyProgressIndicator(); for (int i=0;i<100000;i++) { ProgressManager.getInstance().executeProcessUnderProgress(EmptyRunnable.getInstance(), indicator); } - }).assertTiming(); + }).start(); } public void testWrapperIndicatorGotCanceledTooWhenInnerIndicatorHas() { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt index 6cf04b253fca..dd2a74b84465 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/IteratingContentUnderExcludedTest.kt @@ -175,7 +175,7 @@ class IteratingContentUnderExcludedTest { IoTestUtil.assumeSymLinkCreationIsSupported() val root = projectModel.baseProjectDir.virtualFileRoot generateSymlinkExplosion(VfsUtilCore.virtualToIoFile(root), 17) - PlatformTestUtil.startPerformanceTest("traversing non-project roots") { checkIterate(root) }.assertTiming() + PlatformTestUtil.newPerformanceTest("traversing non-project roots") { checkIterate(root) }.start() } companion object { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/ProjectFileIndexPerformanceTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/ProjectFileIndexPerformanceTest.kt index 0cd8ffea0d0f..0a8b28349f3f 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/ProjectFileIndexPerformanceTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/roots/impl/ProjectFileIndexPerformanceTest.kt @@ -135,7 +135,7 @@ class ProjectFileIndexPerformanceTest { } val filesWithoutId = arrayOf(noId1, noId2, noId3) val fsRoot = VirtualFileManager.getInstance().findFileByUrl("temp:///")!! - PlatformTestUtil.startPerformanceTest("Checking status of source files in ProjectFileIndex") { + PlatformTestUtil.newPerformanceTest("Checking status of source files in ProjectFileIndex") { runReadAction { repeat(100) { assertFalse(fileIndex.isInContent(fsRoot)) @@ -152,12 +152,12 @@ class ProjectFileIndexPerformanceTest { } } } - }.assertTiming() + }.start() } @Test fun `access to excluded files`() { - PlatformTestUtil.startPerformanceTest("Checking status of excluded files in ProjectFileIndex") { + PlatformTestUtil.newPerformanceTest("Checking status of excluded files in ProjectFileIndex") { runReadAction { repeat(10) { for (file in ourExcludedFilesToTest) { @@ -167,12 +167,12 @@ class ProjectFileIndexPerformanceTest { } } } - }.assertTiming() + }.start() } @Test fun `access to library files`() { - PlatformTestUtil.startPerformanceTest("Checking status of library files in ProjectFileIndex") { + PlatformTestUtil.newPerformanceTest("Checking status of library files in ProjectFileIndex") { runReadAction { repeat(10) { for (file in ourLibraryFilesToTest) { @@ -188,12 +188,12 @@ class ProjectFileIndexPerformanceTest { } } } - }.assertTiming() + }.start() } @Test fun `access to library source files`() { - PlatformTestUtil.startPerformanceTest("Checking status of library source files in ProjectFileIndex") { + PlatformTestUtil.newPerformanceTest("Checking status of library source files in ProjectFileIndex") { runReadAction { repeat(10) { for (file in ourLibrarySourceFilesToTest) { @@ -209,14 +209,14 @@ class ProjectFileIndexPerformanceTest { } } } - }.assertTiming() + }.start() } @Test fun `access to index after change`() { val newRoot = runWriteActionAndWait { ourProjectRoot.subdir("newContentRoot") } val module = ourProjectModel.moduleManager.findModuleByName("big")!! - PlatformTestUtil.startPerformanceTest("Checking status of file after adding and removing content root") { + PlatformTestUtil.newPerformanceTest("Checking status of file after adding and removing content root") { runReadAction { repeat(50) { assertFalse(fileIndex.isInContent(newRoot)) @@ -225,6 +225,6 @@ class ProjectFileIndexPerformanceTest { }.setup { PsiTestUtil.addContentRoot(module, newRoot) PsiTestUtil.removeContentEntry(module, newRoot) - }.assertTiming() + }.start() } } \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/util/io/FileUtilPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/util/io/FileUtilPerformanceTest.java index cd109d949020..c2b29390899c 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/util/io/FileUtilPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/util/io/FileUtilPerformanceTest.java @@ -16,35 +16,35 @@ public class FileUtilPerformanceTest { public void toCanonicalPath() { assertEquals(myCanonicalPath, FileUtil.toCanonicalPath(myTestPath)); - PlatformTestUtil.startPerformanceTest("toCanonicalPath", () -> { + PlatformTestUtil.newPerformanceTest("toCanonicalPath", () -> { for (int i = 0; i < 1000000; ++i) { final String canonicalPath = FileUtil.toCanonicalPath(myTestPath, '/'); assert canonicalPath.length() == 18 : canonicalPath; } - }).assertTiming(); + }).start(); } @Test public void toCanonicalPathSimple() { assertEquals(mySimpleTestPath, FileUtil.toCanonicalPath(mySimpleTestPath)); - PlatformTestUtil.startPerformanceTest("toCanonicalPathSimple", () -> { + PlatformTestUtil.newPerformanceTest("toCanonicalPathSimple", () -> { for (int i = 0; i < 1000000; ++i) { final String canonicalPath = FileUtil.toCanonicalPath(mySimpleTestPath, '/'); assert canonicalPath.length() == 8 : canonicalPath; } - }).assertTiming(); + }).start(); } @Test public void isAncestor() { assertTrue(FileUtil.isAncestor(myTestPath, myCanonicalPath, false)); - PlatformTestUtil.startPerformanceTest("isAncestor", () -> { + PlatformTestUtil.newPerformanceTest("isAncestor", () -> { for (int i = 0; i < 1000000; ++i) { assert FileUtil.isAncestor(myTestPath, myCanonicalPath, false); assert !FileUtil.isAncestor(myTestPath, myCanonicalPath, true); } - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java index c7791bdc540d..44311354169f 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java @@ -29,7 +29,7 @@ public class StringUtilPerformanceTest { public void containsAnyChar() { assertTrue(StringUtil.containsAnyChar(TEST_STRING, Integer.toString(new Random().nextInt()))); - PlatformTestUtil.startPerformanceTest("StringUtil.containsAnyChar()", () -> { + PlatformTestUtil.newPerformanceTest("StringUtil.containsAnyChar()", () -> { for (int i = 0; i < 1_000_000; i++) { if (StringUtil.containsAnyChar(TEST_STRING, "XYZ")) { throw new AssertionError(); @@ -38,6 +38,6 @@ public class StringUtilPerformanceTest { throw new AssertionError(); } } - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/ArchiveFileSystemPerformanceTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/ArchiveFileSystemPerformanceTest.kt index f8fe6f782a99..800aa3f34a84 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/ArchiveFileSystemPerformanceTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/ArchiveFileSystemPerformanceTest.kt @@ -20,19 +20,19 @@ class ArchiveFileSystemPerformanceTest : BareTestFixtureTestCase() { @Test fun getRootByEntry() { val root = fs.getRootByEntry(entry)!! - PlatformTestUtil.startPerformanceTest("ArchiveFileSystem.getRootByEntry()") { + PlatformTestUtil.newPerformanceTest("ArchiveFileSystem.getRootByEntry()") { for (i in 0..100000) { assertEquals(root, fs.getRootByEntry(entry)) } - }.assertTiming() + }.start() } @Test fun getLocalByEntry() { val local = fs.getLocalByEntry(entry)!! - PlatformTestUtil.startPerformanceTest("ArchiveFileSystem.getLocalByEntry()") { + PlatformTestUtil.newPerformanceTest("ArchiveFileSystem.getLocalByEntry()") { for (i in 0..100000) { assertEquals(local, fs.getLocalByEntry(entry)) } - }.assertTiming() + }.start() } } \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VfsUtilPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VfsUtilPerformanceTest.java index 9703a34e0bb3..c12e58193c75 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VfsUtilPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VfsUtilPerformanceTest.java @@ -83,12 +83,12 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { UIUtil.pump(); // wait for all event handlers to calm down Logger.getInstance(VfsUtilPerformanceTest.class).debug("Start searching..."); - PlatformTestUtil.startPerformanceTest("finding child", () -> { + PlatformTestUtil.newPerformanceTest("finding child", () -> { for (int i = 0; i < 1_000_000; i++) { VirtualFile child = vDir.findChild("5111.txt"); assertEquals(theChild, child); } - }).assertTiming(); + }).start(); WriteCommandAction.writeCommandAction(null).run(() -> { for (VirtualFile file : vDir.getChildren()) { @@ -107,8 +107,8 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { String path = jar.getPath() + "!/"; ManagingFS managingFS = ManagingFS.getInstance(); NewVirtualFile root = managingFS.findRoot(path, fs); - PlatformTestUtil.startPerformanceTest("finding root", - () -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress( + PlatformTestUtil.newPerformanceTest("finding root", + () -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress( Collections.nCopies(500, null), null, __ -> { for (int i = 0; i < 100_000; i++) { @@ -117,7 +117,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { assertSame(root, rootJar); } return true; - })).assertTiming(); + })).start(); } @Test @@ -152,8 +152,8 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { } }; - PlatformTestUtil.startPerformanceTest("getParent before movement", checkPerformance) - .assertTiming(getQualifiedTestMethodName() + " - getParent before movement"); + PlatformTestUtil.newPerformanceTest("getParent before movement", checkPerformance) + .start(getQualifiedTestMethodName() + " - getParent before movement"); VirtualFile dir1 = root.createChildDirectory(this, "dir1"); VirtualFile dir2 = root.createChildDirectory(this, "dir2"); @@ -161,8 +161,8 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { dir1.createChildData(this, "a" + i + ".txt").move(this, dir2); } - PlatformTestUtil.startPerformanceTest("getParent after movement", checkPerformance) - .assertTiming(getQualifiedTestMethodName() + " - getParent after movement"); + PlatformTestUtil.newPerformanceTest("getParent after movement", checkPerformance) + .start(getQualifiedTestMethodName() + " - getParent after movement"); }); } @@ -186,11 +186,11 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { "fff.txt"; VirtualFile file = fixture.findOrCreateDir(path); - PlatformTestUtil.startPerformanceTest("VF.getPath()", () -> { + PlatformTestUtil.newPerformanceTest("VF.getPath()", () -> { for (int i = 0; i < 1_000_000; ++i) { file.getPath(); } - }).assertTiming(getQualifiedTestMethodName()); + }).start(getQualifiedTestMethodName()); }); } @@ -271,7 +271,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { VirtualDirectoryImpl temp = createTempFsDirectory(); EdtTestUtil.runInEdtAndWait(() -> { - PlatformTestUtil.startPerformanceTest("many files creations", () -> { + PlatformTestUtil.newPerformanceTest("many files creations", () -> { assertEquals(N, events.size()); processEvents(events); assertEquals(N, temp.getCachedChildren().size()); @@ -284,9 +284,9 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { eventsForCreating(events, N, temp); assertEquals(N, TempFileSystem.getInstance().list(temp).length); // do not call getChildren which caches everything }) - .assertTiming(getQualifiedTestMethodName() + " - many files creations"); + .start(getQualifiedTestMethodName() + " - many files creations"); - PlatformTestUtil.startPerformanceTest("many files deletions", () -> { + PlatformTestUtil.newPerformanceTest("many files deletions", () -> { assertEquals(N, events.size()); processEvents(events); assertEquals(0, temp.getCachedChildren().size()); @@ -303,7 +303,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase { eventsForDeleting(events, temp); assertEquals(N, TempFileSystem.getInstance().list(temp).length); // do not call getChildren which caches everything }) - .assertTiming(getQualifiedTestMethodName() + " - many files deletions"); + .start(getQualifiedTestMethodName() + " - many files deletions"); } ); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/encoding/FileEncodingTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/encoding/FileEncodingTest.java index 8ae4d65befb0..aa2c0be74868 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/encoding/FileEncodingTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/encoding/FileEncodingTest.java @@ -1021,13 +1021,13 @@ public class FileEncodingTest extends HeavyPlatformTestCase implements TestDialo WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, " ")); EncodingManagerImpl encodingManager = (EncodingManagerImpl)EncodingManager.getInstance(); encodingManager.waitAllTasksExecuted(60, TimeUnit.SECONDS); - PlatformTestUtil.startPerformanceTest("encoding re-detect requests", ()->{ + PlatformTestUtil.newPerformanceTest("encoding re-detect requests", ()->{ for (int i=0; i<100_000_000;i++) { encodingManager.queueUpdateEncodingFromContent(document); } encodingManager.waitAllTasksExecuted(60, TimeUnit.SECONDS); UIUtil.dispatchAllInvocationEvents(); - }).assertTiming(); + }).start(); } public void testEncodingDetectionRequestsRunAtMostOneThreadForEachDocument() throws Throwable { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerRootsTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerRootsTest.java index d8e65e4a9f63..265a775704b2 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerRootsTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerRootsTest.java @@ -71,13 +71,13 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { } public void testContainerCreateDeletePerformance() { - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { Disposable parent = Disposer.newDisposable(); for (int i = 0; i < 100_000; i++) { myVirtualFilePointerManager.createContainer(parent); } Disposer.dispose(parent); - }).assertTiming(); + }).start(); } public void testMultipleCreatePointerWithTheSameUrlPerformance() throws IOException { @@ -86,12 +86,12 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { String url = VfsUtilCore.pathToUrl(f.getPath()); VirtualFilePointer thePointer = myVirtualFilePointerManager.create(url, disposable, listener); assertNotNull(TempFileSystem.getInstance()); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (int i = 0; i < 1_000_000; i++) { VirtualFilePointer pointer = myVirtualFilePointerManager.create(url, disposable, listener); assertSame(pointer, thePointer); } - }).assertTiming(); + }).start(); } public void testMultipleCreatePointerWithTheSameFilePerformance() throws IOException { @@ -101,12 +101,12 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { VirtualFile v = refreshAndFindFile(f); VirtualFilePointer thePointer = myVirtualFilePointerManager.create(v, disposable, listener); assertNotNull(TempFileSystem.getInstance()); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (int i = 0; i < 10_000_000; i++) { VirtualFilePointer pointer = myVirtualFilePointerManager.create(v, disposable, listener); assertSame(pointer, thePointer); } - }).assertTiming(); + }).start(); } public void testManyPointersUpdatePerformance() throws IOException { @@ -120,7 +120,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { String name = "xxx" + (i%20); events.add(new VFileCreateEvent(this, temp, name, true, null, null, null)); } - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (int i = 0; i < 100; i++) { // simulate VFS refresh events since launching the actual refresh is too slow AsyncFileListener.ChangeApplier applier = myVirtualFilePointerManager.prepareChange(events); @@ -129,7 +129,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { myVirtualFilePointerManager.before(events); myVirtualFilePointerManager.after(events); } - }).assertTiming(); + }).start(); }); } @@ -149,7 +149,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { PersistentFSImpl persistentFS = (PersistentFSImpl)ManagingFS.getInstance(); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { for (int i=0; i<500_000; i++) { persistentFS.incStructuralModificationCount(); AsyncFileListener.ChangeApplier applier = myVirtualFilePointerManager.prepareChange(createEvents); @@ -163,7 +163,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase { applier2.afterVfsChange(); myVirtualFilePointerManager.after(deleteEvents); } - }).assertTiming(); + }).start(); } public void testCidrCrazyAddCreateRenames() throws IOException { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java index 7d21ea605465..d6fe88f33d78 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java @@ -1124,11 +1124,11 @@ public class VirtualFilePointerTest extends BareTestFixtureTestCase { assertNotNull(pointer.getFile()); assertTrue(pointer.getFile().isValid()); - PlatformTestUtil.startPerformanceTest("get()", () -> { + PlatformTestUtil.newPerformanceTest("get()", () -> { for (int i=0; i<200_000_000; i++) { assertNotNull(pointer.getFile()); } - }).assertTiming(); + }).start(); } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/WatchRootsManagerPerformanceTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/WatchRootsManagerPerformanceTest.kt index 29f0ad5f69ab..e2be53739ec6 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/WatchRootsManagerPerformanceTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/WatchRootsManagerPerformanceTest.kt @@ -78,12 +78,12 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() { try { val roots = (1..fileCount).map { "${root}/f${it}" } val requests = ArrayList(fileCount) - PlatformTestUtil.startPerformanceTest("Adding roots") { + PlatformTestUtil.newPerformanceTest("Adding roots") { roots.forEach { requests.add(fs.addRootToWatch(it, true)!!) } fs.removeWatchedRoots(requests) - }.assertTiming() + }.start() } finally { wait(NATIVE_PROCESS_DELAY) { watcher.isSettingRoots } @@ -97,9 +97,9 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() { try { val roots = (1..fileCount).map { "${root}/f${it}" } - PlatformTestUtil.startPerformanceTest("Adding roots") { + PlatformTestUtil.newPerformanceTest("Adding roots") { fs.removeWatchedRoots(fs.addRootsToWatch(roots, true)) - }.assertTiming() + }.start() } finally { wait(NATIVE_PROCESS_DELAY) { watcher.isSettingRoots } @@ -115,9 +115,9 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() { try { val rootPath = root.toString() - PlatformTestUtil.startPerformanceTest("Adding roots") { + PlatformTestUtil.newPerformanceTest("Adding roots") { fs.removeWatchedRoot(fs.addRootToWatch(rootPath, true)!!) - }.assertTiming() + }.start() } finally { wait(NATIVE_PROCESS_DELAY) { watcher.isSettingRoots } @@ -138,17 +138,17 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() { (1..5).forEach { pathMappings.add(Pair("$root/rec$i/ln$it", "$root/targets/rec$i/ln$it")) } } - PlatformTestUtil.startPerformanceTest("Create canonical path map") { + PlatformTestUtil.newPerformanceTest("Create canonical path map") { repeat(18) { WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, false) } - }.assertTimingAsSubtest() + }.startAsSubtest() - PlatformTestUtil.startPerformanceTest("Create canonical path map - convert paths") { + PlatformTestUtil.newPerformanceTest("Create canonical path map - convert paths") { repeat(18) { WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, true) } - }.assertTimingAsSubtest() + }.startAsSubtest() } @Test fun testCanonicalPathMapWithManySymlinks() { @@ -167,22 +167,22 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() { val map = WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, false) map.addMapping((1..filesCount).map { Pair("$root/src/ln$it-3", "$root/src/ln$it-3") }) - PlatformTestUtil.startPerformanceTest("Test apply mapping from canonical path map") { + PlatformTestUtil.newPerformanceTest("Test apply mapping from canonical path map") { repeat(1_000_000) { map.mapToOriginalWatchRoots("$root/src/ln${(Math.random() * 200_000).toInt()}", true) } - }.assertTimingAsSubtest() + }.startAsSubtest() - PlatformTestUtil.startPerformanceTest("Create canonical path map") { + PlatformTestUtil.newPerformanceTest("Create canonical path map") { repeat(100) { WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, false) } - }.assertTimingAsSubtest() + }.startAsSubtest() - PlatformTestUtil.startPerformanceTest("Create canonical path map - convert paths") { + PlatformTestUtil.newPerformanceTest("Create canonical path map - convert paths") { repeat(40) { WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, true) } - }.assertTimingAsSubtest() + }.startAsSubtest() } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java index a63ef2230185..9842d9fb034f 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java @@ -899,11 +899,11 @@ public class LocalFileSystemTest extends BareTestFixtureTestCase { @Test public void testFindFileByUrlPerformance() { VirtualFileManager virtualFileManager = VirtualFileManager.getInstance(); - PlatformTestUtil.startPerformanceTest("findFileByUrl", () -> { + PlatformTestUtil.newPerformanceTest("findFileByUrl", () -> { for (int i=0; i<10_000_000;i++) { assertNull(virtualFileManager.findFileByUrl("temp://")); } - }).assertTiming(); + }).start(); } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/LocalFileSystemStressTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/LocalFileSystemStressTest.java index ddfda1b86826..30d2c713a83d 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/LocalFileSystemStressTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/LocalFileSystemStressTest.java @@ -32,7 +32,7 @@ public class LocalFileSystemStressTest extends BareTestFixtureTestCase { assertThat(tmpRoot.getFileSystem()).isInstanceOf(TempFileSystem.class); VirtualFile testDir = WriteAction.computeAndWait(() -> tmpRoot.createChildDirectory(this, getTestName(true))); int N_LEVELS = 1_000_000; - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { UIUtil.pump(); StringBuilder expectedPath = new StringBuilder(N_LEVELS*4+100); expectedPath.append(testDir.getPath()); @@ -59,6 +59,6 @@ public class LocalFileSystemStressTest extends BareTestFixtureTestCase { finally { WriteAction.runAndWait(() -> testDir.delete(this)); } - }).attempts(1).assertTiming(); + }).attempts(1).start(); } } \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt index 3b4f2f04d379..c3a736272c3a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/persistent/VFSInitializationBenchmarkTest.kt @@ -14,7 +14,7 @@ class VFSInitializationBenchmarkTest { @Test @Throws(Exception::class) fun benchmarkVfsInitializationTime_CreateVfsFromScratch(@TempDir temporaryDirectory: Path) { - PlatformTestUtil.startPerformanceTest("create VFS from scratch") { + PlatformTestUtil.newPerformanceTest("create VFS from scratch") { val cachesDir: Path = temporaryDirectory val version = 1 @@ -26,7 +26,7 @@ class VFSInitializationBenchmarkTest { } .warmupIterations(1) .attempts(4) - .assertTiming() + .start() } @Test @@ -40,7 +40,7 @@ class VFSInitializationBenchmarkTest { ) PersistentFSConnector.disconnect(result.connection) - PlatformTestUtil.startPerformanceTest("open existing VFS files") { + PlatformTestUtil.newPerformanceTest("open existing VFS files") { val initResult = PersistentFSConnector.connectWithoutVfsLog( cachesDir, version @@ -49,6 +49,6 @@ class VFSInitializationBenchmarkTest { PersistentFSConnector.disconnect(initResult.connection) } .attempts(4) - .assertTiming() + .start() } } \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java b/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java index ad0ce9a512f0..0428f657e176 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/impl/search/LowLevelSearchUtilTest.java @@ -44,7 +44,7 @@ public class LowLevelSearchUtilTest extends TestCase { IntList found = new IntArrayList(new int[]{-1}); CharSequence text = StringUtil.repeat("xxx z ", 1000000); - PlatformTestUtil.startPerformanceTest("processTextOccurrences", ()-> { + PlatformTestUtil.newPerformanceTest("processTextOccurrences", ()-> { for (int i=0; i<10000; i++) { found.removeInt(0); int startOffset = text.length() / 2 + i % 20; @@ -56,6 +56,6 @@ public class LowLevelSearchUtilTest extends TestCase { assertTrue(success); assertEquals(startOffset+","+endOffset, 1, found.size()); } - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/psi/tree/TokenSetTest.java b/platform/platform-tests/testSrc/com/intellij/psi/tree/TokenSetTest.java index 6f6b2afc919f..91beec2a3729 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/tree/TokenSetTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/tree/TokenSetTest.java @@ -116,11 +116,11 @@ public class TokenSetTest { final TokenSet set = TokenSet.create(); final int shift = new Random().nextInt(500000); - PlatformTestUtil.startPerformanceTest("TokenSet.contains()", () -> { + PlatformTestUtil.newPerformanceTest("TokenSet.contains()", () -> { for (int i = 0; i < 1000000; i++) { final IElementType next = elementTypes[(i + shift) % elementTypes.length]; assertFalse(set.contains(next)); } - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/psi/util/MinusculeMatcherPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/psi/util/MinusculeMatcherPerformanceTest.java index 28354ffedb0c..25e7a128a15c 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/util/MinusculeMatcherPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/util/MinusculeMatcherPerformanceTest.java @@ -28,7 +28,7 @@ public class MinusculeMatcherPerformanceTest extends TestCase { nonMatching.add(NameUtil.buildMatcher(s, NameUtil.MatchingCaseSensitivity.NONE)); } - PlatformTestUtil.startPerformanceTest("Matching", () -> { + PlatformTestUtil.newPerformanceTest("Matching", () -> { for (int i = 0; i < 100_000; i++) { for (MinusculeMatcher matcher : matching) { Assert.assertTrue(matcher.matches(longName)); @@ -38,33 +38,33 @@ public class MinusculeMatcherPerformanceTest extends TestCase { Assert.assertFalse(matcher.matches(longName)); } } - }).assertTiming(); + }).start(); } public void testOnlyUnderscoresPerformance() { - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { String small = StringUtil.repeat("_", 50000); String big = StringUtil.repeat("_", small.length() + 1); assertMatches("*" + small, big); assertDoesntMatch("*" + big, small); - }).assertTiming(); + }).start(); } public void testRepeatedLetterPerformance() { - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { String big = StringUtil.repeat("Aaaaaa", 50000); assertMatches("aaaaaaaaaaaaaaaaaaaaaaaa", big); assertDoesntMatch("aaaaaaaaaaaaaaaaaaaaaaaab", big); - }).assertTiming(); + }).start(); } public void testMatchingLongHtmlWithShortHtml() { - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { String pattern = "*

aaa

com.sshtools.cipher
Class AES128Cbc
 java.lang.Object   \"extendedcom.maverick.ssh.cipher.SshCipher       \"extendedcom.maverick.ssh.crypto.engines.CbcBlockCipher           \"extendedcom.sshtools.cipher.AES128Cbc 

public class AES128Cbc
extends com.maverick.ssh.crypto.engines.CbcBlockCipher

This cipher can optionally be added to the J2SSH Maverick API. To add the ciphers from this package simply add them to the Ssh2Context

   import com.sshtools.cipher.*;   

Version:
Revision: 1.20

"; assertDoesntMatch(pattern, html); - }).assertTiming(); + }).start(); } public void testMatchingLongStringWithAnotherLongStringWhereOnlyEndsDiffer() { @@ -82,27 +82,27 @@ public class MinusculeMatcherPerformanceTest extends TestCase { } private void assertDoesntMatchFast(String pattern, String name, String subTestName) { - PlatformTestUtil.startPerformanceTest(getName(), () -> assertDoesntMatch(pattern, name)).assertTimingAsSubtest(subTestName); + PlatformTestUtil.newPerformanceTest(getName(), () -> assertDoesntMatch(pattern, name)).startAsSubtest(subTestName); } public void testMatchingLongRuby() { - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { String pattern = "*# -*- coding: utf-8 -*-$:. unshift(\"/Library/RubyMotion/lib\")require 'motion/project'Motion::Project::App. setup do |app| # Use `rake config' to see complete project settings. app. sdk_version = '4. 3'end"; String name = "# -*- coding: utf-8 -*-$:.unshift(\"/Library/RubyMotion/lib\")require 'motion/project'Motion::Project::App.setup do |app| # Use `rake config' to see complete project settings. app.sdk_version = '4.3' app.frameworks -= ['UIKit']end"; assertDoesntMatch(pattern, name); - }).assertTiming(); + }).start(); } public void testLongStringMatchingWithItself() { String s = "the class with its attributes mapped to fields of records parsed by an {@link AbstractParser} or written by an {@link AbstractWriter}."; - PlatformTestUtil.startPerformanceTest(getName(), () -> { + PlatformTestUtil.newPerformanceTest(getName(), () -> { assertMatches(s, s); assertMatches("*" + s, s); assertPreference(s, s.substring(0, 10), s); assertPreference("*" + s, s.substring(0, 10), s); - }).assertTiming(); + }).start(); } } diff --git a/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt b/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt index b0726b25148c..73006bf7acdd 100644 --- a/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/serviceContainer/ConstructorInjectionTest.kt @@ -16,11 +16,11 @@ class ConstructorInjectionTest { fun `light service getService() performance`() { val componentManager = TestComponentManager() assertThat(componentManager.getService(BarService::class.java)).isNotNull() - PlatformTestUtil.startPerformanceTest("getService() must be fast for cached service") { + PlatformTestUtil.newPerformanceTest("getService() must be fast for cached service") { for (i in 0..30_000_000) { componentManager.getService(BarService::class.java)!! } - }.assertTiming() + }.start() } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/ui/FileNameSplittingTest.java b/platform/platform-tests/testSrc/com/intellij/ui/FileNameSplittingTest.java index c53d59dc4813..2050b4fd6365 100644 --- a/platform/platform-tests/testSrc/com/intellij/ui/FileNameSplittingTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ui/FileNameSplittingTest.java @@ -118,12 +118,12 @@ public class FileNameSplittingTest extends TestCase { public void testPerformance() { myPolicy = FilePathSplittingPolicy.SPLIT_BY_SEPARATOR; - PlatformTestUtil.startPerformanceTest("FileNameSplitting", () -> { + PlatformTestUtil.newPerformanceTest("FileNameSplitting", () -> { for (int i = 0; i < 100; i++) { for (int j = 0; j < FILE.getPath().length(); j++) myPolicy.getPresentableName(FILE, j); } - }).assertTiming(); + }).start(); } private void doTest(String expected, int count) { diff --git a/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java b/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java index 2c2ff4109604..b2f04202d36e 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java @@ -92,7 +92,7 @@ class ConcurrentBitSetTest { PlatformTestUtil.assumeEnoughParallelism(); int L = 128; int N = 10_000; - PlatformTestUtil.startPerformanceTest("testStressFineGrainedSmallSetModifications", () -> tortureParallelSetClear(L, N)).assertTiming(); + PlatformTestUtil.newPerformanceTest("testStressFineGrainedSmallSetModifications", () -> tortureParallelSetClear(L, N)).start(); } @Test @@ -102,7 +102,7 @@ class ConcurrentBitSetTest { // todo ARM64 is slow for some reason int N = CpuArch.isArm64() ? 300 : 1000; - PlatformTestUtil.startPerformanceTest("testStressCoarseGrainedBigSet", () -> tortureParallelSetClear(L, N)).assertTiming(); + PlatformTestUtil.newPerformanceTest("testStressCoarseGrainedBigSet", () -> tortureParallelSetClear(L, N)).start(); } private static void tortureParallelSetClear(int L, int N) { @@ -196,7 +196,7 @@ class ConcurrentBitSetTest { int N = 100_000; ExecutorService executor = create4ThreadsExecutor(); - PlatformTestUtil.startPerformanceTest("testParallelReadPerformance", ()-> { + PlatformTestUtil.newPerformanceTest("testParallelReadPerformance", ()-> { Semaphore threadReady = new Semaphore(); Set threadUsed = ConcurrentCollectionFactory.createConcurrentSet(); boundedParallelRun(executor, threadUsed, threadReady, N, __-> { @@ -207,7 +207,7 @@ class ConcurrentBitSetTest { assertEquals(expectedSum, r); }); // really must not depend on CPU core number - })/**/.assertTiming(); + })/**/.start(); } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/util/containers/ContainerUtilTest.java b/platform/platform-tests/testSrc/com/intellij/util/containers/ContainerUtilTest.java index 64830f1ddf85..3f2b45020ce2 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/containers/ContainerUtilTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/containers/ContainerUtilTest.java @@ -173,14 +173,14 @@ public class ContainerUtilTest extends TestCase { List list = ContainerUtil.createLockFreeCopyOnWriteList(); int count = 15000; List ints = IntStreamEx.range(0, count).boxed().toList(); - PlatformTestUtil.startPerformanceTest("COWList add", () -> { + PlatformTestUtil.newPerformanceTest("COWList add", () -> { for (int it = 0; it < 10; it++) { list.clear(); for (int i = 0; i < count; i++) { list.add(ints.get(i)); } } - }).assertTiming(); + }).start(); for (int i = 0; i < list.size(); i++) { assertEquals(i, list.get(i)); } diff --git a/platform/platform-tests/testSrc/com/intellij/util/io/PersistentBTreeEnumeratorTest.java b/platform/platform-tests/testSrc/com/intellij/util/io/PersistentBTreeEnumeratorTest.java index 33e84cf4f985..1c638b5a93a1 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/io/PersistentBTreeEnumeratorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/io/PersistentBTreeEnumeratorTest.java @@ -225,7 +225,7 @@ public class PersistentBTreeEnumeratorTest { StorageLockContext.assertNoBuffersLocked(); FilePageCacheStatistics statsBefore = StorageLockContext.getStatistics(); - PlatformTestUtil.startPerformanceTest("PersistentStringEnumerator", () -> { + PlatformTestUtil.newPerformanceTest("PersistentStringEnumerator", () -> { for (int i = 0; i < 10000; i++) { for (String item : data) { assertNotEquals(0, myEnumerator.tryEnumerate(item)); @@ -235,7 +235,7 @@ public class PersistentBTreeEnumeratorTest { assertEquals(0, myEnumerator.tryEnumerate(item)); } } - }).warmupIterations(0).attempts(1).assertTiming(); + }).warmupIterations(0).attempts(1).start(); FilePageCacheStatistics statsAfter = StorageLockContext.getStatistics(); // ensure we don't cache anything @@ -327,7 +327,7 @@ public class PersistentBTreeEnumeratorTest { } }; - PlatformTestUtil.startPerformanceTest("PersistentStringEnumerator", () -> { + PlatformTestUtil.newPerformanceTest("PersistentStringEnumerator", () -> { stringCache.addDeletedPairsListener(listener); for (int i = 0; i < 100000; ++i) { String string = createRandomString(); @@ -335,7 +335,7 @@ public class PersistentBTreeEnumeratorTest { } stringCache.removeDeletedPairsListener(listener); stringCache.removeAll(); - }).assertTiming(); + }).start(); myEnumerator.close(); LOG.debug(String.format("File size = %d bytes\n", myFile.length())); } diff --git a/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapPerformanceTest.java index f4c35f9b0e68..f012542dd9b3 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapPerformanceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapPerformanceTest.java @@ -334,7 +334,7 @@ public class PersistentMapPerformanceTest extends PersistentMapTestBase { }; AtomicInteger count = new AtomicInteger(); - PlatformTestUtil.startPerformanceTest("put/remove", () -> { + PlatformTestUtil.newPerformanceTest("put/remove", () -> { try { stringCache.addDeletedPairsListener(listener); for (int i = 0; i < 100000; ++i) { @@ -354,7 +354,7 @@ public class PersistentMapPerformanceTest extends PersistentMapTestBase { catch (IOException e) { throw new RuntimeException(e); } - }).assertTiming(); + }).start(); myMap.close(); LOG.debug(String.format("File size = %d bytes\n", myFile.length())); @@ -368,7 +368,7 @@ public class PersistentMapPerformanceTest extends PersistentMapTestBase { strings.add(createRandomString()); } - PlatformTestUtil.startPerformanceTest("put/remove", () -> { + PlatformTestUtil.newPerformanceTest("put/remove", () -> { for (int i = 0; i < 100000; ++i) { final String string = strings.get(i); myMap.put(string, string); @@ -387,7 +387,7 @@ public class PersistentMapPerformanceTest extends PersistentMapTestBase { for (String string : strings) { myMap.remove(string); } - }).assertTiming(); + }).start(); myMap.close(); LOG.debug(String.format("File size = %d bytes\n", myFile.length())); LOG.debug(String.format("Data file size = %d bytes\n", diff --git a/platform/platform-tests/testSrc/com/intellij/util/io/StringEnumeratorTest.java b/platform/platform-tests/testSrc/com/intellij/util/io/StringEnumeratorTest.java index 6ce1a09d107a..ca2f849da8be 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/io/StringEnumeratorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/io/StringEnumeratorTest.java @@ -163,7 +163,7 @@ public class StringEnumeratorTest extends TestCase { } }; - PlatformTestUtil.startPerformanceTest("PersistentStringEnumerator.enumerate", () -> { + PlatformTestUtil.newPerformanceTest("PersistentStringEnumerator.enumerate", () -> { stringCache.addDeletedPairsListener(listener); for (int i = 0; i < 100000; ++i) { final String string = createRandomString(); @@ -171,7 +171,7 @@ public class StringEnumeratorTest extends TestCase { } stringCache.removeDeletedPairsListener(listener); stringCache.removeAll(); - }).attempts(1).assertTiming(); + }).attempts(1).start(); myEnumerator.close(); System.out.printf("File size = %d bytes\n", myFile.length()); } diff --git a/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt b/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt index 261b58da926f..ad5eca47ab05 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/util/messages/impl/MessageBusTest.kt @@ -243,7 +243,7 @@ class MessageBusTest : MessageBusOwner { @Test fun manyChildrenCreationDeletionPerformance() { - PlatformTestUtil.startPerformanceTest("Child bus creation/deletion") { + PlatformTestUtil.newPerformanceTest("Child bus creation/deletion") { val children = ArrayList() val count = 10000 for (i in 0 until count) { @@ -253,7 +253,7 @@ class MessageBusTest : MessageBusOwner { for (i in count - 1 downTo 0) { Disposer.dispose(children[i]) } - }.assertTiming() + }.start() } @Test diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java index e3667bf047ef..e9b0398c4fc2 100644 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java +++ b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java @@ -369,13 +369,13 @@ public class OutputEventSplitterTest extends LightPlatformTestCase { } public void testPerformanceWithLotsOfFragments() { - PlatformTestUtil.startPerformanceTest("Flushing lot's of fragments", mySplitter::flush) + PlatformTestUtil.newPerformanceTest("Flushing lot's of fragments", mySplitter::flush) .setup(() -> { for (int i = 0; i < 10_000; i++) { mySplitter.process("some string without slash n appending in raw, attempt: " + i + "; ", ProcessOutputTypes.STDOUT); } }) - .assertTiming(); + .start(); } public void testPerformanceSimple() { @@ -386,12 +386,12 @@ public class OutputEventSplitterTest extends LightPlatformTestCase { } }; - PlatformTestUtil.startPerformanceTest("print newlines with backspace", () -> { + PlatformTestUtil.newPerformanceTest("print newlines with backspace", () -> { for (int i = 0; i < 2_000_000; i++) { mySplitter.process("some string without slash n appending in raw, attempt: " + i + "; ", ProcessOutputTypes.STDOUT); mySplitter.process(testStarted, ProcessOutputTypes.STDOUT); } - }).assertTiming(); + }).start(); } private static Future execute(final Runnable runnable) { diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java index 27ec3769a4ef..175f34196024 100644 --- a/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java +++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java @@ -2048,18 +2048,18 @@ public class StructuralReplaceTest extends StructuralReplaceTestCase { final String pattern = loadFile("ReformatAndShortenClassRefPerformance_pattern.java"); final String replacement = loadFile("ReformatAndShortenClassRefPerformance_replacement.java"); - PlatformTestUtil.startPerformanceTest("SSR Reformat", - () -> assertEquals("Reformat Performance", loadFile("ReformatPerformance_result.java"), + PlatformTestUtil.newPerformanceTest("SSR Reformat", + () -> assertEquals("Reformat Performance", loadFile("ReformatPerformance_result.java"), replace(source, pattern, replacement, true, true))) - .assertTimingAsSubtest(); + .startAsSubtest(); options.setToReformatAccordingToStyle(false); options.setToShortenFQN(true); - PlatformTestUtil.startPerformanceTest("SSR Shorten Class Reference", - () -> assertEquals("Shorten Class Ref Performance", loadFile("ShortenPerformance_result.java"), + PlatformTestUtil.newPerformanceTest("SSR Shorten Class Reference", + () -> assertEquals("Shorten Class Ref Performance", loadFile("ShortenPerformance_result.java"), replace(source, pattern, replacement, true, true))) - .assertTimingAsSubtest(); + .startAsSubtest(); } public void testLeastSurprise() { diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/inspection/SSBasedInspectionTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/inspection/SSBasedInspectionTest.java index bf5df23db8d9..7d5f18d2943e 100644 --- a/platform/structuralsearch/testSource/com/intellij/structuralsearch/inspection/SSBasedInspectionTest.java +++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/inspection/SSBasedInspectionTest.java @@ -82,11 +82,11 @@ public class SSBasedInspectionTest extends SSBasedInspectionTestCase { final ToolsImpl tools = profile.getToolsOrNull("SSBasedInspection", myFixture.getProject()); final SSBasedInspection inspection = (SSBasedInspection)tools.getTool().getTool(); final PsiFile file = myFixture.getFile(); - PlatformTestUtil.startPerformanceTest("Chained method call inspection performance", - () -> InspectionEngine.inspectEx( + PlatformTestUtil.newPerformanceTest("Chained method call inspection performance", + () -> InspectionEngine.inspectEx( Collections.singletonList(new LocalInspectionToolWrapper(inspection)), file, file.getTextRange(), - file.getTextRange(), true, false, true, new DaemonProgressIndicator(), PairProcessor.alwaysTrue())).assertTiming(); + file.getTextRange(), true, false, true, new DaemonProgressIndicator(), PairProcessor.alwaysTrue())).start(); } public void doTest(String pattern, String name) { diff --git a/platform/testFramework/src/com/intellij/testFramework/PerformanceTestInfo.java b/platform/testFramework/src/com/intellij/testFramework/PerformanceTestInfo.java index 310a9e1724f2..4bb93552dcdc 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PerformanceTestInfo.java +++ b/platform/testFramework/src/com/intellij/testFramework/PerformanceTestInfo.java @@ -4,7 +4,6 @@ package com.intellij.testFramework; import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.util.ThrowableComputable; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.platform.diagnostic.telemetry.IJTracer; import com.intellij.platform.diagnostic.telemetry.Scope; import com.intellij.platform.diagnostic.telemetry.TelemetryManager; @@ -43,7 +42,6 @@ public class PerformanceTestInfo { private final ThrowableComputable test; // runnable to measure; returns actual input size private final int expectedInputSize; // size of input the test is expected to process; private ThrowableRunnable setup; // to run before each test - private int usedReferenceCpuCores = 1; private int maxMeasurementAttempts = 3; // number of retries private final String launchName; // to print on fail private int warmupIterations = 1; // default warmup iterations should be positive @@ -105,8 +103,7 @@ public class PerformanceTestInfo { } /** - * Runs the payload {@code iterations} times before starting measuring the time. - * By default, iterations == 0 (in which case we don't run warmup passes at all) + * Runs the perf test {@code iterations} times before starting the final measuring. */ @Contract(pure = true) // to warn about not calling .assertTiming() in the end public PerformanceTestInfo warmupIterations(int iterations) { @@ -157,64 +154,64 @@ public class PerformanceTestInfo { return callingTestMethod; } - /** @see PerformanceTestInfo#assertTiming(String) */ - public void assertTiming() { - assertTiming(getCallingTestMethod()); + /** @see PerformanceTestInfo#start(String) */ + public void start() { + start(getCallingTestMethod()); } - public void assertTiming(@NotNull Method javaTestMethod) { - assertTiming(javaTestMethod, ""); + public void start(@NotNull Method javaTestMethod) { + start(javaTestMethod, ""); } - public void assertTiming(@NotNull Method javaTestMethod, String subTestName) { + public void start(@NotNull Method javaTestMethod, String subTestName) { var fullTestName = String.format("%s.%s", javaTestMethod.getDeclaringClass().getName(), javaTestMethod.getName()); if (subTestName != null && !subTestName.isEmpty()) { fullTestName += " - " + subTestName; } - assertTiming(fullTestName); + start(fullTestName); } /** - * {@link PerformanceTestInfo#assertTiming(String)} + * {@link PerformanceTestInfo#start(String)} *
* Eg: assertTiming(GradleHighlightingPerformanceTest::testCompletionPerformance) */ - public void assertTiming(@NotNull KFunction kotlinTestMethod) { - assertTiming(String.format("%s.%s", kotlinTestMethod.getClass().getName(), kotlinTestMethod.getName())); + public void start(@NotNull KFunction kotlinTestMethod) { + start(String.format("%s.%s", kotlinTestMethod.getClass().getName(), kotlinTestMethod.getName())); } /** * By default passed test launch name will be used as the subtest name. * - * @see PerformanceTestInfo#assertTimingAsSubtest(String) + * @see PerformanceTestInfo#startAsSubtest(String) */ - public void assertTimingAsSubtest() { - assertTimingAsSubtest(launchName); + public void startAsSubtest() { + startAsSubtest(launchName); } /** * In case if you want to run many subsequent performance measurements in your JUnit test. * - * @see PerformanceTestInfo#assertTiming(String) + * @see PerformanceTestInfo#start(String) */ - public void assertTimingAsSubtest(@Nullable String subTestName) { - assertTiming(getCallingTestMethod(), subTestName); + public void startAsSubtest(@Nullable String subTestName) { + start(getCallingTestMethod(), subTestName); } /** - * Asserts expected timing. + * Start execution of the performance test. * * @param fullQualifiedTestMethodName String representation of full method name. * For Java you can use {@link com.intellij.testFramework.UsefulTestCase#getQualifiedTestMethodName()} * OR * {@link com.intellij.testFramework.fixtures.BareTestFixtureTestCase#getQualifiedTestMethodName()} */ - public void assertTiming(String fullQualifiedTestMethodName) { - assertTiming(IterationMode.WARMUP, fullQualifiedTestMethodName); - assertTiming(IterationMode.MEASURE, fullQualifiedTestMethodName); + public void start(String fullQualifiedTestMethodName) { + start(IterationMode.WARMUP, fullQualifiedTestMethodName); + start(IterationMode.MEASURE, fullQualifiedTestMethodName); } - private void assertTiming(IterationMode iterationType, String fullQualifiedTestMethodName) { + private void start(IterationMode iterationType, String fullQualifiedTestMethodName) { if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return; System.out.printf("Starting performance test in mode: %s%n", iterationType); diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 61757d766f0a..50bbd0d6f64a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -636,29 +636,29 @@ public final class PlatformTestUtil { } /** - * An example: {@code startPerformanceTest("calculating pi",100, testRunnable).assertTiming();} + * E.g: {@code newPerformanceTest("calculating pi", () -> { CODE_TO_BE_MEASURED_IS_HERE }).assertTiming();} */ // to warn about not calling .assertTiming() in the end @Contract(pure = true) - public static @NotNull PerformanceTestInfo startPerformanceTest(@NonNls @NotNull String launchName, @NotNull ThrowableRunnable test) { - return startPerformanceTestWithVariableInputSize(launchName, 1, () -> { + public static @NotNull PerformanceTestInfo newPerformanceTest(@NonNls @NotNull String launchName, @NotNull ThrowableRunnable test) { + return newPerformanceTestWithVariableInputSize(launchName, 1, () -> { test.run(); return 1; }); } /** - * Starts a performance test which input (and therefore expected time to execute) may change, - * e.g. it depends on the number of files in the project. + * Init a performance test which input may change. + * E.g. it depends on the number of files in the project. *

- * {@code expectedInputSize} parameter specifies size of the input for which the test is expected to finish in {@code expectedMs} milliseconds, + * {@code expectedInputSize} parameter specifies size of the input, * {@code test} returns actual size of the input. It is supposed that the execution time is lineally proportionally dependent on the input size. *

*/ @Contract(pure = true) - public static @NotNull PerformanceTestInfo startPerformanceTestWithVariableInputSize(@NonNls @NotNull String launchName, - int expectedInputSize, - @NotNull ThrowableComputable test) { + public static @NotNull PerformanceTestInfo newPerformanceTestWithVariableInputSize(@NonNls @NotNull String launchName, + int expectedInputSize, + @NotNull ThrowableComputable test) { return new PerformanceTestInfo(test, expectedInputSize, launchName); } diff --git a/platform/util/testSrc/com/intellij/openapi/util/DisposerTest.java b/platform/util/testSrc/com/intellij/openapi/util/DisposerTest.java index b473e945dfd6..259ba53d67c5 100644 --- a/platform/util/testSrc/com/intellij/openapi/util/DisposerTest.java +++ b/platform/util/testSrc/com/intellij/openapi/util/DisposerTest.java @@ -668,7 +668,7 @@ public class DisposerTest { Disposable root = Disposer.newDisposable("test_root"); Disposable[] children = IntStream.range(0, N).mapToObj(i -> Disposer.newDisposable("child " + i)).toArray(Disposable[]::new); - PlatformTestUtil.startPerformanceTest(name.getMethodName(), () -> { + PlatformTestUtil.newPerformanceTest(name.getMethodName(), () -> { for (Disposable child : children) { Disposer.register(root, child); } @@ -680,6 +680,6 @@ public class DisposerTest { Disposer.dispose(root); Disposer.register(myRoot, root); }) - .assertTiming(); + .start(); } } diff --git a/platform/util/testSrc/com/intellij/util/text/ImmutableTextTest.java b/platform/util/testSrc/com/intellij/util/text/ImmutableTextTest.java index aeff2b0b44c3..ba20d9fac2a8 100644 --- a/platform/util/testSrc/com/intellij/util/text/ImmutableTextTest.java +++ b/platform/util/testSrc/com/intellij/util/text/ImmutableTextTest.java @@ -23,13 +23,13 @@ public class ImmutableTextTest extends UsefulTestCase { public void testDeleteAllPerformance() { ImmutableText original = ImmutableText.valueOf(StringUtil.repeat("abcdefghij", 1_900_000)); - PlatformTestUtil.startPerformanceTest("Deletion of all contents must be fast", () -> { + PlatformTestUtil.newPerformanceTest("Deletion of all contents must be fast", () -> { for (int iter = 0; iter < 100000; iter++) { ImmutableText another = original.delete(0, original.length()); assertEquals(0, another.length()); assertEquals("", another.toString()); } - }).assertTiming(); + }).start(); } private static void assertBalanced(CharSequence node) { diff --git a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/changes/HierarchicalFilePathComparatorTest.java b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/changes/HierarchicalFilePathComparatorTest.java index fb0f88333baa..a6d252671be0 100644 --- a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/changes/HierarchicalFilePathComparatorTest.java +++ b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/changes/HierarchicalFilePathComparatorTest.java @@ -275,23 +275,23 @@ public class HierarchicalFilePathComparatorTest extends TestCase { public void testNaturalPerformance() { List filePaths = generatePerformanceTestFilePaths(); - PlatformTestUtil.startPerformanceTest("Natural hierarchical comparator", () -> { + PlatformTestUtil.newPerformanceTest("Natural hierarchical comparator", () -> { assertComparisonContractNotViolated(filePaths, HierarchicalFilePathComparator.NATURAL); - }).assertTiming(); + }).start(); } public void testCaseInsensitivePerformance() { List filePaths = generatePerformanceTestFilePaths(); - PlatformTestUtil.startPerformanceTest("Case-insensitive hierarchical comparator", () -> { + PlatformTestUtil.newPerformanceTest("Case-insensitive hierarchical comparator", () -> { assertComparisonContractNotViolated(filePaths, HierarchicalFilePathComparator.CASE_INSENSITIVE); - }).assertTiming(); + }).start(); } public void testCaseSensitivePerformance() { List filePaths = generatePerformanceTestFilePaths(); - PlatformTestUtil.startPerformanceTest("Case-sensitive hierarchical comparator", () -> { + PlatformTestUtil.newPerformanceTest("Case-sensitive hierarchical comparator", () -> { assertComparisonContractNotViolated(filePaths, HierarchicalFilePathComparator.CASE_SENSITIVE); - }).assertTiming(); + }).start(); } private static List generatePerformanceTestFilePaths() { diff --git a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/DirectoryMappingListTest.kt b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/DirectoryMappingListTest.kt index 59371647d659..68ed7c8e8526 100644 --- a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/DirectoryMappingListTest.kt +++ b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/DirectoryMappingListTest.kt @@ -338,13 +338,13 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() { "$rootPath/parent/non_existent/some/path" ).map { it.filePath } - PlatformTestUtil.startPerformanceTest("NewMappings few roots FilePaths") { + PlatformTestUtil.newPerformanceTest("NewMappings few roots FilePaths") { for (i in 0..20000) { for (filePath in toCheck) { mappings.getMappedRootFor(filePath) } } - }.assertTiming() + }.start() } fun testPerformanceManyRootsFilePaths() { @@ -361,13 +361,13 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() { "$rootPath/non_existent/some/path" ).map { it.filePath } - PlatformTestUtil.startPerformanceTest("NewMappings many roots FilePaths") { + PlatformTestUtil.newPerformanceTest("NewMappings many roots FilePaths") { for (i in 0..20000) { for (filePath in toCheck) { mappings.getMappedRootFor(filePath) } } - }.assertTiming() + }.start() } fun testPerformanceNestedRootsFilePaths() { @@ -388,13 +388,13 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() { "$rootPath/parent/" + "dir/".repeat(220) ).map { it.filePath } - PlatformTestUtil.startPerformanceTest("NewMappings nested roots FilePaths") { + PlatformTestUtil.newPerformanceTest("NewMappings nested roots FilePaths") { for (i in 0..2000) { for (filePath in toCheck) { mappings.getMappedRootFor(filePath) } } - }.assertTiming() + }.start() } fun testPerformanceFewRootsVirtualFiles() { @@ -412,13 +412,13 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() { "$rootPath/parent/non_existent/some/path" )) - PlatformTestUtil.startPerformanceTest("NewMappings few roots VirtualFiles") { + PlatformTestUtil.newPerformanceTest("NewMappings few roots VirtualFiles") { for (i in 0..60000) { for (filePath in toCheck) { mappings.getMappedRootFor(filePath) } } - }.assertTiming() + }.start() } fun testPerformanceManyRootsVirtualFiles() { @@ -435,13 +435,13 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() { "$rootPath/non_existent/some/path" )) - PlatformTestUtil.startPerformanceTest("NewMappings many roots VirtualFiles") { + PlatformTestUtil.newPerformanceTest("NewMappings many roots VirtualFiles") { for (i in 0..80000) { for (filePath in toCheck) { mappings.getMappedRootFor(filePath) } } - }.assertTiming() + }.start() } fun testPerformanceNestedRootsVirtualFiles() { @@ -462,13 +462,13 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() { "$rootPath/parent/" + "dir/".repeat(200) )) - PlatformTestUtil.startPerformanceTest("NewMappings nested roots VirtualFiles") { + PlatformTestUtil.newPerformanceTest("NewMappings nested roots VirtualFiles") { for (i in 0..15000) { for (filePath in toCheck) { mappings.getMappedRootFor(filePath) } } - }.assertTiming() + }.start() } fun testRootMappingAppliedInSync1() { diff --git a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/LineStatusTrackerModifyPerformanceTest.kt b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/LineStatusTrackerModifyPerformanceTest.kt index e2c8c81c3197..ffe6a274eaa2 100644 --- a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/LineStatusTrackerModifyPerformanceTest.kt +++ b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/LineStatusTrackerModifyPerformanceTest.kt @@ -16,13 +16,13 @@ class LineStatusTrackerModifyPerformanceTest : BaseLineStatusTrackerTestCase() { val text1 = sb1.toString() val text2 = sb2.toString() - PlatformTestUtil.startPerformanceTest(PlatformTestUtil.getTestName(name, true)) { + PlatformTestUtil.newPerformanceTest(PlatformTestUtil.getTestName(name, true)) { test(text1) { tracker.doFrozen(Runnable { simpleTracker.setBaseRevision(text2) }) } - }.assertTiming() + }.start() } fun testDirtyUnfreeze() { @@ -41,12 +41,12 @@ class LineStatusTrackerModifyPerformanceTest : BaseLineStatusTrackerTestCase() { val text2 = sb2.toString() val text3 = sb3.toString() - PlatformTestUtil.startPerformanceTest(PlatformTestUtil.getTestName(name, true)) { + PlatformTestUtil.newPerformanceTest(PlatformTestUtil.getTestName(name, true)) { test(text1, text2) { tracker.doFrozen(Runnable { simpleTracker.setBaseRevision(text3) }) } - }.assertTiming() + }.start() } } diff --git a/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelBenchmarksPerformanceTest.kt b/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelBenchmarksPerformanceTest.kt index 4b951cca8f06..0fb5f274d26c 100644 --- a/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelBenchmarksPerformanceTest.kt +++ b/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelBenchmarksPerformanceTest.kt @@ -94,7 +94,7 @@ class WorkspaceModelBenchmarksPerformanceTest { var storage = MutableEntityStorage.create().toSnapshot() val times = 20_000 - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { repeat(times) { val builder = storage.toBuilder() @@ -109,7 +109,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -119,7 +119,7 @@ class WorkspaceModelBenchmarksPerformanceTest { val times = 2_000_000 - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { repeat(times) { val entity = storage.entities(NamedEntity::class.java).single() blackhole(entity) @@ -129,7 +129,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -139,21 +139,21 @@ class WorkspaceModelBenchmarksPerformanceTest { val times = 2_000_000 val parents = ArrayList(times) - PlatformTestUtil.startPerformanceTest("Named entities adding") { + PlatformTestUtil.newPerformanceTest("Named entities adding") { repeat(times) { parents += builder addEntity NamedEntity("$it", MySource) } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() - PlatformTestUtil.startPerformanceTest("Soft linked entities adding") { + PlatformTestUtil.newPerformanceTest("Soft linked entities adding") { for (parent in parents) { builder addEntity ComposedIdSoftRefEntity("-${parent.myName}", parent.symbolicId, MySource) } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() } @Test @@ -168,7 +168,7 @@ class WorkspaceModelBenchmarksPerformanceTest { val storage = builder.toSnapshot() val newBuilder = storage.toBuilder() - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { repeat(size) { val value = newBuilder.resolve(NameId("$it"))!! newBuilder.modifyEntity(value) { @@ -177,7 +177,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -193,13 +193,13 @@ class WorkspaceModelBenchmarksPerformanceTest { val storage = builder.toSnapshot() val list = mutableListOf() - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { repeat(size) { list.addAll(storage.referrers(NameId("$it"), ComposedIdSoftRefEntity::class.java).toList()) } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -218,38 +218,38 @@ class WorkspaceModelBenchmarksPerformanceTest { val file = Files.createTempFile("tmpModel", "") try { - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - Serialization") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - Serialization") { repeat(200) { serializer.serializeCache(file, storage) } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - Deserialization") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - Deserialization") { repeat(200) { sizes += Files.size(file).toInt() serializer.deserializeCache(file).getOrThrow() } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - SerializationFromFile") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - SerializationFromFile") { repeat(200) { serializer.serializeCache(file, storage) } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - DeserializationFromFile") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - DeserializationFromFile") { repeat(200) { serializer.deserializeCache(file).getOrThrow() } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() } finally { Files.deleteIfExists(file) @@ -279,16 +279,16 @@ class WorkspaceModelBenchmarksPerformanceTest { }) } - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { storageBuilder.replaceBySource({ true }, replaceStorage) } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test fun `project model updates`(testInfo: TestInfo) { - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { runWriteActionAndWait { measureTimeMillis { repeat(10_000) { @@ -300,7 +300,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -308,7 +308,7 @@ class WorkspaceModelBenchmarksPerformanceTest { val manager = WorkspaceModel.getInstance(projectModel.project).getVirtualFileUrlManager() val newFolder = tempFolder.newRandomDirectory() - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { runWriteActionAndWait { measureTimeMillis { EntitiesOrphanage.getInstance(projectModel.project).update { @@ -328,7 +328,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() ApplicationManager.getApplication().invokeAndWait { PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue() @@ -344,7 +344,7 @@ class WorkspaceModelBenchmarksPerformanceTest { val newFolder = VfsUtilCore.pathToUrl(tempFolder.newRandomDirectory().toString()) val manager = WorkspaceModel.getInstance(projectModel.project).getVirtualFileUrlManager() - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { runWriteActionAndWait { measureTimeMillis { EntitiesOrphanage.getInstance(projectModel.project).update { @@ -375,7 +375,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() ApplicationManager.getApplication().invokeAndWait { PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue() @@ -391,7 +391,7 @@ class WorkspaceModelBenchmarksPerformanceTest { val newFolder = tempFolder.newRandomDirectory() val manager = WorkspaceModel.getInstance(projectModel.project).getVirtualFileUrlManager() - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { runWriteActionAndWait { measureTimeMillis { EntitiesOrphanage.getInstance(projectModel.project).update { @@ -421,7 +421,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() ApplicationManager.getApplication().invokeAndWait { PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue() @@ -434,7 +434,7 @@ class WorkspaceModelBenchmarksPerformanceTest { @Test fun `update storage via replaceProjectModel`(testInfo: TestInfo) { - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { runWriteActionAndWait { repeat(1000) { val builderSnapshot = WorkspaceModel.getInstance(projectModel.project).internal.getBuilderSnapshot() @@ -444,7 +444,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() // TODO: second part of the tests need to be implemented later "applyStorageTime" - variable // (or unit perf metrics publishing should be able to read meters from CSV (where we may store counters) @@ -505,11 +505,11 @@ class WorkspaceModelBenchmarksPerformanceTest { } as MutableEntityStorageInstrumentation } - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { builders.forEach { it.collectChanges() } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -555,13 +555,13 @@ class WorkspaceModelBenchmarksPerformanceTest { } } - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { builders.zip(newBuilders).forEach { (initial, update) -> initial.applyChangesFrom(update) } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -586,7 +586,7 @@ class WorkspaceModelBenchmarksPerformanceTest { builder.toSnapshot().toBuilder() } - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { builders.forEach { builder -> // Populate builder with changes repeat(1000) { @@ -604,7 +604,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @Test @@ -642,7 +642,7 @@ class WorkspaceModelBenchmarksPerformanceTest { val childData = entities().flatMap { parentEntity, _ -> parentEntity.children }.map { it.childData } // Do first request - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - First Access") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - First Access") { snapshots.forEach { snapshot -> snapshot.cached(namesOfNamedEntities) snapshot.cached(sourcesByName) @@ -650,10 +650,10 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() // Do second request without any modifications - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - Second Access - No Changes") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - Second Access - No Changes") { snapshots.forEach { snapshot -> snapshot.cached(namesOfNamedEntities) snapshot.cached(sourcesByName) @@ -661,7 +661,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() println("Modify after second read") // Modify snapshots @@ -692,7 +692,7 @@ class WorkspaceModelBenchmarksPerformanceTest { println("Start third read...") // Do request after modifications - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - Third Access - After Modification") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - Third Access - After Modification") { newSnapshots.forEach { snapshot -> snapshot.cached(namesOfNamedEntities) snapshot.cached(sourcesByName) @@ -700,7 +700,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() println("Modify snapshots second time") val snapshotsWithLotOfUpdates = newSnapshots.map { snapshot -> @@ -732,7 +732,7 @@ class WorkspaceModelBenchmarksPerformanceTest { Assertions.assertFalse(CacheResetTracker.cacheReset) - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - Fourth Access - After Second Modification") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - Fourth Access - After Second Modification") { snapshotsWithLotOfUpdates.forEach { snapshot -> snapshot.cached(namesOfNamedEntities) snapshot.cached(sourcesByName) @@ -740,7 +740,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() println("Modify snapshots third time") val snapshotsWithTonsOfUpdates = snapshotsWithLotOfUpdates.map { snapshot -> @@ -760,7 +760,7 @@ class WorkspaceModelBenchmarksPerformanceTest { Assertions.assertTrue(CacheResetTracker.cacheReset) println("Read fourth time") - PlatformTestUtil.startPerformanceTest("${testInfo.displayName} - Fifth Access - After a Lot of Modifications") { + PlatformTestUtil.newPerformanceTest("${testInfo.displayName} - Fifth Access - After a Lot of Modifications") { snapshotsWithTonsOfUpdates.forEach { snapshot -> snapshot.cached(namesOfNamedEntities) snapshot.cached(sourcesByName) @@ -768,7 +768,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() } @Test @@ -818,7 +818,7 @@ class WorkspaceModelBenchmarksPerformanceTest { var mySnapshot = builder.toSnapshot() - PlatformTestUtil.startPerformanceTest(testInfo.displayName) { + PlatformTestUtil.newPerformanceTest(testInfo.displayName) { repeat(size) { val myBuilder = mySnapshot.toBuilder() val entity = myBuilder.resolve(NameId("Name$it"))!! @@ -827,7 +827,7 @@ class WorkspaceModelBenchmarksPerformanceTest { } } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @ParameterizedTest @@ -843,49 +843,49 @@ class WorkspaceModelBenchmarksPerformanceTest { var snapshot = builder.toSnapshot() println("Test one --- Raw recalculate") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + " raw calculate - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + " raw calculate - size: $size") { val time = measureTime { snapshot.entities().map { it.myName }.toList() } println("Raw recalculate. size: $size, time: $time.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() println() println("Test two --- First calculate") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- first calculate - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- first calculate - size: $size") { val time2 = measureTime { snapshot.cached(q) } println("First recalculate. size: $size, time: $time2.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() println() println("Test three --- Unmodified second access") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- second access - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- second access - size: $size") { val time3 = measureTime { snapshot.cached(q) } println("Unmodified second access. size: $size, time: $time3.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() snapshot = snapshot.toBuilder().also { it.addEntity(NamedEntity("XX", MySource)) }.toSnapshot() println() println("Test four --- Add one entity") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- Add one entity - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- Add one entity - size: $size") { val time4 = measureTime { snapshot.cached(q) } println("Add one entity. size: $size, time: $time4.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() snapshot = snapshot.toBuilder().also { builder1 -> // Remove 10% of entities @@ -906,14 +906,14 @@ class WorkspaceModelBenchmarksPerformanceTest { println() println("Test five --- Update 10% of entities") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- Affect 10% of entities - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- Affect 10% of entities - size: $size") { val time5 = measureTime { snapshot.cached(q) } println("Update 10% of entities. size: $size, time: $time5.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @ParameterizedTest @@ -936,7 +936,7 @@ class WorkspaceModelBenchmarksPerformanceTest { var snapshot = builder.toSnapshot() println("Test one --- Raw recalculate") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + " raw calculate - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + " raw calculate - size: $size") { val time = measureTime { snapshot.entities() .flatMap { it.children } @@ -947,29 +947,29 @@ class WorkspaceModelBenchmarksPerformanceTest { println("Raw recalculate. size: $size, time: $time.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() println() println("Test two --- First calculate") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- first calculate - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- first calculate - size: $size") { val time2 = measureTime { snapshot.cached(q) } println("First recalculate. size: $size, time: $time2.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() println() println("Test three --- Unmodified second access") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- second access - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- second access - size: $size") { val time3 = measureTime { snapshot.cached(q) } println("Unmodified second access. size: $size, time: $time3.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() snapshot = snapshot.toBuilder().also { it addEntity NamedEntity("XX", MySource) { @@ -979,14 +979,14 @@ class WorkspaceModelBenchmarksPerformanceTest { println() println("Test four --- Add one entity") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- Add one entity - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- Add one entity - size: $size") { val time4 = measureTime { snapshot.cached(q) } println("Add one entity. size: $size, time: $time4.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() snapshot = snapshot.toBuilder().also { builder1 -> // Remove 10% of entities @@ -1014,7 +1014,7 @@ class WorkspaceModelBenchmarksPerformanceTest { println() println("Test five --- Update 10% of entities") - PlatformTestUtil.startPerformanceTest(testInfo.displayName + "- Affect 10% of entities - size: $size") { + PlatformTestUtil.newPerformanceTest(testInfo.displayName + "- Affect 10% of entities - size: $size") { val time51 = measureTime { snapshot.cached(q) } @@ -1022,7 +1022,7 @@ class WorkspaceModelBenchmarksPerformanceTest { println("Update 10% of entities. size: $size, time: $time5.") } .warmupIterations(0) - .attempts(1).assertTiming() + .attempts(1).start() } @ParameterizedTest @@ -1126,11 +1126,11 @@ class WorkspaceModelBenchmarksPerformanceTest { fun `get for kotlin persistent map`(size: Int) { val requestSize = 10_000_000 - PlatformTestUtil.startPerformanceTest(size.toString()) { + PlatformTestUtil.newPerformanceTest(size.toString()) { testPersistentMap(size, requestSize) } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() } @Suppress("SameParameterValue") @@ -1154,17 +1154,17 @@ class WorkspaceModelBenchmarksPerformanceTest { private fun measureOperation(launchName: String, singleBuilderEntities: List>, perBuilderEntities: List>, operation: (Int, Pair) -> Unit): Unit { - PlatformTestUtil.startPerformanceTest("$launchName-singleBuilderEntities") { + PlatformTestUtil.newPerformanceTest("$launchName-singleBuilderEntities") { singleBuilderEntities.forEachIndexed(operation) } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() - PlatformTestUtil.startPerformanceTest("$launchName-perBuilderEntities") { + PlatformTestUtil.newPerformanceTest("$launchName-perBuilderEntities") { perBuilderEntities.forEachIndexed(operation) } .warmupIterations(0) - .attempts(1).assertTimingAsSubtest() + .attempts(1).startAsSubtest() } diff --git a/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelPerformanceTest.kt b/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelPerformanceTest.kt index 89153c0402ba..b60022a5c2e6 100644 --- a/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelPerformanceTest.kt +++ b/platform/workspace/jps/tests/testSrc/com/intellij/workspaceModel/ide/WorkspaceModelPerformanceTest.kt @@ -100,17 +100,17 @@ class WorkspaceModelPerformanceTest { @Test fun `add remove module`() { - PlatformTestUtil.startPerformanceTest("Adding and removing a module 10 times") { + PlatformTestUtil.newPerformanceTest("Adding and removing a module 10 times") { repeat(10) { val module = ourProjectModel.createModule("newModule") ourProjectModel.removeModule(module) } - }.warmupIterations(15).assertTiming() + }.warmupIterations(15).start() } @Test fun `add remove project library`() { - PlatformTestUtil.startPerformanceTest("Adding and removing a project library 30 times") { + PlatformTestUtil.newPerformanceTest("Adding and removing a project library 30 times") { repeat(30) { val library = ourProjectModel.addProjectLevelLibrary("newLibrary") { it.addRoot(ourProjectRoot.append("newLibrary/classes").url, OrderRootType.CLASSES) @@ -119,13 +119,13 @@ class WorkspaceModelPerformanceTest { ourProjectModel.projectLibraryTable.removeLibrary(library) } } - }.warmupIterations(15).assertTiming() + }.warmupIterations(15).start() } @Test fun `add remove module library`() { val module = ourProjectModel.moduleManager.findModuleByName("module50")!! - PlatformTestUtil.startPerformanceTest("Adding and removing a module library 10 times") { + PlatformTestUtil.newPerformanceTest("Adding and removing a module library 10 times") { repeat(10) { val library = ourProjectModel.addModuleLevelLibrary(module, "newLibrary") { it.addRoot(ourProjectRoot.append("newLibrary/classes").url, OrderRootType.CLASSES) @@ -134,24 +134,24 @@ class WorkspaceModelPerformanceTest { ModuleRootModificationUtil.removeDependency(module, library) } } - }.warmupIterations(15).assertTiming() + }.warmupIterations(15).start() } @Test fun `add remove dependency`() { val module = ourProjectModel.moduleManager.findModuleByName("module50")!! val library = ourProjectModel.projectLibraryTable.getLibraryByName("lib40")!! - PlatformTestUtil.startPerformanceTest("Adding and removing a dependency 20 times") { + PlatformTestUtil.newPerformanceTest("Adding and removing a dependency 20 times") { repeat(20) { ModuleRootModificationUtil.addDependency(module, library) ModuleRootModificationUtil.removeDependency(module, library) } - }.warmupIterations(15).assertTiming() + }.warmupIterations(15).start() } @Test fun `process content roots`() { - PlatformTestUtil.startPerformanceTest("Iterate through content roots of all modules 1000 times") { + PlatformTestUtil.newPerformanceTest("Iterate through content roots of all modules 1000 times") { var count = 0 repeat(1000) { ourProjectModel.moduleManager.modules.forEach { module -> @@ -159,12 +159,12 @@ class WorkspaceModelPerformanceTest { } } assertTrue(count > 0) - }.warmupIterations(5).assertTiming() + }.warmupIterations(5).start() } @Test fun `process order entries`() { - PlatformTestUtil.startPerformanceTest("Iterate through order entries of all modules 1000 times") { + PlatformTestUtil.newPerformanceTest("Iterate through order entries of all modules 1000 times") { var count = 0 repeat(1000) { ourProjectModel.moduleManager.modules.forEach { module -> @@ -172,6 +172,6 @@ class WorkspaceModelPerformanceTest { } } assertTrue(count > 0) - }.warmupIterations(5).assertTiming() + }.warmupIterations(5).start() } } diff --git a/plugins/ant/tests/src/com/intellij/lang/ant/AntHighlightingPerformanceTest.java b/plugins/ant/tests/src/com/intellij/lang/ant/AntHighlightingPerformanceTest.java index 60bd8b93e48e..a4acf655fd4d 100644 --- a/plugins/ant/tests/src/com/intellij/lang/ant/AntHighlightingPerformanceTest.java +++ b/plugins/ant/tests/src/com/intellij/lang/ant/AntHighlightingPerformanceTest.java @@ -25,9 +25,9 @@ public class AntHighlightingPerformanceTest extends DaemonAnalyzerTestCase { findVirtualFile(getTestName(false) + ".xml"), findVirtualFile("buildserver.xml"), findVirtualFile("buildserver.properties")); - PlatformTestUtil.startPerformanceTest("Big ant file highlighting", () -> doDoTest(true, false)) + PlatformTestUtil.newPerformanceTest("Big ant file highlighting", () -> doDoTest(true, false)) .setup(getPsiManager()::dropPsiCaches) - .assertTiming(); + .start(); } @Override diff --git a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorPerformanceTest.java b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorPerformanceTest.java index 4986eab02b18..76abebce8ae7 100644 --- a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorPerformanceTest.java +++ b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/util/ExtensionLocatorPerformanceTest.java @@ -30,10 +30,10 @@ public class ExtensionLocatorPerformanceTest extends JavaCodeInsightFixtureTestC myFixture.configureByText("plugin.xml", generatePluginXmlText(randomMethodNames)); PsiClass psiClass = myFixture.addClass(generateJavaClassText(randomMethodNames)); - PlatformTestUtil.startPerformanceTest("Locating extension tag by PsiClass", () -> { + PlatformTestUtil.newPerformanceTest("Locating extension tag by PsiClass", () -> { List result = locateExtensionsByPsiClass(psiClass); assertSize(1, result); - }).attempts(1).assertTiming(); + }).attempts(1).start(); } diff --git a/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigInspectionsTest.kt b/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigInspectionsTest.kt index 55b4ed331497..d4de81313416 100644 --- a/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigInspectionsTest.kt +++ b/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigInspectionsTest.kt @@ -115,9 +115,9 @@ class EditorConfigInspectionsTest : BasePlatformTestCase() { private fun doTestPerf(inspection: KClass) { myFixture.enableInspections(inspection.java) myFixture.configureByFile("${getTestName(true)}/.editorconfig") - PlatformTestUtil.startPerformanceTest("${inspection.simpleName} performance", ThrowableRunnable { + PlatformTestUtil.newPerformanceTest("${inspection.simpleName} performance", ThrowableRunnable { myFixture.doHighlighting() - }).attempts(1).assertTiming() + }).attempts(1).start() } // Utils diff --git a/plugins/gradle/java/testSources/dsl/GradleHighlightingPerformanceTest.kt b/plugins/gradle/java/testSources/dsl/GradleHighlightingPerformanceTest.kt index 7ba0476a6f08..601b95df35b5 100644 --- a/plugins/gradle/java/testSources/dsl/GradleHighlightingPerformanceTest.kt +++ b/plugins/gradle/java/testSources/dsl/GradleHighlightingPerformanceTest.kt @@ -32,7 +32,7 @@ class GradleHighlightingPerformanceTest : GradleCodeInsightTestCase() { fixture.editor.caretModel.moveToOffset(pos + 1) fixture.checkHighlighting() - PlatformTestUtil.startPerformanceTest("GradleHighlightingPerformanceTest.testPerformance") { + PlatformTestUtil.newPerformanceTest("GradleHighlightingPerformanceTest.testPerformance") { fixture.psiManager.dropPsiCaches() repeat(4) { fixture.type('a') @@ -40,7 +40,7 @@ class GradleHighlightingPerformanceTest : GradleCodeInsightTestCase() { fixture.doHighlighting() fixture.completeBasic() } - }.assertTiming(GradleHighlightingPerformanceTest::testPerformance) + }.start(GradleHighlightingPerformanceTest::testPerformance) } } } @@ -60,7 +60,7 @@ class GradleHighlightingPerformanceTest : GradleCodeInsightTestCase() { val document = PsiDocumentManager.getInstance(project).getDocument(fixture.file) disableSlowCompletionElements(fixture.testRootDisposable) val repeatSize = 10 - PlatformTestUtil.startPerformanceTest("GradleHighlightingPerformanceTest.testCompletion") { + PlatformTestUtil.newPerformanceTest("GradleHighlightingPerformanceTest.testCompletion") { fixture.psiManager.dropResolveCaches() repeat(repeatSize) { val lookupElements = fixture.completeBasic() @@ -70,7 +70,7 @@ class GradleHighlightingPerformanceTest : GradleCodeInsightTestCase() { val rangeMarkers = ArrayList() document.asSafely()?.processRangeMarkers { rangeMarkers.add(it) } rangeMarkers.forEach { marker -> document.asSafely()?.removeRangeMarker(marker as RangeMarkerEx) } - }.assertTiming(GradleHighlightingPerformanceTest::testCompletionPerformance) + }.start(GradleHighlightingPerformanceTest::testCompletionPerformance) } } } diff --git a/plugins/grazie/src/test/kotlin/com/intellij/grazie/ide/language/JavaSupportTest.kt b/plugins/grazie/src/test/kotlin/com/intellij/grazie/ide/language/JavaSupportTest.kt index 81dd86121fd1..ee48173767d4 100644 --- a/plugins/grazie/src/test/kotlin/com/intellij/grazie/ide/language/JavaSupportTest.kt +++ b/plugins/grazie/src/test/kotlin/com/intellij/grazie/ide/language/JavaSupportTest.kt @@ -43,16 +43,16 @@ class JavaSupportTest : GrazieTestBase() { } fun `test long comment performance`() { - PlatformTestUtil.startPerformanceTest("highlighting") { + PlatformTestUtil.newPerformanceTest("highlighting") { runHighlightTestForFile("ide/language/java/LongCommentPerformance.java") - }.setup { psiManager.dropPsiCaches() }.assertTiming() + }.setup { psiManager.dropPsiCaches() }.start() } fun `test performance with many line comments`() { val text = "// this is a single line comment\n".repeat(5000) myFixture.configureByText("a.java", text) - PlatformTestUtil.startPerformanceTest("highlighting") { + PlatformTestUtil.newPerformanceTest("highlighting") { myFixture.checkHighlighting() - }.setup { psiManager.dropPsiCaches() }.assertTiming() + }.setup { psiManager.dropPsiCaches() }.start() } } diff --git a/plugins/grazie/src/test/kotlin/com/intellij/grazie/text/TextExtractionTest.java b/plugins/grazie/src/test/kotlin/com/intellij/grazie/text/TextExtractionTest.java index b62993758c7c..6543fda8a27b 100644 --- a/plugins/grazie/src/test/kotlin/com/intellij/grazie/text/TextExtractionTest.java +++ b/plugins/grazie/src/test/kotlin/com/intellij/grazie/text/TextExtractionTest.java @@ -229,7 +229,7 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.xml", text); PlatformTestUtil - .startPerformanceTest("text extraction", () -> { + .newPerformanceTest("text extraction", () -> { assertEquals("content", TextExtractor.findTextAt(file, offset1, TextContent.TextDomain.ALL).toString()); assertNull(TextExtractor.findTextAt(file, offset2, TextContent.TextDomain.ALL)); }) @@ -237,7 +237,7 @@ public class TextExtractionTest extends BasePlatformTestCase { myFixture.type(' '); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); // drop file caches }) - .assertTiming(); + .start(); } public void testLargeXmlWithUnclosedDoctypePerformance() { @@ -247,7 +247,7 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.xml", text); PlatformTestUtil - .startPerformanceTest("text extraction", () -> { + .newPerformanceTest("text extraction", () -> { for (PsiElement element : SyntaxTraverser.psiTraverser(file)) { TextExtractor.findTextsAt(element, TextContent.TextDomain.ALL); } @@ -256,7 +256,7 @@ public class TextExtractionTest extends BasePlatformTestCase { myFixture.type(' '); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); // drop file caches }) - .assertTiming(); + .start(); } private void checkHtmlXml(boolean inlineTagsSupported) { @@ -305,9 +305,9 @@ public class TextExtractionTest extends BasePlatformTestCase { String expected = "b".repeat(10_000); PsiFile file = myFixture.configureByText("a.xml", text); TextContentBuilder builder = TextContentBuilder.FromPsi.excluding(e -> e instanceof XmlTag); - PlatformTestUtil.startPerformanceTest("TextContent building with concatenation", () -> { + PlatformTestUtil.newPerformanceTest("TextContent building with concatenation", () -> { assertEquals(expected, builder.build(file, TextContent.TextDomain.PLAIN_TEXT).toString()); - }).assertTiming(); + }).start(); } public void testBuildingPerformance_removingIndents() { @@ -316,9 +316,9 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.java", "/*\n" + text + "*/"); PsiComment comment = assertInstanceOf(file.findElementAt(10), PsiComment.class); TextContentBuilder builder = TextContentBuilder.FromPsi.removingIndents(" "); - PlatformTestUtil.startPerformanceTest("TextContent building with indent removing", () -> { + PlatformTestUtil.newPerformanceTest("TextContent building with indent removing", () -> { assertEquals(expected, builder.build(comment, TextContent.TextDomain.COMMENTS).toString()); - }).assertTiming(); + }).start(); } public void testBuildingPerformance_removingHtml() { @@ -327,9 +327,9 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.java", "/**\n" + text + "*/"); PsiDocComment comment = PsiTreeUtil.findElementOfClassAtOffset(file, 10, PsiDocComment.class, false); TextExtractor extractor = new JavaTextExtractor(); - PlatformTestUtil.startPerformanceTest("TextContent building with HTML removal", () -> { + PlatformTestUtil.newPerformanceTest("TextContent building with HTML removal", () -> { assertEquals(expected, extractor.buildTextContent(comment, TextContent.TextDomain.ALL).toString()); - }).assertTiming(); + }).start(); } public void testBuildingPerformance_removingNbsp() { @@ -338,9 +338,9 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.md", text); var psi = PsiTreeUtil.findElementOfClassAtOffset(file, 10, MarkdownParagraph.class, false); TextExtractor extractor = new MarkdownTextExtractor(); - PlatformTestUtil.startPerformanceTest("TextContent building with nbsp removal", () -> { + PlatformTestUtil.newPerformanceTest("TextContent building with nbsp removal", () -> { assertEquals(expected, extractor.buildTextContent(psi, TextContent.TextDomain.ALL).toString()); - }).assertTiming(); + }).start(); } public void testBuildingPerformance_longTextFragment() { @@ -350,9 +350,9 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.java", "class C { String s = \"\"\"\n" + text + "\"\"\"; }"); var literal = PsiTreeUtil.findElementOfClassAtOffset(file, 100, PsiLiteralExpression.class, false); var extractor = new JavaTextExtractor(); - PlatformTestUtil.startPerformanceTest("TextContent building from a long text fragment", () -> { + PlatformTestUtil.newPerformanceTest("TextContent building from a long text fragment", () -> { assertEquals(expected, extractor.buildTextContent(literal, TextContent.TextDomain.ALL).toString()); - }).assertTiming(); + }).start(); } public void testBuildingPerformance_complexPsi() { @@ -361,12 +361,12 @@ public class TextExtractionTest extends BasePlatformTestCase { PsiFile file = myFixture.configureByText("a.java", text); TextExtractor extractor = new JavaTextExtractor(); PsiElement tag = PsiTreeUtil.findElementOfClassAtOffset(file, text.indexOf("something"), PsiDocTag.class, false); - PlatformTestUtil.startPerformanceTest("TextContent building from complex PSI", () -> { + PlatformTestUtil.newPerformanceTest("TextContent building from complex PSI", () -> { for (int i = 0; i < 10; i++) { TextContent content = extractor.buildTextContent(tag, TextContent.TextDomain.ALL); assertEquals("something if is not too expensive", content.toString()); } - }).assertTiming(); + }).start(); } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyStressPerformanceTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyStressPerformanceTest.groovy index 76b6b5be5e48..396c74a50e63 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyStressPerformanceTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyStressPerformanceTest.groovy @@ -96,13 +96,13 @@ class GroovyStressPerformanceTest extends LightGroovyTestCase { myFixture.type 'foo {}\n' PsiDocumentManager.getInstance(project).commitAllDocuments() - PlatformTestUtil.startPerformanceTest(getTestName(false), { + PlatformTestUtil.newPerformanceTest(getTestName(false), { story.toCharArray().each { myFixture.type it PsiDocumentManager.getInstance(project).commitAllDocuments() } - } as ThrowableRunnable).assertTiming() + } as ThrowableRunnable).start() } void testManyAnnotatedFields() { @@ -116,7 +116,7 @@ class GroovyStressPerformanceTest extends LightGroovyTestCase { } private void measureHighlighting(String text) { - PlatformTestUtil.startPerformanceTest(getTestName(false), configureAndHighlight(text)).assertTiming() + PlatformTestUtil.newPerformanceTest(getTestName(false), configureAndHighlight(text)).start() } void testDeeplyNestedClosures() { @@ -253,9 +253,9 @@ class Cl { } } """ - PlatformTestUtil.startPerformanceTest(getTestName(false), configureAndHighlight(text)) + PlatformTestUtil.newPerformanceTest(getTestName(false), configureAndHighlight(text)) .attempts(20) - .assertTiming() + .start() } void "test infer only the variable types that are needed"() { @@ -274,7 +274,7 @@ while (true) { f.canoPath } ''' - PlatformTestUtil.startPerformanceTest(getTestName(false), configureAndComplete(text)).attempts(1).assertTiming() + PlatformTestUtil.newPerformanceTest(getTestName(false), configureAndComplete(text)).attempts(1).start() } void testClosureRecursion() { @@ -477,7 +477,7 @@ ${(1..classMethodCount).collect({"void foo${it}() {}"}).join("\n")} "}" myFixture.configureByText('a.groovy', '') assert myFixture.file instanceof GroovyFile - PlatformTestUtil.startPerformanceTest('many siblings', { + PlatformTestUtil.newPerformanceTest('many siblings', { // clear caches WriteCommandAction.runWriteCommandAction(project) { myFixture.editor.document.text = "" @@ -491,7 +491,7 @@ ${(1..classMethodCount).collect({"void foo${it}() {}"}).join("\n")} for (ref in refs) { assert ref.resolve(): ref.text } - }).attempts(2).assertTiming() + }).attempts(2).start() } @CompileStatic @@ -521,14 +521,14 @@ public class Yoo$i implements Serializable, Cloneable, Hoo$i {} public class Doo$i {} """ } - PlatformTestUtil.startPerformanceTest("testing dfa", { + PlatformTestUtil.newPerformanceTest("testing dfa", { myFixture.checkHighlighting true, false, false }).setup({ myFixture.enableInspections GroovyAssignabilityCheckInspection, UnusedDefInspection, GrUnusedIncDecInspection configure 1 myFixture.checkHighlighting true, false, false configure 2 - }).attempts(1).assertTiming() + }).attempts(1).start() } void 'test resolve long chain of references'() { @@ -601,17 +601,17 @@ foo${n}(a) { foo${n - 1}(1) }""") def file = fixture.configureByText('_.groovy', builder.toString()) as GroovyFile - PlatformTestUtil.startPerformanceTest(getTestName(false), { + PlatformTestUtil.newPerformanceTest(getTestName(false), { myFixture.psiManager.dropPsiCaches() (file.methods.last().block.statements.last() as GrExpression).type - }).attempts(5).assertTiming() + }).attempts(5).start() } void 'test complex DFA with a lot of closures'() { fixture.configureByFile("stress/dfa.groovy") - PlatformTestUtil.startPerformanceTest(getTestName(false), { + PlatformTestUtil.newPerformanceTest(getTestName(false), { myFixture.psiManager.dropPsiCaches() myFixture.doHighlighting() - }).attempts(10).assertTiming() + }).attempts(10).start() } } diff --git a/plugins/htmltools/testSrc/com/intellij/htmltools/codeInsight/daemon/HtmlHighlightingPerformanceTest.java b/plugins/htmltools/testSrc/com/intellij/htmltools/codeInsight/daemon/HtmlHighlightingPerformanceTest.java index c3bab637f75c..97ac0abfe466 100644 --- a/plugins/htmltools/testSrc/com/intellij/htmltools/codeInsight/daemon/HtmlHighlightingPerformanceTest.java +++ b/plugins/htmltools/testSrc/com/intellij/htmltools/codeInsight/daemon/HtmlHighlightingPerformanceTest.java @@ -37,16 +37,16 @@ public class HtmlHighlightingPerformanceTest extends BasePlatformTestCase { public void testPerformance2() { myFixture.configureByFiles(getTestName(false) + ".html", "manual.css"); - PlatformTestUtil.startPerformanceTest("HTML Highlighting 2", () -> doTest()) + PlatformTestUtil.newPerformanceTest("HTML Highlighting 2", () -> doTest()) .warmupIterations(1) - .assertTiming(); + .start(); } public void testPerformance() { myFixture.configureByFiles(getTestName(false) + ".html", "stylesheet.css"); - PlatformTestUtil.startPerformanceTest("HTML Highlighting", () -> doTest()) + PlatformTestUtil.newPerformanceTest("HTML Highlighting", () -> doTest()) .warmupIterations(1) - .assertTiming(); + .start(); } protected void doTest() { diff --git a/plugins/java-decompiler/plugin/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.kt b/plugins/java-decompiler/plugin/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.kt index 631062f9278f..c4c3876829cf 100644 --- a/plugins/java-decompiler/plugin/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.kt +++ b/plugins/java-decompiler/plugin/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.kt @@ -146,7 +146,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() { val jrt = JavaVersion.current().feature >= 9 val base = if (jrt) "jrt://${SystemProperties.getJavaHome()}!/java.desktop/" else "jar://${SystemProperties.getJavaHome()}/lib/rt.jar!/" val file = VirtualFileManager.getInstance().findFileByUrl(base + "javax/swing/JTable.class")!! - PlatformTestUtil.startPerformanceTest("decompiling JTable.class") { decompiler.getText(file) }.assertTiming() + PlatformTestUtil.newPerformanceTest("decompiling JTable.class") { decompiler.getText(file) }.start() } fun testStructureView() { diff --git a/plugins/java-i18n/testSrc/com/intellij/lang/properties/PropertiesPerformanceTest.java b/plugins/java-i18n/testSrc/com/intellij/lang/properties/PropertiesPerformanceTest.java index 74780e6ba5dd..361ae73c7834 100644 --- a/plugins/java-i18n/testSrc/com/intellij/lang/properties/PropertiesPerformanceTest.java +++ b/plugins/java-i18n/testSrc/com/intellij/lang/properties/PropertiesPerformanceTest.java @@ -44,18 +44,18 @@ public class PropertiesPerformanceTest extends JavaCodeInsightTestCase { public void testTypingInBigFile() throws Exception { configureByFile(getTestName(true) + "/File1.properties"); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { type(' '); PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument()); backspace(); PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument()); - }).assertTiming(); + }).start(); } public void testResolveManyLiterals() throws Exception { final PsiClass aClass = generateTestFiles(); assertNotNull(aClass); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> aClass.accept(new JavaRecursiveElementWalkingVisitor() { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> aClass.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) { PsiReference[] references = expression.getReferences(); @@ -63,7 +63,7 @@ public class PropertiesPerformanceTest extends JavaCodeInsightTestCase { reference.resolve(); } } - })).assertTiming(); + })).start(); } private PsiClass generateTestFiles() throws IOException { diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/performance/PerformanceTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/performance/PerformanceTest.java index fbd9d51abc3e..0b285375ea6d 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/performance/PerformanceTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/performance/PerformanceTest.java @@ -14,7 +14,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase { final String testName = getTestName(true); loadToPsiFile("/performance/" + testName + "/lombok.config"); final PsiFile psiFile = loadToPsiFile("/performance/" + testName + "/HugeClass.java"); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> { type(' '); PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument()); ((PsiJavaFileImpl)psiFile).getClasses()[0].getFields()[0].hasModifierProperty(PsiModifier.FINAL); @@ -22,7 +22,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase { backspace(); PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument()); ((PsiJavaFileImpl)psiFile).getClasses()[0].getFields()[0].hasModifierProperty(PsiModifier.FINAL); - }).assertTiming(); + }).start(); } private void backspace() { @@ -34,7 +34,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase { } public void testGeneratedCode() { - PlatformTestUtil.startPerformanceTest("300 unrelated methods", () -> { + PlatformTestUtil.newPerformanceTest("300 unrelated methods", () -> { StringBuilder text = new StringBuilder("import lombok.Getter; import lombok.Setter; @interface Tolerate{} class Foo {"); for (int i = 0; i < 200; i++) { text.append("@Getter @Setter int bar").append(i).append(";"); @@ -53,11 +53,11 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase { myFixture.configureByText("Foo.java", text.toString()); myFixture.checkHighlighting(); }) - .assertTiming(); + .start(); } public void testGeneratedCodeThroughStubs() { - PlatformTestUtil.startPerformanceTest("200 unrelated methods", () -> { + PlatformTestUtil.newPerformanceTest("200 unrelated methods", () -> { StringBuilder text = new StringBuilder("import lombok.Getter; import lombok.Setter; @interface Tolerate{} class Foo {"); for (int i = 0; i < 200; i++) { text.append("@Getter @Setter int bar").append(i).append(";"); @@ -74,7 +74,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase { myFixture.configureByText("Bar.java", barText.toString()); myFixture.checkHighlighting(); }) - .assertTiming(); + .start(); } public void testDataPerformance() { @@ -101,10 +101,10 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase { classText.append("}"); } - PlatformTestUtil.startPerformanceTest("@Data/@EqualsAndHashCode/@ToString performance", () -> { + PlatformTestUtil.newPerformanceTest("@Data/@EqualsAndHashCode/@ToString performance", () -> { myFixture.configureByText("Bar.java", classText.toString()); myFixture.checkHighlighting(); }) - .assertTiming(); + .start(); } } diff --git a/plugins/properties/tests/testSrc/com/intellij/lang/properties/PropertiesEnterTest.java b/plugins/properties/tests/testSrc/com/intellij/lang/properties/PropertiesEnterTest.java index a533fbb536ef..900c856d4e55 100644 --- a/plugins/properties/tests/testSrc/com/intellij/lang/properties/PropertiesEnterTest.java +++ b/plugins/properties/tests/testSrc/com/intellij/lang/properties/PropertiesEnterTest.java @@ -47,10 +47,10 @@ public class PropertiesEnterTest extends LightPlatformCodeInsightTestCase { String line = "some.relatively.long.property.name=And here's some property value for that really unique key, nice to have\n"; String text = StringUtil.repeat(line, 20000) + "\n" + StringUtil.repeat(line, 10000); configureFromFileText("performance.properties", text); - PlatformTestUtil.startPerformanceTest("Property files editing", () -> { + PlatformTestUtil.newPerformanceTest("Property files editing", () -> { type("aaaa=bbb"); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); - }).assertTiming(); + }).start(); } private void doTest() { diff --git a/plugins/terminal/tests/org/jetbrains/plugins/terminal/block/BlockTerminalTest.kt b/plugins/terminal/tests/org/jetbrains/plugins/terminal/block/BlockTerminalTest.kt index e6ffcfa69f5c..4c8ac399ac93 100644 --- a/plugins/terminal/tests/org/jetbrains/plugins/terminal/block/BlockTerminalTest.kt +++ b/plugins/terminal/tests/org/jetbrains/plugins/terminal/block/BlockTerminalTest.kt @@ -76,11 +76,11 @@ class BlockTerminalTest(private val shellPath: Path) { SimpleTextRepeater.Item("Done", false, true, 1)) setTerminalBufferMaxLines(items.sumOf { it.count }) val session = startBlockTerminalSession(TermSize(200, 100)) - PlatformTestUtil.startPerformanceTest("large output is read") { + PlatformTestUtil.newPerformanceTest("large output is read") { val outputFuture: CompletableFuture = getCommandResultFuture(session) session.sendCommandToExecuteWithoutAddingToHistory(SimpleTextRepeater.Helper.generateCommand(items)) assertCommandResult(0, SimpleTextRepeater.Helper.getExpectedOutput(items), outputFuture) - }.attempts(1).assertTiming() + }.attempts(1).start() } @Test diff --git a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathExpressionGeneratorTest.java b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathExpressionGeneratorTest.java index d8a418277eca..19b36e4bcc92 100644 --- a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathExpressionGeneratorTest.java +++ b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathExpressionGeneratorTest.java @@ -19,10 +19,10 @@ public class XPathExpressionGeneratorTest extends TestBase { } public void testManySiblings() { - PlatformTestUtil.startPerformanceTest("Many siblings", () -> { + PlatformTestUtil.newPerformanceTest("Many siblings", () -> { assertXPath("/stopWord/word", "/stopWord/word[2359]"); }) - .assertTiming(); + .start(); } public void testName() { diff --git a/plugins/yaml/testSrc/org/jetbrains/yaml/highlighting/YAMLIncompatibleTypesInspectionTest.kt b/plugins/yaml/testSrc/org/jetbrains/yaml/highlighting/YAMLIncompatibleTypesInspectionTest.kt index b7d55ca77a86..33a390aac8e5 100644 --- a/plugins/yaml/testSrc/org/jetbrains/yaml/highlighting/YAMLIncompatibleTypesInspectionTest.kt +++ b/plugins/yaml/testSrc/org/jetbrains/yaml/highlighting/YAMLIncompatibleTypesInspectionTest.kt @@ -158,8 +158,8 @@ class YAMLIncompatibleTypesInspectionTest : BasePlatformTestCase() { } - abc: true """.trimIndent()) - PlatformTestUtil.startPerformanceTest("Inspection should finish in sane time") { + PlatformTestUtil.newPerformanceTest("Inspection should finish in sane time") { myFixture.testHighlighting() - }.warmupIterations(0).attempts(1).assertTiming() + }.warmupIterations(0).attempts(1).start() } } \ No newline at end of file diff --git a/plugins/yaml/testSrc/org/jetbrains/yaml/schema/YamlMultilineInjectionTest.kt b/plugins/yaml/testSrc/org/jetbrains/yaml/schema/YamlMultilineInjectionTest.kt index 0fb34bcc4f12..882dc8a276f4 100644 --- a/plugins/yaml/testSrc/org/jetbrains/yaml/schema/YamlMultilineInjectionTest.kt +++ b/plugins/yaml/testSrc/org/jetbrains/yaml/schema/YamlMultilineInjectionTest.kt @@ -1040,14 +1040,14 @@ abstract class AbstractYamlMultilineInjectionTest(val async: Boolean) : BasePlat val pos = myFixture.file.text.indexOf("key$half: val$half") + "key$half: val$half".length myFixture.editor.caretModel.moveToOffset(pos) myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ENTER) - PlatformTestUtil.startPerformanceTest("Typing in injected") { + PlatformTestUtil.newPerformanceTest("Typing in injected") { for (i in 0..size) { myFixture.type("newkey$i: val$i") myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ENTER) } waitForYamlCoroutines() }.warmupIterations(0).attempts(1) - .assertTiming() + .start() myInjectionFixture.assertInjectedContent("""root: ${(0..half).map { i -> "| key$i: val$i" }.joinToString("\n")} @@ -1071,10 +1071,10 @@ abstract class AbstractYamlMultilineInjectionTest(val async: Boolean) : BasePlat | |""".trimMargin()) - PlatformTestUtil.startPerformanceTest("Reformatting large") { + PlatformTestUtil.newPerformanceTest("Reformatting large") { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_REFORMAT) }.attempts(1) - .assertTiming() + .start() myInjectionFixture.assertInjectedContent("""root: ${(0..size).map { i -> "| key$i: val$i" }.joinToString("\n")} diff --git a/python/testSrc/com/jetbrains/python/PyOverloadsProcessingPerformanceTest.java b/python/testSrc/com/jetbrains/python/PyOverloadsProcessingPerformanceTest.java index 3ad0471e2c28..ccbeda0fc048 100644 --- a/python/testSrc/com/jetbrains/python/PyOverloadsProcessingPerformanceTest.java +++ b/python/testSrc/com/jetbrains/python/PyOverloadsProcessingPerformanceTest.java @@ -141,12 +141,12 @@ public class PyOverloadsProcessingPerformanceTest extends PyTestCase { private void doPerformanceTestResettingCaches(@NotNull String text, ThrowableRunnable runnable) { PsiManager psiManager = myFixture.getPsiManager(); - PlatformTestUtil.startPerformanceTest(text, runnable) + PlatformTestUtil.newPerformanceTest(text, runnable) .setup(() -> { psiManager.dropPsiCaches(); psiManager.dropResolveCaches(); }) - .assertTiming(); + .start(); } @NotNull diff --git a/spellchecker/testSrc/com/intellij/spellchecker/dataset/DataSetPerformanceTest.kt b/spellchecker/testSrc/com/intellij/spellchecker/dataset/DataSetPerformanceTest.kt index 0fe6340fcc7d..c0aae532e8dd 100644 --- a/spellchecker/testSrc/com/intellij/spellchecker/dataset/DataSetPerformanceTest.kt +++ b/spellchecker/testSrc/com/intellij/spellchecker/dataset/DataSetPerformanceTest.kt @@ -12,28 +12,28 @@ class DataSetPerformanceTest: SpellcheckerInspectionTestCase() { val manager = SpellCheckerManager.getInstance(project) val total = Datasets.missp.flatMap { it.misspellings + it.word }.size - PlatformTestUtil.startPerformanceTest("highlight ${total} words in missp") { + PlatformTestUtil.newPerformanceTest("highlight ${total} words in missp") { for (word in Datasets.missp) { manager.hasProblem(word.word) for (missp in word.misspellings) { manager.hasProblem(missp) } } - }.assertTiming() + }.start() } fun `test words spellcheck performance`() { val manager = SpellCheckerManager.getInstance(project) val total = Datasets.words.flatMap { it.misspellings + it.word }.size - PlatformTestUtil.startPerformanceTest("highlight ${total} words in words") { + PlatformTestUtil.newPerformanceTest("highlight ${total} words in words") { for (word in Datasets.words) { manager.hasProblem(word.word) for (missp in word.misspellings) { manager.hasProblem(missp) } } - }.assertTiming() + }.start() } @@ -41,13 +41,13 @@ class DataSetPerformanceTest: SpellcheckerInspectionTestCase() { val manager = SpellCheckerManager.getInstance(project) val total = Datasets.wordsCamelCase.flatMap { it.misspellings + it.word }.size - PlatformTestUtil.startPerformanceTest("highlight ${total} words in camel-case") { + PlatformTestUtil.newPerformanceTest("highlight ${total} words in camel-case") { for (word in Datasets.wordsCamelCase) { manager.hasProblem(word.word) for (missp in word.misspellings) { manager.hasProblem(missp) } } - }.assertTiming() + }.start() } } \ No newline at end of file diff --git a/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerPerformanceTest.java b/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerPerformanceTest.java index 760f6c6a5ddb..4dbbe6125b18 100644 --- a/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerPerformanceTest.java +++ b/spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerPerformanceTest.java @@ -57,9 +57,9 @@ public class SpellcheckerPerformanceTest extends SpellcheckerInspectionTestCase DaemonCodeAnalyzer.getInstance(getProject()).restart(); int[] toIgnore = ignoreEverythingExceptInspections(); - PlatformTestUtil.startPerformanceTest("many typos highlighting", () -> { + PlatformTestUtil.newPerformanceTest("many typos highlighting", () -> { assertSize(typoCount, CodeInsightTestFixtureImpl.instantiateAndRun(myFixture.getFile(), myFixture.getEditor(), toIgnore, false)); - }).assertTiming(); + }).start(); } public void testManyWhitespaces() { @@ -79,10 +79,10 @@ public class SpellcheckerPerformanceTest extends SpellcheckerInspectionTestCase assertEmpty(infos); LOG.debug("warm-up took " + (System.currentTimeMillis() - start) + " ms"); - PlatformTestUtil.startPerformanceTest("many whitespaces highlighting", () -> { + PlatformTestUtil.newPerformanceTest("many whitespaces highlighting", () -> { DaemonCodeAnalyzer.getInstance(getProject()).restart(); assertEmpty(runLocalInspections()); - }).assertTiming(); + }).start(); } public void testVeryLongEmail() { @@ -123,14 +123,14 @@ public class SpellcheckerPerformanceTest extends SpellcheckerInspectionTestCase } private static void doSplitterPerformanceTest(String text, Splitter splitter) { - PlatformTestUtil.startPerformanceTest("long word for spelling", () -> { + PlatformTestUtil.newPerformanceTest("long word for spelling", () -> { try { splitter.split(text, TextRange.allOf(text), (textRange) -> {}); } catch (ProcessCanceledException pce) { System.err.println("pce is thrown"); } - }).attempts(1).assertTiming(); + }).attempts(1).start(); } @NotNull diff --git a/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt b/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt index 39bb7bca1563..9d696fa29fb5 100644 --- a/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt +++ b/tools/intellij.tools.ide.metrics.benchmark/testSrc/com/intellij/tools/ide/metrics/benchmark/SpanExtractionFromUnitPerfTest.kt @@ -102,9 +102,9 @@ class SpanExtractionFromUnitPerfTest { @Test fun flushingTelemetryMetricsShouldNotFailTheTest() { val spanName = "simple perf test" - PlatformTestUtil.startPerformanceTest(spanName) { + PlatformTestUtil.newPerformanceTest(spanName) { runBlocking { delay(Random.nextInt(100, 500).milliseconds) } - }.assertTiming() + }.start() checkMetricsAreFlushedToTelemetryFile(spanName) } @@ -112,10 +112,10 @@ class SpanExtractionFromUnitPerfTest { fun throwingExceptionWillNotAffectMetricsPublishing() { val spanName = "perf test throwing exception" try { - PlatformTestUtil.startPerformanceTest(spanName) { + PlatformTestUtil.newPerformanceTest(spanName) { runBlocking { delay(Random.nextInt(100, 500).milliseconds) } throw RuntimeException("Exception text") - }.warmupIterations(0).assertTiming() + }.warmupIterations(0).start() } catch (t: Throwable) { // diff --git a/uast/uast-tests/test/org/jetbrains/uast/test/java/JavaUastPerformanceTest.kt b/uast/uast-tests/test/org/jetbrains/uast/test/java/JavaUastPerformanceTest.kt index 25afff338ba1..15649f85c298 100644 --- a/uast/uast-tests/test/org/jetbrains/uast/test/java/JavaUastPerformanceTest.kt +++ b/uast/uast-tests/test/org/jetbrains/uast/test/java/JavaUastPerformanceTest.kt @@ -46,17 +46,17 @@ class JavaUastPerformanceTest : AbstractJavaUastTest() { } } """.trimIndent()) - PlatformTestUtil.startPerformanceTest("convert each element to uast first time") { + PlatformTestUtil.newPerformanceTest("convert each element to uast first time") { val walker = EachPsiToUastWalker() clazz.accept(walker) TestCase.assertEquals(4019, walker.totalCount) - }.attempts(1).assertTiming() + }.attempts(1).start() } @Test fun testConvertAllElementsWithNaiveToUElement() { myFixture.configureByFile("Performance/Thinlet.java") - PlatformTestUtil.startPerformanceTest(getTestName(false), object : ThrowableRunnable { + PlatformTestUtil.newPerformanceTest(getTestName(false), object : ThrowableRunnable { var hash = 0 override fun run() { for (i in 0..99) { @@ -72,6 +72,6 @@ class JavaUastPerformanceTest : AbstractJavaUastTest() { }) .setup { PsiManager.getInstance(project).dropPsiCaches() } .warmupIterations(1) - .assertTiming() + .start() } } \ No newline at end of file diff --git a/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorTest.kt b/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorTest.kt index 427b0b7b2a42..3000fdb3a70f 100644 --- a/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorTest.kt +++ b/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorTest.kt @@ -481,12 +481,12 @@ class UStringEvaluatorTest : AbstractStringEvaluatorTest() { myFixture.doHighlighting() val expected = "'a'${"{'a'|'b'}".repeat(updateTimes + 1)}" - PlatformTestUtil.startPerformanceTest("calculate value of many assignments") { + PlatformTestUtil.newPerformanceTest("calculate value of many assignments") { val pks = UStringEvaluator().calculateValue(elementAtCaret, UNeDfaConfiguration( methodCallDepth = 2, methodsToAnalyzePattern = psiMethod().withName("b") )) ?: fail("Cannot evaluate string") TestCase.assertEquals(expected, pks.debugConcatenation) - }.attempts(2).assertTiming() + }.attempts(2).start() } } \ No newline at end of file diff --git a/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorWithSideEffectsTest.kt b/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorWithSideEffectsTest.kt index 6f719b8b0683..5ffa98e49bdc 100644 --- a/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorWithSideEffectsTest.kt +++ b/uast/uast-tests/test/org/jetbrains/uast/test/java/analysis/UStringEvaluatorWithSideEffectsTest.kt @@ -513,14 +513,14 @@ class UStringEvaluatorWithSideEffectsTest : AbstractStringEvaluatorTest() { ?: fail("Cannot find UElement at caret") val expected = "'a''b'".repeat(size) - PlatformTestUtil.startPerformanceTest("calculate value of many assignments") { + PlatformTestUtil.newPerformanceTest("calculate value of many assignments") { val pks = UStringEvaluator().calculateValue(elementAtCaret, UNeDfaConfiguration( methodCallDepth = 2, methodsToAnalyzePattern = PsiJavaPatterns.psiMethod().withName("b"), builderEvaluators = listOf(UStringBuilderEvaluator), )) ?: fail("Cannot evaluate string") TestCase.assertEquals(expected, pks.debugConcatenation) - }.attempts(2).assertTiming() + }.attempts(2).start() } private class CloneAwareStringBuilderEvaluator : BuilderLikeExpressionEvaluator by UStringBuilderEvaluator { diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomPerformanceTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomPerformanceTest.java index d0f5641fbc4b..074189b03ccf 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomPerformanceTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomPerformanceTest.java @@ -37,7 +37,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase { public void testVisitorPerformance() { Ref ref = new Ref<>(); - PlatformTestUtil.startPerformanceTest("creating", () -> ApplicationManager.getApplication().runWriteAction(() -> { + PlatformTestUtil.newPerformanceTest("creating", () -> ApplicationManager.getApplication().runWriteAction(() -> { MyElement element = createElement("", MyElement.class); MyElement child = element.addChildElement(); child.getAttr().setValue("239"); @@ -54,17 +54,17 @@ public class DomPerformanceTest extends DomHardCoreTestCase { } ref.set(element); })) - .assertTimingAsSubtest(); + .startAsSubtest(); MyElement newElement = createElement(DomUtil.getFile(ref.get()).getText(), MyElement.class); - PlatformTestUtil.startPerformanceTest("visiting", () -> + PlatformTestUtil.newPerformanceTest("visiting", () -> newElement.acceptChildren(new DomElementVisitor() { @Override public void visitDomElement(DomElement element) { element.acceptChildren(this); } - })).assertTimingAsSubtest(); + })).startAsSubtest(); } public void testShouldntParseNonDomFiles() throws Throwable { @@ -99,7 +99,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase { final XmlFile file = (XmlFile)getPsiManager().findFile(virtualFile); assertFalse(file.getNode().isParsed()); assertTrue(StringUtil.isNotEmpty(file.getText())); - PlatformTestUtil.startPerformanceTest("DOM parsing", () -> assertNull(getDomManager().getFileElement(file))).assertTiming(); + PlatformTestUtil.newPerformanceTest("DOM parsing", () -> assertNull(getDomManager().getFileElement(file))).start(); } public void testDontParseNamespacedDomFiles() throws Exception { diff --git a/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java b/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java index 8215971e6793..9ad51ae7c126 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java @@ -52,13 +52,13 @@ public class XmlPerformanceTest extends LightQuickFixTestCase { doHighlighting(); getEditor().getSelectionModel().setSelection(0, getEditor().getDocument().getTextLength()); - PlatformTestUtil.startPerformanceTest("indent/unindent "+time, () -> { + PlatformTestUtil.newPerformanceTest("indent/unindent " + time, () -> { EditorActionManager.getInstance().getActionHandler("EditorIndentSelection").execute(getEditor(), null, DataManager.getInstance().getDataContext()); EditorActionManager.getInstance().getActionHandler("EditorUnindentSelection").execute(getEditor(), null, DataManager.getInstance().getDataContext()); - }).assertTiming(); + }).start(); final int startOffset = getEditor().getCaretModel().getOffset(); getEditor().getSelectionModel().setSelection(startOffset, startOffset); checkResultByFile(getBasePath() + getTestName(false)+".xml"); diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java index d8e81bcd4b32..b7b3fb20c7dd 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java @@ -1240,9 +1240,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { "]>\n" + ""); PlatformTestUtil - .startPerformanceTest("highlighting", () -> doHighlighting()) + .newPerformanceTest("highlighting", () -> doHighlighting()) .setup(() -> getPsiManager().dropPsiCaches()) - .assertTiming(); + .start(); } public void testDocBookHighlighting2() throws Exception { diff --git a/xml/tests/src/com/intellij/codeInsight/template/emmet/HtmlEmmetPerformanceTest.java b/xml/tests/src/com/intellij/codeInsight/template/emmet/HtmlEmmetPerformanceTest.java index c7f0abc9a0ff..32fffc9e5624 100644 --- a/xml/tests/src/com/intellij/codeInsight/template/emmet/HtmlEmmetPerformanceTest.java +++ b/xml/tests/src/com/intellij/codeInsight/template/emmet/HtmlEmmetPerformanceTest.java @@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets; public class HtmlEmmetPerformanceTest extends BasePlatformTestCase { public void testPerformance() throws Exception { final String fileContent = FileUtil.loadFile(new File(getTestDataPath() + "/performance.html"), StandardCharsets.UTF_8); - PlatformTestUtil.startPerformanceTest(getTestName(true), () -> { + PlatformTestUtil.newPerformanceTest(getTestName(true), () -> { for (int i = 0; i < 50; i++) { myFixture.configureByText(HtmlFileType.INSTANCE, fileContent); PsiDocumentManager.getInstance(myFixture.getProject()).commitDocument(myFixture.getDocument(myFixture.getFile())); @@ -32,7 +32,7 @@ public class HtmlEmmetPerformanceTest extends BasePlatformTestCase { NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); } - }).assertTiming(); + }).start(); myFixture.checkResultByFile("performance_after.html"); } diff --git a/xml/tests/src/com/intellij/editor/XmlEditorTest.java b/xml/tests/src/com/intellij/editor/XmlEditorTest.java index 015e15765558..8012dbe1e6db 100644 --- a/xml/tests/src/com/intellij/editor/XmlEditorTest.java +++ b/xml/tests/src/com/intellij/editor/XmlEditorTest.java @@ -34,11 +34,11 @@ public class XmlEditorTest extends LightJavaCodeInsightTestCase { for (int i = 0; i < 3; i++) { EditorTestUtil.performTypingAction(getEditor(), '\n'); } - PlatformTestUtil.startPerformanceTest("Xml editor enter", () -> { + PlatformTestUtil.newPerformanceTest("Xml editor enter", () -> { for (int i = 0; i < 3; i ++) { EditorTestUtil.performTypingAction(getEditor(), '\n'); } - }).warmupIterations(0).attempts(1).assertTiming(); + }).warmupIterations(0).attempts(1).start(); checkResultByFile(getTestFilePath(false)); } diff --git a/xml/tests/src/com/intellij/psi/formatter/XmlPerformanceFormatterTest.java b/xml/tests/src/com/intellij/psi/formatter/XmlPerformanceFormatterTest.java index 80e723fa32fc..adeb4a1a264a 100644 --- a/xml/tests/src/com/intellij/psi/formatter/XmlPerformanceFormatterTest.java +++ b/xml/tests/src/com/intellij/psi/formatter/XmlPerformanceFormatterTest.java @@ -42,14 +42,14 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase { } public void testReformatCodeFragment() { - PlatformTestUtil.startPerformanceTest("reformat code fragment", - () -> checkFormattingDoesNotProduceException("performance")).assertTiming(); + PlatformTestUtil.newPerformanceTest("reformat code fragment", + () -> checkFormattingDoesNotProduceException("performance")).start(); } public void testPerformance3() { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { - PlatformTestUtil.startPerformanceTest("xml formatter", createTestRunnable()).assertTiming(); + PlatformTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start(); highlight(); @@ -86,7 +86,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase { public void testPerformance4() { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { - PlatformTestUtil.startPerformanceTest("xml formatter", createTestRunnable()).assertTiming(); + PlatformTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start(); } finally { editorManager.closeFile(editorManager.getSelectedFiles()[0]); @@ -107,7 +107,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase { public void testPerformance5() { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { - PlatformTestUtil.startPerformanceTest("xml formatter", createTestRunnable()).assertTiming(); + PlatformTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start(); } finally { final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); @@ -120,7 +120,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase { public void testPerformance6() { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { - PlatformTestUtil.startPerformanceTest("xml formatter", createTestRunnable()).assertTiming(); + PlatformTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start(); } finally { final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); @@ -129,7 +129,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase { } public void testPerformance7() { - PlatformTestUtil.startPerformanceTest("xml formatter", createTestRunnable()).assertTiming(); + PlatformTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start(); } public void testPerformance() throws Exception { @@ -143,8 +143,8 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase { public void testPerformanceIdea148943() throws Exception { final String textBefore = loadFile(getTestName(true) + ".xml", null); final PsiFile file = createFileFromText(textBefore, "before.xml", PsiFileFactory.getInstance(getProject())); - PlatformTestUtil.startPerformanceTest("IDEA-148943", createAdjustLineIndentInRangeRunnable(file)) - .assertTiming(); + PlatformTestUtil.newPerformanceTest("IDEA-148943", createAdjustLineIndentInRangeRunnable(file)) + .start(); } private ThrowableRunnable createAdjustLineIndentInRangeRunnable(final @NotNull PsiFile file) { diff --git a/xml/tests/src/com/intellij/psi/html/HtmlParseTest.java b/xml/tests/src/com/intellij/psi/html/HtmlParseTest.java index 524eec461ec3..a0e64253a8e6 100644 --- a/xml/tests/src/com/intellij/psi/html/HtmlParseTest.java +++ b/xml/tests/src/com/intellij/psi/html/HtmlParseTest.java @@ -523,7 +523,7 @@ public class HtmlParseTest extends LightIdeaTestCase { ExtensionTestUtil.maskExtensions(ExtensionPointName.create("com.intellij.html.scriptContentProvider"), ContainerUtil.emptyList(), getTestRootDisposable()); final Ref result = Ref.create(); - PlatformTestUtil.startPerformanceTest("Parsing", () -> result.set(getTreeTextByFile("index-all.html"))).assertTiming(); + PlatformTestUtil.newPerformanceTest("Parsing", () -> result.set(getTreeTextByFile("index-all.html"))).start(); assertResult("Performance.txt", result.get()); } diff --git a/xml/tests/src/com/intellij/xml/XmlLexerTest.java b/xml/tests/src/com/intellij/xml/XmlLexerTest.java index 5c1569c7a42b..b045ab2ef49d 100644 --- a/xml/tests/src/com/intellij/xml/XmlLexerTest.java +++ b/xml/tests/src/com/intellij/xml/XmlLexerTest.java @@ -62,12 +62,12 @@ public class XmlLexerTest extends LexerTestCase { final FilterLexer filterLexer = new FilterLexer(new XmlLexer(), new FilterLexer.SetFilter(new XMLParserDefinition().getWhitespaceTokens())); - PlatformTestUtil.startPerformanceTest("XML Lexer Performance on " + fileName, () -> { + PlatformTestUtil.newPerformanceTest("XML Lexer Performance on " + fileName, () -> { for (int i = 0; i < 10; i++) { doLex(lexer, text); doLex(filterLexer, text); } - }).assertTiming(); + }).start(); } private static void doLex(Lexer lexer, final String text) { diff --git a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java index 7ab060c4d3e7..7ac51ee27f03 100644 --- a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java +++ b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java @@ -301,7 +301,7 @@ public class XmlNamespacesTest extends LightJavaCodeInsightFixtureTestCase { public void testPatternPerformanceProblem() { myFixture.configureByFile("idproblem.html"); - PlatformTestUtil.startPerformanceTest(getTestName(false), () -> myFixture.doHighlighting()).assertTiming(); + PlatformTestUtil.newPerformanceTest(getTestName(false), () -> myFixture.doHighlighting()).start(); } private void doUnusedDeclarationTest(String text, String after, String name) { diff --git a/xml/tests/src/com/intellij/xml/XmlParsingAdditionalTest.java b/xml/tests/src/com/intellij/xml/XmlParsingAdditionalTest.java index 568ca28a771c..e5987a65c9e1 100644 --- a/xml/tests/src/com/intellij/xml/XmlParsingAdditionalTest.java +++ b/xml/tests/src/com/intellij/xml/XmlParsingAdditionalTest.java @@ -42,13 +42,13 @@ public class XmlParsingAdditionalTest extends BasePlatformTestCase { assertNotNull(doc); WriteCommandAction.writeCommandAction(project, file).run( - () -> PlatformTestUtil.startPerformanceTest("XML reparse using PsiBuilder", () -> { + () -> PlatformTestUtil.newPerformanceTest("XML reparse using PsiBuilder", () -> { for (int i = 0; i < 10; i++) { final long start = System.nanoTime(); doc.insertString(0, ""); PsiDocumentManager.getInstance(project).commitDocument(doc); LOG.debug("Reparsed for: " + (System.nanoTime() - start)); } - }).assertTiming()); + }).start()); } } diff --git a/xml/tests/src/com/intellij/xml/XmlParsingTest.java b/xml/tests/src/com/intellij/xml/XmlParsingTest.java index 64f3086582ad..3f48ccaac956 100644 --- a/xml/tests/src/com/intellij/xml/XmlParsingTest.java +++ b/xml/tests/src/com/intellij/xml/XmlParsingTest.java @@ -195,12 +195,12 @@ public class XmlParsingTest extends ParsingTestCase { transformAllChildren(file.getNode()); LOG.debug("First parsing took " + (System.nanoTime() - start) + "ns"); - PlatformTestUtil.startPerformanceTest("XML Parser Performance on " + fileName, () -> { + PlatformTestUtil.newPerformanceTest("XML Parser Performance on " + fileName, () -> { for (int i = 0; i < 10; i++) { PsiFile next = createPsiFile("test" + i, text); transformAllChildren(next.getNode()); } - }).setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches()).assertTimingAsSubtest(); + }).setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches()).startAsSubtest(); LeafElement firstLeaf = TreeUtil.findFirstLeaf(file.getNode()); int count = 0;