RFR: 7903740: JMH: Perf event validation not working with skid options [v4]
Galder Zamarreño
galder at openjdk.org
Thu Aug 22 12:12:17 UTC 2024
On Wed, 21 Aug 2024 14:25:02 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Why can't we just use perf record --event $requestedEventNames --output $tempdir echo 1?
I couldn't find a reliable way that worked bare metal and on CI that would allow me to inspect the output of that and validate whether it worked or not. I've only been able to make it work in all environments by explicitly adding an output file (with `-i`) and then using `perf report` to verify its contents.
What are the issues I had? If you look at the commit series you can see the progression of trial/error.
First I tried to use `perf record` and see if I could just parse its output to see if could find a way to make sure it worked fine. I tried the approach [here](https://github.com/galderz/jmh/blob/2a9380664f9dd667fa10fe08b12d5c7e97c58b95/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java#L58), but that didn't work on [CI run](https://github.com/openjdk/jmh/runs/28853969690) for it. I'm not 100% sure why it didn't work, but I found odd that there was so much additional output in the `perf record` output, see my tests [here](https://github.com/galderz/github-actions/actions/runs/10417234664/job/28851057186).
After some test I realised that the additional output in `perf record` is the output that normally goes into `perf.data` file but on CI that does not happen. Instead the output goes to standard output.
So, if the output of `perf record` cannot really be used to determine the outcome, I decided to combine it with `perf report`. Also, I explicitly added the `-i` parameter to add an output file and avoid the mangling of the output.
Eventually I narrowed down the solution to the combination of `perf record` and `perf report` commands that you see in this [GH action](https://github.com/galderz/github-actions/actions/runs/10418351274/job/28854335728) of mine. That's the logic I applied to the code here and seems to work as expected.
-------------
PR Review Comment: https://git.openjdk.org/jmh/pull/132#discussion_r1726934808
More information about the jmh-dev
mailing list