Class ThreadParams
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 inherited from class org.openjdk.jmh.infra.ThreadParamsL2
groupCount, groupIdx, groupThreadCount, groupThreadIdx, subgroupCount, subgroupIdx, subgroupThreadCount, subgroupThreadIdx, threadCount, threadIdx
-
Constructor Summary
ConstructorsConstructorDescriptionThreadParams
(int threadIdx, int threadCount, int groupIdx, int groupCount, int subgroupIdx, int subgroupCount, int groupThreadIdx, int groupThreadCount, int subgroupThreadIdx, int subgroupThreadCount) -
Method Summary
Modifier and TypeMethodDescriptionint
Answers the number of groups in the run.int
Answers the thread group index.int
Answers the number of threads in the current group.int
Answers the thread sub-index in current group.int
Answers the number of distinct workloads (subgroups) in the current group.int
Answers the subgroup index.int
Answers the number of threads in the current subgroup.int
Answers the thread sub-index in current subgroup.int
Answers the number of threads participating in the run.int
Answers the thread index.
-
Constructor Details
-
ThreadParams
public ThreadParams(int threadIdx, int threadCount, int groupIdx, int groupCount, int subgroupIdx, int subgroupCount, int groupThreadIdx, int groupThreadCount, int subgroupThreadIdx, int subgroupThreadCount)
-
-
Method Details
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-