cursive
cursive copied to clipboard
Allow profiling using Intellij
Currently, Intellij provides profiling CPU Profiler
, Allocation Profiler
and Java Flight Recorder
but when those are selected for a test or -main
the following log is displayed.
2021-02-23 09:23:07,638 [40939677] INFO - xecution.runners.ExecutionUtil - Error running 'Test clabenator.logic.clabe-test/build-clabe':<br>Internal error: cannot patch the selected configuration.<br><a href="">Report this error</a>
com.intellij.profiler.ultimate.JavaProfilerConfigurationExtension$Companion$CantDetectProfilerExecutorId: Internal error: cannot patch the selected configuration.<br><a href="">Report this error</a>
at com.intellij.profiler.ultimate.JavaProfilerConfigurationExtension.updateJavaParameters(JavaProfilerConfigurationExtension.kt:25)
at cursive.runner.RunConfigurationExtensionsKt.extendJavaParameters(RunConfigurationExtensions.kt:38)
at cursive.runner.BaseJvmClojureRunConfiguration.setCommonParams(ClojureRunnerBase.kt:224)
at cursive.runner.BaseJvmClojureRunConfiguration.createIntelliJParameters(ClojureRunnerBase.kt:199)
at cursive.runner.ClojureTestConfiguration$getRunProfileState$state$3.createJavaParameters(ClojureTestRunner.kt:232)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:844)
at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:61)
at com.intellij.execution.configurations.JavaCommandLineState.getJavaParameters(JavaCommandLineState.java:41)
at com.intellij.execution.impl.DefaultJavaProgramRunner.patchJavaCommandLineParams(DefaultJavaProgramRunner.java:136)
at com.intellij.execution.impl.DefaultJavaProgramRunner.doExecute(DefaultJavaProgramRunner.java:128)
at com.intellij.execution.impl.DefaultJavaProgramRunner.lambda$execute$1(DefaultJavaProgramRunner.java:113)
at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:64)
at com.intellij.execution.impl.DefaultJavaProgramRunner.lambda$execute$2(DefaultJavaProgramRunner.java:112)
at com.intellij.execution.ExecutionManager$startRunProfile$1.invoke(ExecutionManager.kt:65)
at com.intellij.execution.ExecutionManager$startRunProfile$1.invoke(ExecutionManager.kt:19)
at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:168)
at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:68)
at com.intellij.execution.impl.ExecutionManagerImpl$doStartRunProfile$startRunnable$1.run(ExecutionManagerImpl.kt:229)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:218)
at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:200)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:319)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:133)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:189)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:973)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
I was also just learning about IntelliJ profiling and I got this error, when I tried to start a Local Clojure REPL
run config with the Profile with 'IntelliJ Profiler'
option, instead of the default Run
option:
Deferred configurations cannot be run with standard runners
I would be really curious to know how are we supposed to run this built-in profiler.
BTW, here are some really useful links for learning about profiling:
- https://www.baeldung.com/java-profilers
- A Simple Approach to the Advanced JVM Profiling
Just tried https://github.com/clojure-goes-fast/clj-async-profiler and I could use it for CPU profiling, but it's not integrated with IntelliJ, of course.
To anyone looking at this, you just need to use "Attach profiler to process"