Asymmetric Test Setup
Aleksey Shipilev
shade at redhat.com
Fri Jan 6 15:36:38 UTC 2017
Hi,
@Setup/@TearDown-s are supposed to deal with state object, and the invariant is
that only a single thread is setting up / tearing down the state object. In case
of @State(Benchmark), one of the threads in the run would enter. In case of
@State(Group), one of the threads in the group would enter. With @State(Thread),
every thread has its own state, and so one thread will enter, which is the only
thread.
If you want to have multiple threads touch the object in @Setup, then you
probably need to arrange State DAG [1] with @State(Benchmark) holding the lock,
and @State(Thread) @Setup for every thread.
If this wasn't your question and/or you suspect a bug, please provide the
minimal testcase.
Thanks,
-Aleksey
[1]
http://hg.openjdk.java.net/code-tools/jmh/file/49d9f9db54fc/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_29_StatesDAG.java
On 01/04/2017 08:44 AM, Mohit Kumar wrote:
> For now im using a custom executor.
>
> On Wed, Jan 4, 2017 at 9:28 AM, Mohit Kumar <mohit.riverstone at gmail.com>
> wrote:
>
>> Hi People,
>>
>> Having trouble getting affinity lock(Peter's JTA) for all threads in
>> Asymmetric tests.
>> It seems all threads in @group dont call @setup.
>>
>> Am i missing something?
>>
>> Regards
>> Mohit
>>
More information about the jmh-dev
mailing list