RFR: 7903740: JMH: Perf event validation not working with skid options [v6]

Galder Zamarreño galder at openjdk.org
Thu Oct 10 12:16:25 UTC 2024


On Tue, 24 Sep 2024 18:38:32 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> That is to say, I am willing to accept the simple patch like:
> 
> ```
> diff --git a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java
> index c948532f..69d74a86 100644
> --- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java
> +++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java
> @@ -46,7 +46,7 @@ public class LinuxPerfAsmProfiler extends AbstractPerfAsmProfiler {
>      public LinuxPerfAsmProfiler(String initLine) throws ProfilerException {
>          super(initLine, "cycles");
>  
> -        String[] senseCmd = { PerfSupport.PERF_EXEC, "stat", "--event", Utils.join(requestedEventNames, ","), "--log-fd", "2", "echo", "1" };
> +        String[] senseCmd = { PerfSupport.PERF_EXEC, "record", "-q", "--event", Utils.join(requestedEventNames, ","), "-o", "-", "echo", "1"};
>  
>          Collection<String> failMsg = Utils.tryWith(senseCmd);
>          if (!failMsg.isEmpty()) {
> ```
> 
> ...and everything else needs _a very hard justification and a lot of testing_ to make sure it does not break in the cases it is supposed to work. The fact the PR code fails on my first actual try does not inspire confidence, to be honest.
> 
> Remember: the capabilities check in constructor is an opportunistic check, it can pass by accident, and users would discover their profiler does not really work later when looking at the results. The check should _NOT_ fail by accident, when the profiler would actually work, if not for a misbehaving capability check.

I will give your suggestion a go and see if `LinuxPerfAsmProfilerTest` passes on CI with that fix.

-------------

PR Comment: https://git.openjdk.org/jmh/pull/132#issuecomment-2404926653


More information about the jmh-dev mailing list