diff --git a/plugins/performanceTesting/commands-model/src/com/intellij/tools/ide/performanceTesting/commands/generalCommandChain.kt b/plugins/performanceTesting/commands-model/src/com/intellij/tools/ide/performanceTesting/commands/generalCommandChain.kt index 3a6edef3ce0c..b6e249e03665 100644 --- a/plugins/performanceTesting/commands-model/src/com/intellij/tools/ide/performanceTesting/commands/generalCommandChain.kt +++ b/plugins/performanceTesting/commands-model/src/com/intellij/tools/ide/performanceTesting/commands/generalCommandChain.kt @@ -361,14 +361,6 @@ fun T.doComplete(times: Int): T = apply { } } -fun T.doHighlightingWarmup(): T = apply { - addCommand("${CMD_PREFIX}doHighlight", WARMUP) -} - -fun T.doHighlighting(): T = apply { - addCommand("${CMD_PREFIX}doHighlight") -} - fun T.openProjectView(): T = apply { addCommand("${CMD_PREFIX}openProjectView") } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/BaseCommandProvider.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/BaseCommandProvider.java index ad1436460447..52cd6286bfbf 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/BaseCommandProvider.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/BaseCommandProvider.java @@ -60,7 +60,6 @@ public final class BaseCommandProvider implements CommandProvider { Map.entry(SearchEverywhereCommand.PREFIX, SearchEverywhereCommand::new), Map.entry(SelectFileInProjectViewCommand.PREFIX, SelectFileInProjectViewCommand::new), Map.entry(ExpandProjectMenuCommand.PREFIX, ExpandProjectMenuCommand::new), - Map.entry(DoHighlighting.PREFIX, DoHighlighting::new), Map.entry(ReloadFilesCommand.PREFIX, ReloadFilesCommand::new), Map.entry(AddFileCommand.PREFIX, AddFileCommand::new), Map.entry(RenameFileCommand.PREFIX, RenameFileCommand::new), diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DoHighlighting.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DoHighlighting.java deleted file mode 100644 index e4b77d22dc6a..000000000000 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DoHighlighting.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.jetbrains.performancePlugin.commands; - -import com.intellij.codeInsight.daemon.impl.DaemonProgressIndicator; -import com.intellij.codeInsight.daemon.impl.HighlightVisitorBasedInspection; -import com.intellij.codeInspection.GlobalInspectionContext; -import com.intellij.codeInspection.GlobalInspectionTool; -import com.intellij.codeInspection.InspectionEngine; -import com.intellij.codeInspection.InspectionManager; -import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ReadAction; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.fileEditor.FileEditorManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.playback.PlaybackContext; -import com.intellij.openapi.util.ActionCallback; -import com.intellij.platform.diagnostic.telemetry.helpers.TraceKt; -import com.intellij.psi.PsiDocumentManager; -import com.intellij.psi.PsiFile; -import com.intellij.util.concurrency.AppExecutorUtil; -import com.jetbrains.performancePlugin.PerformanceTestSpan; -import com.jetbrains.performancePlugin.utils.ActionCallbackProfilerStopper; -import io.opentelemetry.context.Context; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.concurrency.Promise; -import org.jetbrains.concurrency.Promises; - -import java.util.concurrent.Callable; - -import static com.intellij.psi.PsiManager.getInstance; - -/** - * Command runs highlighting pass. - * Runs all highlighting passes. Can't be invoked multiple times in a row since it drops caches before run. - * Example: %doHighlighting - */ -public final class DoHighlighting extends PerformanceCommand { - public static final String NAME = "doHighlight"; - public static final String PREFIX = CMD_PREFIX + NAME; - - public static final String SPAN_NAME = "highlighting"; - public static final int MILLIS_IN_NANO = 1000000; - - public DoHighlighting(@NotNull String text, int line) { - super(text, line); - } - - @Override - protected String getName() { - return NAME; - } - - @NotNull - @Override - protected Promise _execute(@NotNull PlaybackContext context) { - ActionCallback actionCallback = new ActionCallbackProfilerStopper(); - ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(() -> { - Project project = context.getProject(); - final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); - if (editor == null) { - actionCallback.reject("Editor is not open"); - return; - } - PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); - if (psiFile == null) { - actionCallback.reject("Missing PSI file in the editor"); - return; - } - getInstance(project).dropPsiCaches(); - ReadAction.nonBlocking(Context.current().wrap((Callable)() -> { - long start = System.nanoTime(); - TraceKt.use(PerformanceTestSpan.TRACER.spanBuilder(SPAN_NAME), span -> { - GlobalInspectionTool tool = new HighlightVisitorBasedInspection() - .setHighlightErrorElements(true).setRunAnnotators(true).setRunVisitors(false); - InspectionManager inspectionManager = InspectionManager.getInstance(project); - GlobalInspectionContext globalContext = inspectionManager.createNewGlobalContext(); - InspectionEngine.runInspectionOnFile(psiFile, new GlobalInspectionToolWrapper(tool), globalContext); - - span.setAttribute("lines", editor.getDocument().getLineCount()); - long stop = System.nanoTime(); - span.setAttribute("timeToLines", (double)(stop - start) / MILLIS_IN_NANO / (Math.max(1, editor.getDocument().getLineCount()))); - return null; - }); - actionCallback.setDone(); - return null; - })).wrapProgress(new DaemonProgressIndicator()).submit(AppExecutorUtil.getAppExecutorService()); - })); - return Promises.toPromise(actionCallback); - } -}