Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy to use performance and memory .NET profiler for Windows and Linux.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

API control over snapshot directory

Moderators: Vladimir Kondratyev, Anton Katilin

API control over snapshot directory

Postby faceless » Sun Mar 21, 2021 4:21 pm

Long time user of Yourkit - I'm investigating integrating Yourkit with my Jenkins CI server, the goal being automatically sampling the test runs of our application, and storing the output so I can check for change over time.

I've come to the conclusion the best way to do this, for us, is to use the API. We use ant, which compiles the source then runs our regression test in the same JVM. I don't want to profile the build stage. I also don't want to profile the regression analysis at the end. So

The API looks easy to use, except that I can't seem to set the directory I want the snapshot written to. This matters - I want to archive the snapshot along with the rest of the output, so I need to make sure it's in the correct place. And I'd rather not use the "<agent user home>/.yjp/snapshotdir.txt" approach - there may be multiple tests running at once, so I don't want a static configuration file.

Is there any way to set the directory programatically? If not is this something that could be added? controller.setSnapshotDirectory() or something would be ideal.
faceless
 
Posts: 2
Joined: Sun Mar 21, 2021 3:57 pm

Re: API control over snapshot directory

Postby Anton Katilin » Mon Mar 22, 2021 9:07 am

Hello,

Snapshot directory customization is described in https://www.yourkit.com/docs/java/help/snapshot_dir.jsp

You can set the directory per process by using the "dir" agent startup option:
https://www.yourkit.com/docs/java/help/ ... ns.jsp#dir

There is no API call to change the snapshot directory. However, you can move the snapshot file to another location programmatically right after capturing the snapshot. The methods Controller.capture*Snapshot() return the captured snapshot file path, please use java.nio.file.Files.move() to move the file to the desired location.
Anton Katilin
 
Posts: 6064
Joined: Wed Aug 11, 2004 8:37 am

Re: API control over snapshot directory

Postby faceless » Mon Mar 22, 2021 9:39 am

Thanks Anton, using Files.move() was the conclusion we came to as well.
faceless
 
Posts: 2
Joined: Sun Mar 21, 2021 3:57 pm


Return to Java Profiler

Who is online

Users browsing this forum: No registered users and 1 guest

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.