You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2015/03/14 22:58:26 UTC
svn commit: r1666754 -
/lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/TestUtils.java
Author: andyetitmoves
Date: Sat Mar 14 21:58:26 2015
New Revision: 1666754
URL: http://svn.apache.org/r1666754
Log:
SOLR-6275: Remove nanoTime speed test
Modified:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/TestUtils.java
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/TestUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/TestUtils.java?rev=1666754&r1=1666753&r2=1666754&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/TestUtils.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/TestUtils.java Sat Mar 14 21:58:26 2015
@@ -18,23 +18,15 @@
package org.apache.solr.util;
import java.util.Arrays;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.StrUtils;
import org.junit.Assert;
-import org.junit.Test;
/**
*
@@ -162,43 +154,4 @@ public class TestUtils extends SolrTestC
assertEquals( num, NumberUtils.SortableStr2long(sortable, 0, sortable.length() ) );
assertEquals( Long.toString(num), NumberUtils.SortableStr2long(sortable) );
}
-
- @Test
- public void testNanoTimeSpeed()
- {
- final int maxNumThreads = 100;
- final int numIters = 1000;
- if (VERBOSE) log.info("testNanoTime: maxNumThreads = {}, numIters = {}", maxNumThreads, numIters);
-
- final ExecutorService workers = Executors.newCachedThreadPool(new DefaultSolrThreadFactory("nanoTimeTestThread"));
-
- for (int numThreads = 1; numThreads <= maxNumThreads; numThreads++) {
- List<Callable<Long>> tasks = new ArrayList<> ();
- for (int i = 0; i < numThreads; i ++) {
- tasks.add(new Callable<Long>() {
- @Override
- public Long call() {
- final long startTime = System.nanoTime();
- for (int i = 0; i < numIters; i++) {
- System.nanoTime();
- }
- return System.nanoTime() - startTime;
- }
- });
- }
-
- try {
- List<Future<Long>> results = workers.invokeAll(tasks);
- long totalTime = 0;
- for (Future<Long> res : results) {
- totalTime += res.get();
- }
- long timePerIter = totalTime / (numIters * numThreads);
- assertTrue("Time taken for System.nanoTime is too high", timePerIter < 10000);
- if (VERBOSE) log.info("numThreads = {}, time_per_call = {}ns", numThreads, timePerIter);
- } catch (InterruptedException | ExecutionException ignored) {}
- }
-
- ExecutorUtil.shutdownAndAwaitTermination(workers);
- }
}