i have been looking @ way jmh implements "multithreaded" benchmarks. understanding, annotations @group("identifier")
, @groupthreads(thread_number)
enable running in parallel benchmarks within same group.
@benchmark @group("parallel") @groupthreads(1) public void benchmark_1() { while(true) {} } @benchmark @group("parallel") @groupthreads(1) public void benchmark_2() { while(true) {} }
using cpu monitor, 2 cpu's used. know how runner interpret annotations.
have tried reading javadocs? not answering question?
e.g. @group
says:
* <p>multiple {@link benchmark} methods can bound in execution group * produce asymmetric benchmark. each execution group contains of 1 * or more threads. each thread within particular execution group executes * 1 of {@link group}-annotated {@link benchmark} methods. number of * threads executing particular {@link benchmark} defaults single thread, * , can overridden {@link groupthreads}.</p> * * <p>multiple copies of execution group may participate in run, , * number of groups depends on number of worker threads requested. * jmh take requested number of worker threads, round execution * group size, , distribute threads among (multiple) groups. * among other things, guarantees fully-populated execution groups.</p> * <p>for example, running {@link group} 2 {@link benchmark} methods, * each having {@link groupthreads}(4), run 8*n threads, n * integer.</p>
so, @group
produces asymmetric benchmark, @groupthreads
controls distribution of threads within group (-tg ...
in cli dubs it). @threads
how many threads run in total (-t ...
in cli dubs it).
Comments
Post a Comment