Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Api agent

Moderators: Vladimir Kondratyev, Anton Katilin

Api agent

Postby Gustavo Woltmann » Wed Feb 24, 2016 11:44 pm

Is there a way to start and stop profiling from inside the profiled application itself programmatically ?
I'd like to profile a section of code only when certain application conditions are met, i.e. in app code I would like to make a temporary change and have something like this:

try {
if (app conditions) {
Profiler.startCpuProfiling();
}
....
} finally {
Profiler.captureSnapshot("snapshotfile");
}
Gustavo Woltmann
 
Posts: 2
Joined: Wed Feb 24, 2016 6:36 pm

Re: Api agent

Postby Anton Katilin » Thu Feb 25, 2016 4:32 pm

Yes. Please use the profiler API, class com.yourkit.api.Controller:

https://www.yourkit.com/docs/java/help/api.jsp

As an alternate solution, please consider triggers on method invocation:
https://www.yourkit.com/docs/java/help/triggers.jsp
Anton Katilin
 
Posts: 5576
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Bing [Bot] and 6 guests