VisualVM Profiler

Compatible with  IntelliJ IDEA
08.12.2008
14 227
Launches VisualVM's Java profiler from within IDEA. VisualVM is based on NetBeans Profiler and is bundled with JDK 6 Update 7 and above. VisualVM may also be downloaded for free from https://visualvm.dev.java.net/

Download plugin

Version

Update date

Recent change notes

1.0.0 (2008-12-08)
- Support for VisualVM 1.1
- Autodetect Java version when choosing the profiler interface to use (although officially VisualVM supports only Java 6 and 7)

0.4.2 (2008-11-26)
- Fixed possible NPE if the MainClass returned by IDEA was null

0.4.1 (2008-11-24)
- Fixed inconsistent naming of profiler actions (IDEA 8 only)
- Fixed the profiler actions appearing in every file's context menu (IDEA 8 only)

0.4.0 (2008-11-24)
- Compatible with IDEA 8
- Uniquely identify the application launched by IDEA

0.3.0 (2008-11-12)
- Memory profiling
- Settings are copied to VisualVM's user interface
- Saved space in the run configuration dialog by moving help texts to tooltips

0.2.0 (2008-11-09)
- Works with the bundled VisualVM which comes with JDK 6 Update 7 and above
- Detects bundled VisualVMs automatically, in which case no configuration is necessary
- Should work also with Linux and Mac (not tested, also not sure about 64 bit JVMs)
- Defaults to jdk15 profiler interface for better compatibility (hardcoded)
- Warns about invalid configuration

0.1.0 (2008-11-06)
- Initial release
- CPU profiling (Windows Java 6 only)

Known issues
- VisualVM may freeze if the application finishes execution before its window opens up in VisualVM. A workaround is to add Thread.sleep(1000) or a longer delay to the beginning of the main() method of the profiled application.

Future plans
- A button for opening the currently running (non-profiled) program in VisualVM, so that the user will not need to manually select the program from VisualVM's list of all running Java programs
- Integration with NetBeans IDE's profiler if it has benefits over VisualVM (they both use internally the same NetBeans Profiler)

General usage instructions

If you have JDK 6 Update 7 or higher configured in IDEA:
1. Click the "Profile CPU" button (next to the "Run" and "Debug" buttons) to begin profiling.

Otherwise you need to install VisualVM separately:
1. Download VisualVM 1.0.1 from https://visualvm.dev.java.net/download.html
2. Install it to "C:/Program Files/visualvm"
3. Configure the plugin (Settings | VisualVM) by pointing it to "C:/Program Files/visualvm"
4. Click the "Profile CPU" button (next to the "Run" and "Debug" buttons) to begin profiling.
meo
10.11.2012
I have made a new plugin for VisualVM, enjoy. http://plugins.intellij.net/plugin/?idea&pluginId=7115
20.11.2010
The 1.0.0 version of this plugin is compatible with IDEA 8 and VisualVM 1.1. Changing the supported version range in the plugin descriptor might make it work on newer IDEA versions, but it's possible that some changes are needed. This plugin is known to be incompatible with VisualVM 1.2, so at least that requires some code changes (and the code which hooks inside VisualVM is complex, because VisualVM does not provide hooks for running it programmatically).

This plugin is not being maintained, but the source code is open at https://github.com/orfjackal/visualvm4idea so anybody is free to modify it and take over its maintenance (I would be happy to give upload access to the plugin repository).
Anonymous
17.11.2010
It won't install in 9.0.3. Maybe it's too old? Or maybe I don't know how to install plugins. I put it into the plugins directory, and it appears in the plugins list but red. When I enable it, it says I need to restart to make it active, but when I restart, it's unchecked again and still red. It doesn't appear that this works anymore.
15.01.2010
Version 1.0.0 of this plugin is not compatible with VisualVM 1.2, and this plugin is not being maintained. Anybody is free to fork the plugin's code at http://github.com/orfjackal/visualvm4idea and continue its maintenance.
13.01.2010
It won't run on my Windows machine nor on my Mac. VisualVM comes up, it says something about a taking a snapshot which seems to do nothing, and IntelliJ reports this error:

No response from VisualVM, request was: [PROFILE_CPU, 674030631, 5140, true, com.intellij.rt.execution.junit.JUnitStarter, EXCLUDE, java.*, javax.*,
sun.*, sunw.*, com.sun.*]: No response from VisualVM, request was: [PROFILE_CPU, 674030631, 5140, true, com.intellij.rt.execution.junit.JUnitStarter, EXCLUDE, java.*, javax.*,
sun.*, sunw.*, com.sun.*]
java.lang.RuntimeException: No response from VisualVM, request was: [PROFILE_CPU, 674030631, 5140, true, com.intellij.rt.execution.junit.JUnitStarter, EXCLUDE, java.*, javax.*,
sun.*, sunw.*, com.sun.*]
at net.orfjackal.visualvm4idea.plugin.server.VisualVmCommandSender.runCommand(VisualVmCommandSender.java:101)
at net.orfjackal.visualvm4idea.plugin.server.VisualVmCommandSender.beginProfilingApplicationCPU(VisualVmCommandSender.java:74)
at net.orfjackal.visualvm4idea.plugin.CpuProfilerRunner.onProcessStarted(CpuProfilerRunner.java:89)
at net.orfjackal.visualvm4idea.plugin.DefaultJavaProgramRunnerWrapper.doExecute(DefaultJavaProgramRunnerWrapper.java:75)
at net.orfjackal.visualvm4idea.plugin.CpuProfilerRunner.doExecute(CpuProfilerRunner.java:83)
at com.intellij.execution.runners.GenericProgramRunner$1.run(GenericProgramRunner.java:79)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:16)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:57)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:99)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:189)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:228)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at net.orfjackal.visualvm4idea.plugin.server.VisualVmCommandSender.runCommand(VisualVmCommandSender.java:92)
... 17 more
Anonymous
16.11.2009
Hi,

I am getting following error after clicking "Profile Memory"--

Unable to find profiler agent for JDK16 using ExternalVisualVm10Config[visualVmHome=C:\Program Files\Java\jdk1.6.0_13\lib\visualvm,systemVars=net.orfjackal.visualvm4idea.plugin.config.WindowsSystemVars@53c41ef8]: Unable to find profiler agent for JDK16 using ExternalVisualVm10Config[visualVmHome=C:\Program Files\Java\jdk1.6.0_13\lib\visualvm,systemVars=net.orfjackal.visualvm4idea.plugin.config.WindowsSystemVars@53c41ef8]
java.lang.IllegalArgumentException: Unable to find profiler agent for JDK16 using ExternalVisualVm10Config[visualVmHome=C:\Program Files\Java\jdk1.6.0_13\lib\visualvm,systemVars=net.orfjackal.visualvm4idea.plugin.config.WindowsSystemVars@53c41ef8]
at net.orfjackal.visualvm4idea.plugin.config.AbstractVisualVmConfig.getAppProfilerAgent(AbstractVisualVmConfig.java:71)
at net.orfjackal.visualvm4idea.plugin.server.VisualVmUtil.getAppProfilerCommand(VisualVmUtil.java:69)
at net.orfjackal.visualvm4idea.plugin.MemoryProfilerRunner.patch(MemoryProfilerRunner.java:78)
at net.orfjackal.visualvm4idea.plugin.DefaultJavaProgramRunnerWrapper.doExecute(DefaultJavaProgramRunnerWrapper.java:60)
at net.orfjackal.visualvm4idea.plugin.MemoryProfilerRunner.doExecute(MemoryProfilerRunner.java:83)
at com.intellij.execution.runners.GenericProgramRunner$1.run(GenericProgramRunner.java:79)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:16)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:35)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:99)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:217)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Anonymous
05.10.2009
This plugin successfully launches VisualVM and my application (in that order), but my app doesn't appear in the list of apps to profile in VisualVM (under Local). The only app I can profile is VisualVM itself. Sometimes I get a "No response from VisualVM" exception, but not every time. The configuration seems to have worked OK, since the "Startup/Connection" settings appear to be correct. Any ideas?
19.12.2008
The "No response from VisualVM" exception is not dangerous. Just a little timeout, because VisualVM did not respond quickly enough.
Anonymous
19.12.2008
First time I ran it, visualvm needed to callibrate and intellij reported this exception:

No response from VisualVM, request was: [...]
at net.orfjackal.visualvm4idea.plugin.server.VisualVmCommandSender.runCommand(VisualVmCommandSender.java:100)
at net.orfjackal.visualvm4idea.plugin.server.VisualVmCommandSender.beginProfilingApplicationCPU(VisualVmCommandSender.java:73)
at net.orfjackal.visualvm4idea.plugin.CpuProfilerRunner.onProcessStarted(CpuProfilerRunner.java:76)
at com.intellij.execution.runners.RunStrategyImpl.a(RunStrategyImpl.java:40)
at com.intellij.execution.runners.RunStrategyImpl.access$200(RunStrategyImpl.java:27)
at com.intellij.execution.runners.RunStrategyImpl$3.run(RunStrategyImpl.java:4)
at com.intellij.execution.impl.ExecutionManagerImpl$1.run(ExecutionManagerImpl.java:16)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:4)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:39)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:208)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:214)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:228)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at net.orfjackal.visualvm4idea.plugin.server.VisualVmCommandSender.runCommand(VisualVmCommandSender.java:91)
... 18 more

Looks nice though
26.11.2008
Try if version 0.4.2 fixes that problem. I was not able to reproduce that NPE myself, so I can't verify the fix, but the part which I fixed should be the only possible cause of that NPE.
Anonymous
26.11.2008
Following exception is shown when trying to run profiler

java.lang.NullPointerException
at net.orfjackal.visualvm4idea.util.StringUtil.splitCommaSeparated(StringUtil.java:45)
at net.orfjackal.visualvm4idea.visualvm.CpuSettings.toProfilingSettings(CpuSettings.java:78)
at net.orfjackal.visualvm4idea.core.commands.ProfileCpuCommand$1.run(ProfileCpuCommand.java:89)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
Please  sign in  to leave a comment.