20 |
|
|
21 |
|
public static void main(String[] args) throws Exception { |
22 |
|
|
23 |
< |
Class mapClass = null; |
23 |
> |
Class<?> mapClass = null; |
24 |
|
if (args.length > 0) { |
25 |
|
try { |
26 |
|
mapClass = Class.forName(args[0]); |
60 |
|
|
61 |
|
String[] key = makeKeys(nkeys); |
62 |
|
|
63 |
– |
int k = 1; |
63 |
|
int warmups = 2; |
64 |
< |
for (int i = 1; i <= maxThreads;) { |
64 |
> |
for (int k = 1, i = 1; i <= maxThreads;) { |
65 |
|
Thread.sleep(100); |
66 |
|
test(i, nkeys, key, mapClass); |
67 |
|
shuffleKeys(key); |
118 |
|
} |
119 |
|
} |
120 |
|
|
121 |
< |
static void test(int i, int nkeys, String[] key, Class mapClass) throws Exception { |
121 |
> |
static void test(int i, int nkeys, String[] key, Class<?> mapClass) throws Exception { |
122 |
|
System.out.print("Threads: " + i + "\t:"); |
123 |
|
Map<String, String> map = (Map<String,String>)mapClass.newInstance(); |
124 |
|
// Uncomment to start with a non-empty table |
157 |
|
} |
158 |
|
|
159 |
|
int step() { |
160 |
< |
// random-walk around key positions, bunching accesses |
160 |
> |
// random-walk around key positions, bunching accesses |
161 |
|
int r = rng.next(); |
162 |
|
position += (r & 7) - 3; |
163 |
|
while (position >= key.length) position -= key.length; |