mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
8006944: javac, combo tests should print out the number of threads used
Reviewed-by: mcimadamore
This commit is contained in:
parent
6b27e06701
commit
b5148d30e2
1 changed files with 14 additions and 1 deletions
|
@ -41,14 +41,20 @@ import javax.tools.ToolProvider;
|
||||||
*
|
*
|
||||||
* If the property is not set the class will use a heuristic to determine the
|
* If the property is not set the class will use a heuristic to determine the
|
||||||
* maximum number of threads that can be fired to execute a given test.
|
* maximum number of threads that can be fired to execute a given test.
|
||||||
|
*
|
||||||
|
* This code will have to be revisited if jprt starts using concurrency for
|
||||||
|
* for running jtreg tests.
|
||||||
*/
|
*/
|
||||||
public abstract class JavacTestingAbstractThreadedTest {
|
public abstract class JavacTestingAbstractThreadedTest {
|
||||||
|
|
||||||
|
protected static AtomicInteger numberOfThreads = new AtomicInteger();
|
||||||
|
|
||||||
protected static int getThreadPoolSize() {
|
protected static int getThreadPoolSize() {
|
||||||
Integer testConc = Integer.getInteger("test.concurrency");
|
Integer testConc = Integer.getInteger("test.concurrency");
|
||||||
if (testConc != null) return testConc;
|
if (testConc != null) return testConc;
|
||||||
int cores = Runtime.getRuntime().availableProcessors();
|
int cores = Runtime.getRuntime().availableProcessors();
|
||||||
return Math.max(2, Math.min(8, cores / 2));
|
numberOfThreads.set(Math.max(2, Math.min(8, cores / 2)));
|
||||||
|
return numberOfThreads.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void checkAfterExec() throws InterruptedException {
|
protected static void checkAfterExec() throws InterruptedException {
|
||||||
|
@ -82,11 +88,18 @@ public abstract class JavacTestingAbstractThreadedTest {
|
||||||
} else if (printCheckCount) {
|
} else if (printCheckCount) {
|
||||||
outWriter.println("Total check executed: " + checkCount.get());
|
outWriter.println("Total check executed: " + checkCount.get());
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* This output is for supporting debugging. It does not mean that a given
|
||||||
|
* test had executed that number of threads concurrently. The value printed
|
||||||
|
* here is the maximum possible amount.
|
||||||
|
*/
|
||||||
closePrinters();
|
closePrinters();
|
||||||
if (printAll) {
|
if (printAll) {
|
||||||
System.out.println(errSWriter.toString());
|
System.out.println(errSWriter.toString());
|
||||||
System.out.println(outSWriter.toString());
|
System.out.println(outSWriter.toString());
|
||||||
}
|
}
|
||||||
|
System.out.println("Total number of threads in thread pool: " +
|
||||||
|
numberOfThreads.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void closePrinters() {
|
protected static void closePrinters() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue