# HG changeset patch # User vromero # Date 1359315524 0 # Node ID cbcd9b48475986da3f7eb581d79605246e901897 # Parent 09f65aad475903e2f418ca25c68ad4cc244f7e88 8006944: javac, combo tests should print out the number of threads used Reviewed-by: mcimadamore diff -r 09f65aad4759 -r cbcd9b484759 test/tools/javac/lib/JavacTestingAbstractThreadedTest.java --- a/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java Wed Jan 23 20:11:07 2013 -0800 +++ b/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java Sun Jan 27 19:38:44 2013 +0000 @@ -41,14 +41,20 @@ * * 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. + * + * This code will have to be revisited if jprt starts using concurrency for + * for running jtreg tests. */ public abstract class JavacTestingAbstractThreadedTest { + protected static AtomicInteger numberOfThreads = new AtomicInteger(); + protected static int getThreadPoolSize() { Integer testConc = Integer.getInteger("test.concurrency"); if (testConc != null) return testConc; 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 { @@ -82,11 +88,18 @@ } else if (printCheckCount) { 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(); if (printAll) { System.out.println(errSWriter.toString()); System.out.println(outSWriter.toString()); } + System.out.println("Total number of threads in thread pool: " + + numberOfThreads.get()); } protected static void closePrinters() {