3 public class TestRunner extends Thread {
8 Node m_tree; // The root of a BST
10 public TestRunner(int index,
15 this.m_nodenum = nodenum;
16 this.m_tree = new Node();
20 // Randomly generate new (key, value) pair and insert into the tree
21 // If have collision, simply throw away the old node
22 // The tree can hold m_size nodes at most, if it has reached the
23 // limitation of m_size, then replace the node whose key is the
24 // closest to the new key.
25 Random rand = new Random(m_index);
26 while(this.m_nodenum-- > 0) {
27 // Generate a new (key, value) pair
28 int key = Math.abs(rand.nextInt());
29 int value = Math.abs(rand.nextInt());
30 if(this.m_tree.insert(key, value, !(this.m_size > 0))) {
37 public static void main(String[] args) {
38 int threadnum = THREADNUM; // 56;
40 int nodenum = size*10;
41 System.setgcprofileflag();
42 for(int i = 0; i < threadnum; ++i) {
43 TestRunner tr = new TestRunner(i, size, nodenum);