You are here

function perfmon_run_form_submit in Performance monitor 7

Run all tests in batch.

File

./perfmon.pages.inc, line 153
@todo: Enter file description here. @todo: Add hook_help for all tests.

Code

function perfmon_run_form_submit($form, &$form_state) {
  module_load_include('inc', 'perfmon');
  $testlist = perfmon_get_testlist();

  // Use Batch to process the testlist.
  $batch = array(
    'operations' => array(),
    'title' => t('Performance test'),
    'progress_message' => t('Progress @current out of @total.'),
    'error_message' => t('An error occurred. Rerun the process or consult the logs.'),
    'finished' => '_perfmon_batch_finished',
  );
  $log = variable_get('perfmon_log', TRUE);
  foreach ($testlist as $test_name => $test) {

    // Each test is its own operation. There could be a case where a single
    // test needs to run itself a batch operation, perhaps @todo?
    $batch['operations'][] = array(
      '_perfmon_batch_op',
      array(
        $test_name,
        $test,
        $log,
      ),
    );
  }
  batch_set($batch);
}