How to enable wall-clock profiling for Intellij Async Profiler? - intellij-idea

I'd like to measure how much time my app spends in the database.
I've added the CPU Profiler to Intellij's Settings / Build / Java Profiler, but by default it shows the code with most CPU cycles, which is useless for me since the JDBC driver basically sleeps while the response is received.
Sounds like Wall-clock profiling is the way to go, however I don't know how to enable that in Intellij's CPU Profiler configuration window. The README says -e wall, while Intellij's Agent Options look totally different: threads,interval=1ms,framebuf=15000000. How can I configure Intellij's Async Profiler to use Wall-clock please?

The answer, according to the comment above by y.bedrov is to use the "event=wall" option. For me, using Ultimate 2020.1 with the defaults already set up...
IntelliJ IDEA / Preferences... / Build, Execution, Deployment / Java Profiler / CPU Profiler / Agent options: threads,interval=1ms,framebuf=15000000,event=wall
I'm putting it in the form of an answer not because I want to get the credit, but because when I looked at this question originally, I almost ignored it because there was no answer. Then I noticed that the answer was in a comment.

Related

Command schedule with IntelliJ

I have the following command that I run with terminal in IntelliJ
testcafe chrome test.ts
Is there any way to make this command to be run at 11pm? I mean to schedule it.
I will be very thankful for you guys.
A short answer is yes.
A longer answer is you don't want to do this in your IDE, but use other tools like cron.
You don't mention what operating system you use, so it's difficult to be concrete here, on Unix and Linux system, you'll typically have cron installed and so you can use it for this task.
If you're using a Windows system, I recommend reading this SO question, you will likely find an answer there.

How to Use Intellij idea14.0.2 to Debug the golang?

The Debug button is disable, Shift+Alt+F9 will show this:
How to properly configure the debug page?
Update. The Go plugin supports Delve on Linux and Mac since September 2015 and on Windows since January 2016.
Original answer:
Currently we are dropping support for the debugger with gdb as it's very hard to use and unstable. Please see the go docs for gdb debugging
However, there are efforts in getting the open-source Delve debugger support for IDEs from which IDEA will benefit as well.
Please bug the Go team to support Delve or another debugger in order to have a stable solution and then integration with IDEA could be done.
thanks ,solved it.
Intellij Config is not right
The debug feature was introduced by issue 25, and commit 3a21e14
The correct way is to implement the debugger interfaces in inteliij and to hook them to a running gdb process.
(Here is an example of manually calling gdb to debug a Go program; using the options -c -gcflags '-N -l': not sure if the -l would matter as it is missing from the OP's screenshot "Go builder arguments")
It is possible the debug button is disabled if no gcc is configure for the Go debug process to use.
Note also that since PR 644:
"Debug" is disabled, if "Build Before run" is not enabled.
This should fix the problem, when gdb wants to run a not existing executable, because the outputDir is not set.

Intellij IDEA freezes up, even when editing a .txt file

When I return to intellij, sometimes just to edit an already open .txt file, Intellij would freeze and I get pissed at waiting for 3-4 seconds.
Sometimes, in Java files this happens all the time. And I would have to restart Intellij. Autocompletion is sometimes a ****.
I have a super computer, ala NSA, no just kidding, but it is a powerful beast, and Intellij properties have been altered:
-server
-Xms2048m
-Xmx4096m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=2048m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=200
-Dawt.useSystemAAFontSettings=lcd
Various plugins have been disabled, including hg4xxx.
What is the dealio? I am on Intellij 13
I would recommend dropping your memory settings down. When memory options are set too high you get pauses due to garbage collection and other memory management issues. Over the years in the BSO days (Before StackOverflow), the JetBrains IntelliJ IDEA forum routinely had some post an issue with brief hangs that ended up being solved by them dropping their memory settings down. At one point, IDEA even opened a warning popup on start-up if the more than 700MB of memory was allocated.
For the past 7 years of 10 years of IDEA usage I have run IDEA using:
-Xms128m
-Xmx724m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:ReservedCodeCacheSize=96m
And I frequently have numerous large projects open and have no performance issues. With that said, a recent change to the scala plug-in (at least for the EAP version of IDEA 14) suggests increasing both -Xms & -Xmx to 2048m. I've only just implemented that myself yesterday. So I need to see if it causes any issues.
If changing memory settings does not resolve the issue, I would recommend disabling all third-party (i.e. non-bundled) plug-ins to ensure that is not an issue. (They often are.) If that resolves it, you can track down which particular plug-in is causing the issue.
Another culprit that can cause this issue is anti-virus software. IDEA uses a lot of cache and index files that are updated frequently. JetBrains recommends you add the IDEA system and config directories from anti-virus real time monitoring. See Directories used by the IDE to store settings, caches, plugins and logs for their locations.
In regards to the pauses upon frame reactivation, you may want to turn off File > Settings (Ctrl+Alt+S) > [IDE Settings] > General > Synchronization > Synchronize files on frame deactivation. Usually it's not a problem to have this turned on. But on some systems it might cause an issue. Be aware however if you routinely edit project files outside of IDEA, you need to be more cautions and manually run a File Synchronization when you return to IDEA.
If after that the issue persists, I recommend you take a CPU and Memory Snapshot (as outlined in the linked document) and submit them to JetBrains.

intellij 13.1.1 hang on window7 64bit

I used intellij 13.1.1 on window7 64bit(32G memory).
Sometimes when I'm editing .vm file(velocity template file), intellij hang suddenly.
And then I restarted intellij.
As far as I experienced, editing with java source files and other files are OK.
how should I do?
P.S. below is my vmoptions.
idea64.exe.vmoptions
-Xms4096m
-Xmx10240m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=1024m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-Dfile.encoding=UTF-8
First, upgrade to 13.1.2 (release notes) that was release a couple of days ago. That version fixes a Mac specific hang (reported by a co-worker of mine) and a hang on Windows when opening projects that I reported. Those (or other fixes) may solve your issue. (I'm not seeing any Velocity specific fixes).
I agree with #d33j In the 10+ years of IDEA usage and daily forum visits & reading of bug reports (yes, I am obsessed with IntelliJ IDEA), the #1 cause of Hangs is people tweaking their VM options, and especially setting them too high. I highly recommend leaving all the default settings and only bump up the -Xmx to 750m on a 32-bit machine, and maybe to 900m on a 64-bit machine using a 64-bit JDK and the idea64.exe. Any higher and you get GC pauses and other issues. I (and all my co-workers) have been using those settings for years with multiple very large complex projects open without any issues.
If after adjusting you still have issues, go to your log directory (Help > Show log). When a hang occurs, IDEA will output thread dumps. So you should see a threadDumps directory with a current date and timestamp. Take a look at those and see if anything jumps out. In particular, anything in a third party plug-in.
The second biggest cause of hangs is an error in third party plug-ins. Disable any third party plug-ins. (Settings > [IDE Settings] Plugins and change the Show dropdown to "Custom"). Disable all of those and restart. If the issue goes away, use a binary search to locate the problematic plug-in.
If none of the above solves the issue, Follow the instructions from the JetBrains support document Reporting performance problems and/or Getting a thread dump when IDE hangs and doesn't respond to submit the issue to them. Also attach your threadDump directory (as mentioned above) and log file.

How can i use this suggested intelliJ command to disable double buffering?

I use intelliJ 12 - despite requests from ages ago, it still runs really slowly on a remote connection.
One of the suggested settings is to use
RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
I have no idea what that means, but I am keen to try it out - can someone let me know how I can execute this command on my intelliJ? So that it will work smoother, i mean?
Original issue has a comment that links to this answer with the link to plug-in jar. Download the jar, Install from disk in Setting | Plugins.