Before capturing and providing the CPU snapshot, please be aware of the following known issues (and possible solutions):
If the UI of IntelliJ IDEA is unresponsive for more than 5 seconds, it starts writing thread dumps to the logs directory. If you've encountered a situation of IntelliJ IDEA unresponsiveness or deadlock, please find the threadDumps-xxx directory from the session in which you've experienced the problem and send the contents to support@jetbrains.com.
The logs directory on Windows and Linux is USERPROFILE\.IntelliJIdeaXX\system\log.
On Mac OS X, the logs directory can be found at:
~/Library/Caches/IntelliJIDEAXX/logs
for IntelliJ IDEA 8.x and older versions
~/Library/Logs/IntelliJIDEAXX
for 9.0 and later IntelliJ IDEA versions
If you have a performance problem not related to the issues mentioned above, please contact support@jetbrains.com and provide the following information:
IntelliJ IDEA Ultimate includes a built-in YourKit profiling agent that can be used to take CPU and memory snapshots. Please use the following instructions to enable it.
Open IDEA_HOME/bin/idea.exe.vmoptions (idea.vmoptions on Linux/Solairs), add the following line at the bottom:
-agentlib:yjpagent
On Mac OS X open Info.plist located in /Applications/IntelliJ IDEA X.X.app/Contents, find the following:
<key>VMOptions</key>
<string>-Xms16m -Xmx192m -XX:MaxPermSize=120m -Xbootclasspath/p:../lib/boot.jar -ea</string>
Modify the string tag by adding -agentlib:yjpagent option, like:
<string>-Xms16m -Xmx192m -XX:MaxPermSize=120m -Xbootclasspath/p:../lib/boot.jar -ea -agentlib:yjpagent</string>
If you want to profile the slow startup of the application, CPU snapshot recording should be started automatically by using the following option instead:
-agentlib:yjpagent=sampling,noj2ee
Note that yjpagent library provided with IntelliJ IDEA 9 or earlier will not work on 64-bit operating system when you run IntelliJ IDEA under 64-bit JVM. If you can't run under 32-bit JVM, please obtain the 64-bit library version from the YourKit Java Profiler distribution (you need Linux .zip download of 7.5 or 8.x version containing library versions for different operating systems: Linux, Mac, Solaris, Windows). Replace yjpagent library in IDEA_HOME\bin with the appropriate version. Use 8.x YourKit version with IntelliJ IDEA 9.x and 7.5 version with previous IntelliJ IDEA versions. IntelliJ IDEA 10 and later has both 32-bit and 64-bit libraries bundled, therefore this step is not required.
Start IntelliJ IDEA and you should notice 2 new buttons in the toolbar, one for taking CPU snapshot, another one for Memory snapshot. Press the CPU button and perform the actions which take a lot of CPU resources on your machine. When finished, press this button again to stop recording, save the snapshot and upload it to ftp://ftp.intellij.net/.uploads/ (please note that listing is not allowed in this directory, only upload is permitted, therefore you will not be able to see/download your and other files there, some FTP clients may not like it, also be sure to switch into the binary transfer mode if uploading via commnad line ftp client). If you can't access FTP, use some free file sharing service and send us a link.
Send us an e-mail with the file name and we'll investigate the issue. In the e-mail please also describe what you were doing in detail. If you can reproduce it in a small project, please provide one. You can also submit an issue to YouTrack instead of contacting us by mail.
IntelliJ IDEA Community Edition does not include a YourKit profiling agent, because the YourKit agent library is not open-source. To take a CPU or memory snapshot with IntelliJ IDEA Community Edition, you can download an evaluation version of YourKit Java Profiler, copy the yjpagent library to the IntelliJ IDEA binary directory, add it to the VM options as described above, and connect to the running IntelliJ IDEA instance from the standalone YourKit Profiler UI.
In case of memory related issues (memory usage goes high, garbage is not collected, etc) please use the Memory snapshot button in the menu near the CPU snapshot button. If it's not possible to get the snapshot because of the application crashing with OutOfMemory errors, please add the
-XX:+HeapDumpOnOutOfMemoryError
option to the IntelliJ IDEA JVM options. On the next OOM error the .hrpof dump will be produced and saved by the JVM (usually in the application working directory which is IDEA_HOME\bin). Upload this dump to our FTP as described above in the CPU snapshot section.
Please note that memory snapshot may contain the sensitive source code from your project. If you are uploading to a public service, use some password protection or enctyption. JetBrains FTP server is write only and you don't need to protect files uploaded there.
Thread dumps do not replace CPU snapshots. Dumps are for complete UI hangs, CPU snapshots are for performance problems.
And for 64-bit Linux, use -agentlib:yjpagent64 which is included in the EAP's if not release version.
It would be great to remove the information for ancient versions from the document in order to make it easier to read / follow.
I tried to add the yjagent64 but it does not want to show in the toolbar. Still I can see the two icons in the toolbar editor but I am not able to convince PyCharm 1.2.1 to display them.
IDEA 10 has both 32-bit and 64-bit libraries bundled, therefore this step is not required. -- This makes the entire paragraph skippable, from my knowledg PyCharm 1.2.1 is based on IDEA 10 codebase.
PyCharm distribution differs from IDEA, it doesn't bundle 64-bit executables and 64-bit profiler libraries.
What you say is strange, considering that Activity Monitor reports PyCharm as a 64bit process and that I was able to capture CPU usage data of around ~1mb (zipped).
What I said applies to Windows platform. On Mac/Linux architecture will depend on the used JDK and user preferences for the application.
Note that memory snapshot produced by Appcode (didn't test with other IDE) may contain source code of files opened at time of making it.
Serge, in IDEA version 8, is all this still valid? i notice thread dumps already in my logs directory. is this mechanism for a total lockup of the IDE when there has been no automatic thread dump?