generating comparison between 2 snapshots programatically

Questions about YourKit Java Profiler
Locked
Ganesh Ind
Posts: 2
Joined: Fri Feb 03, 2012 10:07 am

generating comparison between 2 snapshots programatically

Post by Ganesh Ind »

Hi There,

Yourkit API and command line options do provide capturing snapshots programatically. but said that I tried finding out functionality where in we can compare two captured snapshots and export the comparison data (specific view) in csv format. Do we have such feature in Yourkit?

Our goal is to integrate YourKit such that we start CPU profiling for a daily build (which happens using a CI tool) when we deploy the server and take a snapshot once our automated test case execution is through so that we can capture the entire cycle of events.

This is expected to be followed by automated comparison with yesterday's snapshot and some analysis on the exported data to generate reports of product status everyday.

Can we achieve it using YourKit?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: generating comparison between 2 snapshots programaticall

Post by Anton Katilin »

Hello,

Current version does not provide means to compare snapshots programatically, but you can do the following:

1) programatically export profiling results to CSV or XML:
https://www.yourkit.com/docs/java/help/ ... ommandline
2) write a simple program/script to parse and compare the results you are interested in.

Best regards,
Anton
yuman
Posts: 16
Joined: Sat Jun 11, 2011 4:49 am

Re: generating comparison between 2 snapshots programaticall

Post by yuman »

Is there a quick way to compare snapshots on the basis of relative, or percentage of total, time cost, instead of the default millisecond measurements? The duration periods of the snapshots are different and the ms numbers are not comparable.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: generating comparison between 2 snapshots programaticall

Post by Anton Katilin »

Do you mean comparing snapshots in UI or of the exported results?

In UI, current version allows to compare absolute times only. Are you interested in how much time in % some methods took during performing some operation? If yes and if the operation corresponds to a particular method call (e.g. processing a request) f(), you can:
- open both snapshots
- select f() in Class list of both
- see percents in Callees list in a slave view.
It's not an automated comparison, but still is useful and is easy to do.

If you mean the exported result, then you can write a program or a script to automate processing. If f() takes t1 ms in first snapshot and t2 ms in second snapshot, scale the results in the second snapshot by factor t1/t2. Or simply scale all times in each snapshot by 100% / f()'s time, so you'll get the callees times as percents of f().
yuman
Posts: 16
Joined: Sat Jun 11, 2011 4:49 am

Re: generating comparison between 2 snapshots programaticall

Post by yuman »

Anton,

Thanks for the recommendations. For my case, the first approach of scaling with a common master method is good enough. The question I was trying to answer was "what changed". The focus was on the exception, rather than the normal.
ron.amir
Posts: 6
Joined: Mon Apr 24, 2023 9:29 am

Re: generating comparison between 2 snapshots programatically

Post by ron.amir »

Hello ,The link posted here is broken. I'd like to know if there is a way to compare snapshots programmatically or export snapshot results programmatically
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: generating comparison between 2 snapshots programatically

Post by Anton Katilin »

ron.amir
Posts: 6
Joined: Mon Apr 24, 2023 9:29 am

Re: generating comparison between 2 snapshots programatically

Post by ron.amir »

is this operation supported only with java 17?
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Re: generating comparison between 2 snapshots programatically

Post by Vladimir Kondratyev »

is this operation supported only with java 17?
Please run command line export with Java which is bundled into YourKit profiler. The supplied Java always fulfills all requirements.
ron.amir
Posts: 6
Joined: Mon Apr 24, 2023 9:29 am

Re: generating comparison between 2 snapshots programatically

Post by ron.amir »

When running with the bundled java I get the following:

Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.yourkit.Main.a(a:223)
at com.yourkit.Main.main(a:160)
Caused by: java.lang.RuntimeException: EULA is not accepted. Please start profiler UI, read and accept EULA.
at com.yourkit.m.c.b(a:19)
at com.yourkit.m.b.wR(a:64)
at com.yourkit.e.az.start(a:108)
at com.yourkit.e.x.et(a:175)
at com.yourkit.Main1.e(a:239)
at com.yourkit.Main1.main(a:96)
... 6 more

how can I accept EULA via commandline?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: generating comparison between 2 snapshots programatically

Post by Anton Katilin »

If you accept the EULA, create the file marker file via

echo > ~/.yjp/.agreement-accepted
Locked