- "sleep duration will appear in nondescending order.\n",
- iterations);
-
- /* Start all the threads. */
- product = 0;
- lock_init (&lock, "product");
- op = output = malloc (sizeof *output * iterations * thread_cnt * 2);
+ "sleep duration will appear in nondescending order.\n\n"
+ "Running test... ",
+ thread_cnt, iterations);
+
+ /* Allocate memory. */
+ threads = malloc (sizeof *threads * thread_cnt);
+ output = malloc (sizeof *output * iterations * thread_cnt * 2);
+ if (threads == NULL || output == NULL)
+ PANIC ("couldn't allocate memory for test");
+
+ /* Initialize test. */
+ test.start = timer_ticks () + 100;
+ test.iterations = iterations;
+ lock_init (&test.output_lock, "output");
+ test.output_pos = output;
+
+ /* Start threads. */