Profile short-lived application

Questions about YourKit Java Profiler
Post Reply
Chris
Posts: 6
Joined: Fri Aug 13, 2004 7:15 am

Profile short-lived application

Post by Chris »

I've just grabbed a copy of the 3.0 EAP and am trying to figure out if it's possible to connect to and profile an application that only runs for a second or two (in my case a unit test it's a unit test that I'm running from IDEA). Doesn't seem like it is?

Currently it seems that I can only connect to an already running application. It would be nice to have an option for YourKit to wait until it received a signal when the unit test started so the entire execution could be profiled.
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Re: Profile short-lived application

Post by Vladimir Kondratyev »

Chris wrote:I've just grabbed a copy of the 3.0 EAP and am trying to figure out if it's possible to connect to and profile an application that only runs for a second or two (in my case a unit test it's a unit test that I'm running from IDEA). Doesn't seem like it is?

Currently it seems that I can only connect to an already running application. It would be nice to have an option for YourKit to wait until it received a signal when the unit test started so the entire execution could be profiled.
yjpagent DLL has numerous parameters that allow to start CPU or memory profiling just from JVM startup and capture snapshot on JVM exit.

Please try something like that yjpagent:sampling,onexit=cpu
It should start CPU profiling (with sampling method) and CPU snapshot will be captured on JVM exit. More about agent's option you can read in output of yjpagent:help (current documentation is a bit outdated)
Chris
Posts: 6
Joined: Fri Aug 13, 2004 7:15 am

Post by Chris »

Ahh I see, thanks for the pointer (and the quick response). Looks like this will work fine when I run YourKit standalone, however I still can't see how I have any control over the parameters that get passed to the yjpagent dll when it is called by the IDEA plugin.

I've done a bit of digging and found the ~/.yjp-3.0/ide-integration.config file, but am I right in thinking that this is only used when launching the YourKit UI as a separate process, as opposed to running the profiler from within IDEA?

Is there a way to get a snapshot saved when I click the "Profile" button in IDEA? Or better yet, have the output of the profiler fed directly into an already running instance of the YourKit UI?

Apologies if I'm missing something obvious, it's not clear to me from the docs how I should go about doing this. The only thing I could think of was to specify the -Xrun string as a VM param to a normal 'Run' configuration, i.e. to bypass the plugin completely which gets a bit messy.
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Chris wrote:Ahh I see, thanks for the pointer (and the quick response). Looks like this will work fine when I run YourKit standalone, however I still can't see how I have any control over the parameters that get passed to the yjpagent dll when it is called by the IDEA plugin.
Chris, plugin for IDEA doesn't allow to specify such "advanced" options yet. We will implement it in one of the next EAP builds (#406 or #407). As temporary workaround I'd suggest you to specify -Xrunyjpagent with necessary option in ordinar IDEA run configuration (user ordinar Run action instead of profiler). Sorry, for temporary inconvenience.
Post Reply