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.

Programmatically invoke Yourkit

Moderators: Vladimir Kondratyev, Anton Katilin

Programmatically invoke Yourkit

Postby sranjan » Thu Aug 18, 2016 8:03 am

Hi,

My company has an enterprise license for Yourkit.

For one of our use cases, we would like to programmatically invoke Yourkit to do some sampling and parse the snapshot file and display some statistics. We were looking at the javadocs api at https://www.yourkit.com/docs/80/api/index.html and while it does seem to expose some interfaces we would like to try out, we can’t find how to pass the license server/license key details programmatically.

In summary, invoking Yourkit to generate the snapshot seems easy, the tricky part seems to be programmatically reading this snapshot and generating some statistics from it. Is this possible at all? If so, please could you point me to some docs or samples that could be helpful.
sranjan
 
Posts: 4
Joined: Thu Aug 18, 2016 5:49 am

Re: Programmatically invoke Yourkit

Postby Vladimir Kondratyev » Thu Aug 18, 2016 11:02 am

Hello,

which profiler version do you use?

Best regards,
Vladimir Kondratyev
YourKit GmbH
http://www.yourkit.com
"Don't get lost in data, get information!"
Vladimir Kondratyev
 
Posts: 1444
Joined: Tue Aug 10, 2004 7:52 pm
Location: Düsseldorf, Germany

Re: Programmatically invoke Yourkit

Postby sranjan » Thu Aug 18, 2016 1:24 pm

11.0.10
sranjan
 
Posts: 4
Joined: Thu Aug 18, 2016 5:49 am

Re: Programmatically invoke Yourkit

Postby Vladimir Kondratyev » Thu Aug 18, 2016 2:21 pm

Version 11.x is not supported, so we recommend to upgrade to latest v2016.2.

In v2016.2 you can load snapshot from command line and export it into different formats. Please find details at https://www.yourkit.com/docs/java/help/export.jsp

Best regards,
Vladimir Kondratyev
YourKit GmbH
http://www.yourkit.com
"Don't get lost in data, get information!"
Vladimir Kondratyev
 
Posts: 1444
Joined: Tue Aug 10, 2004 7:52 pm
Location: Düsseldorf, Germany

Re: Programmatically invoke Yourkit

Postby sranjan » Fri Aug 19, 2016 12:03 pm

Hi Vladimir,

Thanks for the tip. I had couple of other related questions -

1.) Other than running the export locally on the same machine as you mentioned, is it possible to invoke the export programmatically using the API? We are able to connect to the remote agent programmatically and trigger the sampling so, it would have been kind of useful to be able to export also programmatically.

2.) The snapshot file is generated on the remote host (where the agent is running). Now, we know that the YourKit UI is able to retrieve the snapshot from the remote agent and display the statistics on the UI. Is it also possible to be able to retrieve the generated snapshot file programmatically from the remote host?

Please could you help?

Kind Regards
sranjan
 
Posts: 4
Joined: Thu Aug 18, 2016 5:49 am

Re: Programmatically invoke Yourkit

Postby Anton Katilin » Sun Aug 21, 2016 12:44 pm

Hi,

1) The export functionality requires a full installed copy of the profiler which is properly activated with a license key. Thus to perform export on a remote machine you need to dedicate a license seat for it. You decide whether this makes sense in your particular case.

2) There is no built-in support for that, but since snapshots are just files you can transfer them via any means for file transfer e.g. scp.
Anton Katilin
 
Posts: 5576
Joined: Wed Aug 11, 2004 8:37 am

Re: Programmatically invoke Yourkit

Postby sranjan » Mon Aug 22, 2016 9:55 am

Hi Anton,

Anton Katilin wrote:2) There is no built-in support for that, but since snapshots are just files you can transfer them via any means for file transfer e.g. scp.


The idea is to be able to do it programmatically without involving a lot of operational overhead - e.g. scp or SFTP etc.

We were wondering how does the UI do it? For e.g. if you are using the Yourkit UI to profile a remote server, once you stop the sampling, it gives you an option to save the snapshot locally. Surely, it must be the Yourkit agent running on the remote host that must be transferring the files to it maybe in some sort of native way. Direct socket?

We were wondering if it was possible to mimic this behaviour programmatically too as it would be more efficient.

Kind Regards
sranjan
 
Posts: 4
Joined: Thu Aug 18, 2016 5:49 am

Re: Programmatically invoke Yourkit

Postby Anton Katilin » Mon Aug 22, 2016 12:32 pm

The profiler UI collects information from the profiler agent, periodically updating it. In other words, the UI maintains a local copy of the agent data. There is no public API for doing the same. The profiler agent is listening on port. The communication protocol is binary, internal and is subject to change between versions.
Anton Katilin
 
Posts: 5576
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: No registered users and 11 guests

cron