Linux cpu affinity for forked benchmaks

Laurent Bourgès bourges.laurent at gmail.com
Tue Jan 21 08:45:22 UTC 2020


Hi,

FYI I made a simple jmh profiler that sets the cpu affinity for runned
benchmarks. It helped me ensuring tests are run on isolated cpu cores.

Here is the code: it uses the environment variable CPU_CORE_IDS to call
taskset -c cpus java ...

See
https://github.com/bourgesl/nearly-optimal-mergesort-code/blob/master/sort-bench/src/main/java/edu/sorting/bench/LinuxAffinityHelperProfiler.java

Do you think that would be worth to integrate in JMH ?

Cheers,
Laurent


More information about the jmh-dev mailing list