--- jsr166/src/test/loops/StringMapLoops.java 2005/08/07 19:25:55 1.1 +++ jsr166/src/test/loops/StringMapLoops.java 2009/10/23 19:57:07 1.3 @@ -1,28 +1,18 @@ -/* - * @test - * @synopsis Exercise multithreaded maps, by default - * ConcurrentHashMap. Each thread does a random walk though elements - * of "key" array. On each iteration, it checks if table includes key. - * If absent, with probablility pinsert it inserts it, and if present, - * with probablility premove it removes it. (pinsert and premove are - * expressed as percentages to simplify parsing from command line.) - */ /* * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain. Use, modify, and - * redistribute this code in any way without acknowledgement. + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/licenses/publicdomain */ - import java.util.*; import java.util.concurrent.*; public class StringMapLoops { - static int nkeys = 1000; + static int nkeys = 75000; static int pinsert = 60; - static int premove = 2; + static int premove = 2; static int maxThreads = 100; - static int nops = 1000000; + static int nops = 8000000; static int removesPerMaxRandom; static int insertsPerMaxRandom; @@ -89,6 +79,11 @@ public class StringMapLoops { else i = k; } + for (int j = 0; j < 10; ++j) { + Thread.sleep(100); + test(1, nkeys, key, mapClass); + // shuffleKeys(key); + } pool.shutdown(); } @@ -130,6 +125,7 @@ public class StringMapLoops { // Uncomment to start with a non-empty table // for (int j = 0; j < nkeys; j += 4) // start 1/4 occupied // map.put(key[j], key[j]); + LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(i+1, timer); for (int t = 0; t < i; ++t)