Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix paralleltest-batch.sh, and add more output to ParallelTest.java

  • Loading branch information...
commit cdb3af10eb21d1681f877bb0239c38f95ad56c10 1 parent 2d0512a
@jafingerhut authored
Showing with 23 additions and 11 deletions.
  1. +20 −8 misc/ParallelTest.java
  2. +3 −3 misc/paralleltest-batch.sh
View
28 misc/ParallelTest.java
@@ -292,10 +292,14 @@ else if (s.equals("cachebuster1")) {
static void doTest(String taskFnSpecifier, int numThreads,
long jobSizePerThread) {
+ final int NWARMUPS = 2;
final int NTRIALS = 10;
- long[] runTime = new long[NTRIALS];
+ long[] runTime = new long[NWARMUPS + NTRIALS];
- for (int trial = 0; trial < NTRIALS; trial++) {
+ System.out.println("Task Specifier: " + taskFnSpecifier);
+ System.out.println("Number of Threads: " + numThreads);
+ System.out.println("Job size per thread: " + jobSizePerThread);
+ for (int trial = 0; trial < (NWARMUPS + NTRIALS); trial++) {
try {
Thread[] tarray = new Thread[numThreads];
for (int i = 0; i < numThreads; i++) {
@@ -314,10 +318,19 @@ static void doTest(String taskFnSpecifier, int numThreads,
long minTime = Long.MAX_VALUE;
long maxTime = 0;
long totalTime = 0;
- for (int trial = 1; trial < NTRIALS; trial++) { // Note: skip first one
- minTime = Math.min(minTime, runTime[trial]);
- maxTime = Math.max(maxTime, runTime[trial]);
- totalTime += runTime[trial];
+ long n = 0;
+ System.out.println("Elapsed times in msec of all trials (warmup not included in final stats below):");
+ for (int trial = 0; trial < (NWARMUPS + NTRIALS); trial++) {
+ System.out.format("Trial %2d: %.3f%s\n",
+ trial,
+ ((double) runTime[trial]) / 1000000.0,
+ (trial < NWARMUPS) ? " (warmup)" : "");
+ if (trial >= NWARMUPS) {
+ minTime = Math.min(minTime, runTime[trial]);
+ maxTime = Math.max(maxTime, runTime[trial]);
+ totalTime += runTime[trial];
+ ++n;
+ }
}
System.out.println();
@@ -326,7 +339,7 @@ static void doTest(String taskFnSpecifier, int numThreads,
System.out.format(" ELAPSED Times (msec): min=%.3f max=%.3f avg=%.3f\n",
((double) minTime) / 1000000.0,
((double) maxTime) / 1000000.0,
- (((double) totalTime) / (NTRIALS-1)) / 1000000.0);
+ (((double) totalTime) / n) / 1000000.0);
}
static long defaultJobSize = 1000000000L;
@@ -394,7 +407,6 @@ public static void main(String[] args) {
if (jobSizePerThread == 0) {
jobSizePerThread = 1;
}
- System.out.println("Number of Threads: " + numThreads);
doTest(taskFnSpecifier, numThreads, jobSizePerThread);
System.exit(0);
}
View
6 misc/paralleltest-batch.sh
@@ -18,7 +18,7 @@ JVM_OPTS="-server -Xmx1024m"
for TYPE in newdoubleC
do
- for THREADS in 1 2
+ for THREADS in 1 2 4 8
do
JOB_SIZE=1000000000
echo
@@ -29,8 +29,8 @@ do
HPROF_OUT=output/ParallelTest-${TYPE}-${THREADS}-hprof.txt
uname -a > $OUT
"${JAVA}" -version >> $OUT
- echo "( $TIME ${JAVA} $JVM_OPTS $JAVA_PROFILING_OPTS -classpath ${JAVA_OBJ_DIR} ParallelTest $TYPE $THREADS $JOB_SIZE ) 2>&1 | tee -a $OUT"
- ( $TIME "${JAVA}" $JVM_OPTS $JAVA_PROFILING_OPTS -classpath "${JAVA_OBJ_DIR}" ParallelTest $TYPE $THREADS $JOB_SIZE) 2>&1 | tee -a $OUT
+ echo "( $TIME ${JAVA} $JVM_OPTS $JAVA_PROFILING_OPTS -classpath ${JAVA_OBJ_DIR} ParallelTest $TYPE $JOB_SIZE $THREADS ) 2>&1 | tee -a $OUT"
+ ( $TIME "${JAVA}" $JVM_OPTS $JAVA_PROFILING_OPTS -classpath "${JAVA_OBJ_DIR}" ParallelTest $TYPE $JOB_SIZE $THREADS ) 2>&1 | tee -a $OUT
/bin/mv -f java.hprof.txt $HPROF_OUT
done
done
Please sign in to comment.
Something went wrong with that request. Please try again.