Removed the workqueue
[akaros.git] / kern / src / testing.c
index 8967c02..ff03780 100644 (file)
@@ -560,142 +560,6 @@ void test_lapic_status_bit(void)
 }
 #endif // __i386__
 
-/******************************************************************************/
-/*            Test Measurements: Couples with measurement.c                   */
-// All user processes can R/W the UGDATA page
-barrier_t*COUNT(1) bar = (barrier_t*COUNT(1))TC(UGDATA);
-uint32_t*COUNT(1) job_to_run = (uint32_t*COUNT(1))TC(UGDATA + sizeof(barrier_t));
-env_t* env_batch[64]; // Fairly arbitrary, just the max I plan to use.
-
-/* Helpers for test_run_measurements */
-static void wait_for_all_envs_to_die(void)
-{
-       while (atomic_read(&num_envs))
-               cpu_relax();
-}
-
-// this never returns.
-static void sync_tests(int start_core, int num_threads, int job_num)
-{
-       assert(start_core + num_threads <= num_cpus);
-       wait_for_all_envs_to_die();
-       for (int i = start_core; i < start_core + num_threads; i++)
-               env_batch[i] = kfs_proc_create(kfs_lookup_path("roslib_measurements"));
-       lcr3(env_batch[start_core]->env_cr3);
-       init_barrier(bar, num_threads);
-       *job_to_run = job_num;
-       for (int i = start_core; i < start_core + num_threads; i++)
-               smp_call_function_single(i, run_env_handler, env_batch[i], 0);
-       process_workqueue();
-       // we want to fake a run, to reenter manager for the next case
-       env_t *env = kfs_proc_create(kfs_lookup_path("roslib_null"));
-       smp_call_function_single(0, run_env_handler, env, 0);
-       // Note we are still holding references to all the processes
-       process_workqueue();
-       panic("whoops!\n");
-}
-
-static void async_tests(int start_core, int num_threads, int job_num)
-{
-       int count;
-
-       assert(start_core + num_threads <= num_cpus);
-       wait_for_all_envs_to_die();
-       for (int i = start_core; i < start_core + num_threads; i++)
-               env_batch[i] = kfs_proc_create(kfs_lookup_path("roslib_measurements"));
-       printk("async_tests: checkpoint 0\n");
-       lcr3(env_batch[start_core]->env_cr3);
-       init_barrier(bar, num_threads);
-       printk("async_tests: checkpoint 1\n");
-       *job_to_run = job_num;
-       for (int i = start_core; i < start_core + num_threads; i++)
-               smp_call_function_single(i, run_env_handler, env_batch[i], 0);
-       count = 0;
-       while (count > -num_threads) {
-               count = 0;
-               for (int i = start_core; i < start_core + num_threads; i++) {
-                       count += process_generic_syscalls(env_batch[i], 1);
-               }
-               cpu_relax();
-       }
-       // we want to fake a run, to reenter manager for the next case
-       env_t *env = kfs_proc_create(kfs_lookup_path("roslib_null"));
-       smp_call_function_single(0, run_env_handler, env, 0);
-       // Note we are still holding references to all the processes
-       process_workqueue();
-       // this all never returns
-       panic("whoops!\n");
-}
-
-void test_run_measurements(uint32_t job_num)
-{
-       switch (job_num) {
-               case 0: // Nulls
-                       printk("Case 0:\n");
-                       async_tests(2, 1, job_num);  // start core 2, 1 core total
-                       break;
-               case 1: // Sync
-                       printk("Case 1:\n");
-                       sync_tests(2, 1, job_num);
-                       break;
-               case 2:
-                       printk("Case 2:\n");
-                       sync_tests(2, 2, job_num);
-                       break;
-               case 3:
-                       printk("Case 3:\n");
-                       sync_tests(0, 3, job_num);
-                       break;
-               case 4:
-                       printk("Case 4:\n");
-                       sync_tests(0, 4, job_num);
-                       break;
-               case 5:
-                       printk("Case 5:\n");
-                       sync_tests(0, 5, job_num);
-                       break;
-               case 6:
-                       printk("Case 6:\n");
-                       sync_tests(0, 6, job_num);
-                       break;
-               case 7:
-                       printk("Case 7:\n");
-                       sync_tests(0, 7, job_num);
-                       break;
-               case 8:
-                       printk("Case 8:\n");
-                       sync_tests(0, 8, job_num);
-                       break;
-               case 9:
-                       printk("Case 9:\n");
-                       async_tests(2, 1, job_num);
-                       break;
-               case 10:
-                       printk("Case 10:\n");
-                       async_tests(2, 2, job_num);
-                       break;
-               case 11:
-                       printk("Case 11:\n");
-                       async_tests(2, 3, job_num);
-                       break;
-               case 12:
-                       printk("Case 12:\n");
-                       async_tests(2, 4, job_num);
-                       break;
-               case 13:
-                       printk("Case 13:\n");
-                       async_tests(2, 5, job_num);
-                       break;
-               case 14:
-                       printk("Case 14:\n");
-                       async_tests(2, 6, job_num);
-                       break;
-               default:
-                       warn("Invalid test number!!");
-       }
-       panic("Error in test setup!!");
-}
-
 /************************************************************/
 /* ISR Handler Functions */