Wait after startSPUProfiling ??

Questions about YourKit Java Profiler
Post Reply
gbhambri
Posts: 4
Joined: Mon Aug 10, 2015 8:55 am

Wait after startSPUProfiling ??

Post by gbhambri »

I am using framework API to connect to remote host on specific port and profile for my some of the interesting APIs. I wanted to wait for my test case to get over before i call stopCPUProfiling ?? Is there any relevant way to achieve this ?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Wait after startSPUProfiling ??

Post by Anton Katilin »

If you're using the API to start profiling when some test starts (a method enters?), stop profiling when it exits. Or use a low level timer to stop profiling when necessary.

Alternatively, please consider triggers:
https://www.yourkit.com/docs/java/help/triggers.jsp

For example, you may add a trigger which starts profiling on entering a specified method, sleeps for given number of seconds, then stops profiling and captures a snapshot for further analyzing.

Anyway, please note that the API and the triggers are means to automate profiling tasks, and it makes sense to use them to automate repetitive profiling tasks. If you need to solve a one-time task, please consider using the profiler UI to control profiling, as this may be the simplest, easiest and fastest way to achieve your goal.
Post Reply