Linux cpu affinity for forked benchmaks
Laurent Bourgès
bourges.laurent at gmail.com
Tue Jan 21 20:41:13 UTC 2020
Le mar. 21 janv. 2020 à 09:50, Aleksey Shipilev <shade at redhat.com> a écrit :
> On 1/21/20 9:45 AM, Laurent Bourgès wrote:
> > 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 ?
>
> Maybe? But this is not the job for Profiler. Using it to inject "taskset"
> to the running process is
> the abuse of API. It should be somewhere in Runner. And the appropriate
> fallbacks should be present
> when taskset is not available, e.g. on Windows.
>
Thanks for your prompt feedback.
At least, it works and I advocate it is a quick & dirty hack ! So anybody
that have the same need (setting linux cpu affinity before benchmarks
(forks) knows that there is a dirty hack that does the job.
If there is any interest, I could rewrite the 'taskset' call in another
Runner API, I did not find any available hook.
As I practice not so much Windows, I do not have any idea how cpu affinity
could be set by the command line...
Laurent
More information about the jmh-dev
mailing list