Class ThreadParams
- java.lang.Object
-
- org.openjdk.jmh.infra.ThreadParams
-
public final class ThreadParams extends Object
Thread parameters.Thread parameters handle the infrastructure info about the threading, including but not limited to the number of threads, thread indicies, group information, etc. Some of that info duplicates what is available in
BenchmarkParams
.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
groupCount
protected int
groupIdx
protected int
groupThreadCount
protected int
groupThreadIdx
protected int
subgroupCount
protected int
subgroupIdx
protected int
subgroupThreadCount
protected int
subgroupThreadIdx
protected int
threadCount
protected int
threadIdx
-
Constructor Summary
Constructors Constructor Description ThreadParams(int threadIdx, int threadCount, int groupIdx, int groupCount, int subgroupIdx, int subgroupCount, int groupThreadIdx, int groupThreadCount, int subgroupThreadIdx, int subgroupThreadCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getGroupCount()
Answers the number of groups in the run.int
getGroupIndex()
Answers the thread group index.int
getGroupThreadCount()
Answers the number of threads in the current group.int
getGroupThreadIndex()
Answers the thread sub-index in current group.int
getSubgroupCount()
Answers the number of distinct workloads (subgroups) in the current group.int
getSubgroupIndex()
Answers the subgroup index.int
getSubgroupThreadCount()
Answers the number of threads in the current subgroup.int
getSubgroupThreadIndex()
Answers the thread sub-index in current subgroup.int
getThreadCount()
Answers the number of threads participating in the run.int
getThreadIndex()
Answers the thread index.
-
-
-
Field Detail
-
threadIdx
protected final int threadIdx
-
threadCount
protected final int threadCount
-
groupIdx
protected final int groupIdx
-
groupCount
protected final int groupCount
-
subgroupIdx
protected final int subgroupIdx
-
subgroupCount
protected final int subgroupCount
-
groupThreadIdx
protected final int groupThreadIdx
-
groupThreadCount
protected final int groupThreadCount
-
subgroupThreadIdx
protected final int subgroupThreadIdx
-
subgroupThreadCount
protected final int subgroupThreadCount
-
-
Method Detail
-
getGroupCount
public int getGroupCount()
Answers the number of groups in the run.When running the symmetric benchmark, each thread occupies its own group, and therefore number of groups equals the thread count.
This is a convenience method, similar info can be figured out by dividing the number of threads (
getThreadCount()
) by the number of threads per group (getGroupThreadCount()
).- Returns:
- number of groups
- See Also:
getThreadCount()
-
getGroupIndex
public int getGroupIndex()
Answers the thread group index.Group indices are having the range of [0..G-1], where G is the number of thread groups in the run. When running the symmetric benchmark, each thread occupies its own group, and therefore the group index equals to the thread index.
- Returns:
- thread group index
- See Also:
getGroupCount()
-
getSubgroupCount
public int getSubgroupCount()
Answers the number of distinct workloads (subgroups) in the current group.When running the symmetric benchmark, each thread occupies its own group, and therefore number of subgroups equals to one.
- Returns:
- number of subgroups
- See Also:
getThreadCount()
-
getSubgroupIndex
public int getSubgroupIndex()
Answers the subgroup index.Subgroup index enumerates the distinct workloads (subgroups) in current group. The index the range of [0..S-1], where S is the number of subgroups in current group. When running the symmetric benchmark, there is only a single workload in the group, and therefore the subgroup index is zero.
- Returns:
- subgroup index
- See Also:
getSubgroupCount()
-
getThreadCount
public int getThreadCount()
Answers the number of threads participating in the run.This is a convenience method, similar info can be queried directly from
BenchmarkParamsL2.getThreads()
- Returns:
- number of threads
-
getThreadIndex
public int getThreadIndex()
Answers the thread index.Thread indices are in range [0..N-1], where N is the number of threads participating in the run.
- Returns:
- thread index
- See Also:
getThreadCount()
-
getGroupThreadCount
public int getGroupThreadCount()
Answers the number of threads in the current group.When running the symmetric benchmark, each thread occupies its own group, and therefore number of subgroups equals to one.
This is a convenience method, similar info can be figured out by summing up the thread distribution from
BenchmarkParamsL2.getThreadGroups()
.- Returns:
- number of threads in the group
- See Also:
getThreadCount()
-
getGroupThreadIndex
public int getGroupThreadIndex()
Answers the thread sub-index in current group.Subgroup index enumerates the thread within a group, and takes the range of [0..T-1], where T is the number of threads in current group. When running the symmetric benchmark, each thread occupies its own group, and therefore the subgroup index is zero.
- Returns:
- index of thread in the group
- See Also:
getGroupThreadCount()
-
getSubgroupThreadCount
public int getSubgroupThreadCount()
Answers the number of threads in the current subgroup.When running the symmetric benchmark, each thread occupies its own group, each thread implicitly occupies a single subgroup, and therefore, the number of subgroups equals to one.
This is a convenience method, similar info can be figured out with querying
BenchmarkParamsL2.getThreadGroups()
withgetSubgroupIndex()
used as index.- Returns:
- number of threads in subgroup
- See Also:
getThreadCount()
-
getSubgroupThreadIndex
public int getSubgroupThreadIndex()
Answers the thread sub-index in current subgroup.Subgroup index enumerates the thread within a subgroup, and takes the range of [0..T-1], where T is the number of threads in current subgroup. When running the symmetric benchmark, each thread occupies its own group, and therefore the subgroup index is zero.
- Returns:
- index of thread in subgroup
- See Also:
getSubgroupThreadCount()
-
-