<div dir="ltr">Hi all! <br><br>JMH comes with a DTraceAsmProfiler, which could be used on macOs as a replacement for LinuxPerfAsmProfiler.<br>While it serves its purposes well, there are a few shortcomings: dtrace requires superuser privileges and it can only sample by timer interrupts.<br><br>While the first shortcoming may not be considered as a big issue (as long as you know that a benchmark you're profiling won't attempt to remove '/'), the latter sets a limit on what and how could be profiled. <div>You can argue that developers could always take a Linux host and profile their benchmarks there,  but it's definitely not as convenient as profiling the code on the same host you're developing it.</div><div><br>Thankfully, XCode comes with the Instruments tool [1] which allows you to do a lot of different things, including sampling profiling (both using timer interrupts and PMI). And it has a CLI called xctrace [2].</div><div>xctrace allows profiling an app from the command line the same way Instruments does it (with a caveat that some non-trivial configuration has to be performed in UI beforehand) and it requires neither superuser privileges, nor SIP being disabled.<br><br>How do you feel about adding a new JMH ASM-profiler wrapping the xctrace tool?</div><div>Some time ago I developed such a wrapper [3] and it works fine, so if there are no strong arguments for not having such a profiler, I would love to contribute it to the JMH.<br><br>It's also worth mentioning that xctrace not only allows to implement LinuxPerfAsmProfiler replacement for the macOs, but it's also possible to implement LinuxPerfNormProfiler-alike profiler on top of xctrace.<br><br>There are some implementation-specific questions that need to be discussed if you will be positive about adding a xctrace-based profiler to the JMH, but I'll abstain from posting it for now.<br><br>Best regards,<br>Filipp.<br><br>[1] <a href="https://help.apple.com/instruments/mac/current/#/">https://help.apple.com/instruments/mac/current/#/</a><br>[2] <a href="https://keith.github.io/xcode-man-pages/xctrace.1.html">https://keith.github.io/xcode-man-pages/xctrace.1.html</a><br>[3] <a href="https://github.com/fzhinkin/xctraceprof">https://github.com/fzhinkin/xctraceprof</a><br></div></div>