Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change jvmtiGetAvailableProcessors to use J9PORT_CPU_TARGET #2255

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions runtime/j9vm/jvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5508,6 +5508,8 @@ JVM_ActiveProcessorCount(void)
* Runtime.availableProcessors() by specification returns a number greater or equal to 1.
* RTC 112959: [was 209402] Liberty JAX-RS Default Executor poor performance. Match reference implementation behaviour
* to return the bound CPUs rather than physical CPUs.
*
* This implementation should be kept consistent with jvmtiGetAvailableProcessors
*/
num = (jint)j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_TARGET);
if (num < 1) {
Expand Down
5 changes: 3 additions & 2 deletions runtime/jvmti/jvmtiTimers.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ jvmtiGetAvailableProcessors(jvmtiEnv* env,

ENSURE_NON_NULL(processor_count_ptr);

cpuCount = j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_ONLINE);
*processor_count_ptr = ((cpuCount == 0) ? 1 : (jint) cpuCount);
/* This implementation should be kept consistent with JVM_ActiveProcessorCount */
cpuCount = j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_TARGET);
*processor_count_ptr = ((cpuCount < 1) ? 1 : (jint) cpuCount);
rc = JVMTI_ERROR_NONE;

done:
Expand Down