Sun, 27 Jan 2013 19:38:44 +0000
8006944: javac, combo tests should print out the number of threads used
Reviewed-by: mcimadamore
test/tools/javac/lib/JavacTestingAbstractThreadedTest.java | file | annotate | diff | comparison | revisions |
1.1 --- a/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java Wed Jan 23 20:11:07 2013 -0800 1.2 +++ b/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java Sun Jan 27 19:38:44 2013 +0000 1.3 @@ -41,14 +41,20 @@ 1.4 * 1.5 * If the property is not set the class will use a heuristic to determine the 1.6 * maximum number of threads that can be fired to execute a given test. 1.7 + * 1.8 + * This code will have to be revisited if jprt starts using concurrency for 1.9 + * for running jtreg tests. 1.10 */ 1.11 public abstract class JavacTestingAbstractThreadedTest { 1.12 1.13 + protected static AtomicInteger numberOfThreads = new AtomicInteger(); 1.14 + 1.15 protected static int getThreadPoolSize() { 1.16 Integer testConc = Integer.getInteger("test.concurrency"); 1.17 if (testConc != null) return testConc; 1.18 int cores = Runtime.getRuntime().availableProcessors(); 1.19 - return Math.max(2, Math.min(8, cores / 2)); 1.20 + numberOfThreads.set(Math.max(2, Math.min(8, cores / 2))); 1.21 + return numberOfThreads.get(); 1.22 } 1.23 1.24 protected static void checkAfterExec() throws InterruptedException { 1.25 @@ -82,11 +88,18 @@ 1.26 } else if (printCheckCount) { 1.27 outWriter.println("Total check executed: " + checkCount.get()); 1.28 } 1.29 + /* 1.30 + * This output is for supporting debugging. It does not mean that a given 1.31 + * test had executed that number of threads concurrently. The value printed 1.32 + * here is the maximum possible amount. 1.33 + */ 1.34 closePrinters(); 1.35 if (printAll) { 1.36 System.out.println(errSWriter.toString()); 1.37 System.out.println(outSWriter.toString()); 1.38 } 1.39 + System.out.println("Total number of threads in thread pool: " + 1.40 + numberOfThreads.get()); 1.41 } 1.42 1.43 protected static void closePrinters() {