/* 1302 */ pshr = (Fraction)SynchronizationTimer.this.contention_.get();
/* */ }
/* 1304 */ while (!entry.isEnabled(nthreads, pshr));
/* */
/* 1306 */ SynchronizationTimer.BarrierTimer timer = new SynchronizationTimer.BarrierTimer();
/* 1307 */ CyclicBarrier barrier = new CyclicBarrier(nthreads + 1, timer);
/* */
/* 1309 */ Class cls = entry.cls;
/* 1310 */ Class chanCls = entry.buffCls;
/* */ try
/* */ {
/* 1313 */ SwingUtilities.invokeAndWait(new Runnable(cell) {
/* */ public void run() {
/* 1315 */ this.val$cell.setForeground(Color.blue);
/* 1316 */ this.val$cell.setText("RUN");
/* 1317 */ this.val$cell.repaint();
/* */ } } );
/* */ }
/* */ catch (InvocationTargetException ex) {
/* 1322 */ ex.printStackTrace();
/* 1323 */ System.exit(-1);
/* */ }
/* 1325 */ synchronized (RNG.constructionLock) {
/* 1326 */ RNG.reset(nthreads);
/* */
/* 1328 */ if (chanCls == null) {
/* 1329 */ RNG shared = (RNG)cls.newInstance();
/* 1330 */ for (int k = 0; k < nthreads; k++) {
/* 1331 */ RNG pri = (RNG)cls.newInstance();
/* 1332 */ TestLoop l = new TestLoop(shared, pri, pshr, iters, barrier);
/* 1333 */ Threads.pool.execute(l.testLoop());
/* */ }
/* */ }
/* */ else {
/* 1337 */ Channel shared = (Channel)chanCls.newInstance();
/* 1338 */ if (nthreads == 1) {
/* 1339 */ ChanRNG single = (ChanRNG)cls.newInstance();
/* 1340 */ single.setSingle(true);
/* 1341 */ PCTestLoop l = new PCTestLoop(single.getDelegate(), single, pshr,
/* 1342 */ iters, barrier,
/* 1343 */ shared, shared);
/* 1344 */ Threads.pool.execute(l.testLoop(true));
/* */ } else {
/* 1346 */ if (nthreads % 2 != 0) {
/* 1347 */ throw new Error("Must have even number of threads!");
/* */ }
/* 1349 */ int npairs = nthreads / 2;
/* */
/* 1351 */ for (int k = 0; k < npairs; k++) {
/* 1352 */ ChanRNG t = (ChanRNG)cls.newInstance();
/* 1353 */ t.setSingle(false);
/* 1354 */ Channel chan = (Channel)chanCls.newInstance();
/* */
/* 1356 */ PCTestLoop l = new PCTestLoop(t.getDelegate(), t, pshr,
/* 1357 */ iters, barrier,
/* 1358 */ shared, chan);
/* */
/* 1360 */ Threads.pool.execute(l.testLoop(false));
/* 1361 */ Threads.pool.execute(l.testLoop(true));
/* */ }
/* */ }
/* */
/* */ }
/* */
/* 1367 */ if (SynchronizationTimer.this.echoToSystemOut.get()) {
/* 1368 */ System.out.print(
/* 1369 */ entry.name + " " +
/* 1370 */ nthreads + "T " +
/* 1371 */ pshr + "S " +
/* 1372 */ RNG.computeLoops.get() + "I " +
/* 1373 */ RNG.syncMode.get() + "Lm " +
/* 1374 */ RNG.timeout.get() + "TO " +
/* 1375 */ RNG.producerMode.get() + "Pm " +
/* 1376 */ RNG.consumerMode.get() + "Cm " +
/* 1377 */ RNG.bias.get() + "B " +
/* 1378 */ DefaultChannelCapacity.get() + "C " +
/* 1379 */ RNG.exchangeParties.get() + "Xp " +
/* 1380 */ RNG.itersPerBarrier.get() + "Ib : ");
/* */ }
/* */
/* */ }
/* */
/* 1389 */ barrier.barrier();
/* */
/* 1391 */ barrier.barrier();
/* */
/* 1393 */ long tm = timer.getTime();
/* 1394 */ long totalIters = nthreads * iters;
/* 1395 */ double dns = tm * 1000.0D * 10.0D / totalIters;
/* 1396 */ long ns = Math.round(dns);