8281274: deal with ActiveProcessorCount in os::Linux::print_container_info
Reviewed-by: stuefe, sgehwolf, dholmes, iklam
This commit is contained in:
parent
69e390a0e8
commit
bb2e10ccea
@ -2174,7 +2174,11 @@ bool os::Linux::print_container_info(outputStream* st) {
|
||||
int i = OSContainer::active_processor_count();
|
||||
st->print("active_processor_count: ");
|
||||
if (i > 0) {
|
||||
st->print_cr("%d", i);
|
||||
if (ActiveProcessorCount > 0) {
|
||||
st->print_cr("%d, but overridden by -XX:ActiveProcessorCount %d", i, ActiveProcessorCount);
|
||||
} else {
|
||||
st->print_cr("%d", i);
|
||||
}
|
||||
} else {
|
||||
st->print_cr("not supported");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,6 +56,7 @@ public class TestMisc {
|
||||
testMinusContainerSupport();
|
||||
testIsContainerized();
|
||||
testPrintContainerInfo();
|
||||
testPrintContainerInfoActiveProcessorCount();
|
||||
} finally {
|
||||
DockerTestUtils.removeDockerImage(imageName);
|
||||
}
|
||||
@ -92,6 +93,15 @@ public class TestMisc {
|
||||
checkContainerInfo(Common.run(opts));
|
||||
}
|
||||
|
||||
private static void testPrintContainerInfoActiveProcessorCount() throws Exception {
|
||||
Common.logNewTestCase("Test print_container_info()");
|
||||
|
||||
DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo").addJavaOpts("-XX:ActiveProcessorCount=2");
|
||||
Common.addWhiteBoxOpts(opts);
|
||||
|
||||
OutputAnalyzer out = Common.run(opts);
|
||||
out.shouldContain("but overridden by -XX:ActiveProcessorCount 2");
|
||||
}
|
||||
|
||||
private static void checkContainerInfo(OutputAnalyzer out) throws Exception {
|
||||
String[] expectedToContain = new String[] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user