There must be either a huge bug in the profiler or a huge gap in the documentation, but we are unable to use sampling profiler to get meaningful results.
We have an application that communicates with other process via network, calls remote API synchronously.
Expectation is that if using sampling settings like below we would see also those calls in the method list.
Code: Select all
walltime=*
sampling_period_ms=1
Note: exact same application instance profiled with JProfiler works out of the box and shows expected picture.
Yourkit also shows no errors and except the missing data everything else seem to work as expected.
We have enabled/disabled all filters, tried all possible sampling wildcards, but there seem to be no way to convince Yourkit to show walltime properly for all methods, except one uses wildcard for exact the method that we know spends time. But we don't know upfront, which method / class will be slow, it's the profiler job to find that out!
So with this settings it works for this concrete sleepSeconds2 method that mimics external process. However, this is not a solution for us: we have gazillions of classes and methods that call remote API, we need a wildcard that allows us to see walltime for all classes & methods.
Code: Select all
walltime=ProfilingExternalTime : sleepSeconds2(*)
sampling_period_ms=1
Code: Select all
import java.util.concurrent.TimeUnit;
public class ProfilingExternalTime {
public static void main(String[] args) {
executeExternalTask();
sleepSeconds(1);
}
static void executeExternalTask() {
long start = System.nanoTime();
sleepSeconds2(3);
long stop = System.nanoTime();
System.out.format("measurement took: %.2f sec%n", (float)(stop - start) / 1000_000_000);
}
static void sleepSeconds(int seconds) {
try {
TimeUnit.SECONDS.sleep(seconds);
System.out.println("Done sleeping " + seconds + " seconds.");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
static void sleepSeconds2(int seconds) {
try {
ProcessBuilder pb = new ProcessBuilder("sleep", "" + seconds);
Process process = pb.start();
process.waitFor(seconds, TimeUnit.SECONDS);
System.out.println("Done sleeping " + seconds + " seconds.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Neither sampling settings like below show sleepSeconds2
walltime=*
walltime=*.*
walltime=*.*:*(*)
Code: Select all
uname -a
Linux socbm599 3.10.0-862.3.2.el7.x86_64 #1 SMP Tue May 15 18:22:15 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux