/** * Runs all the benchmarks */ public function actionIndex() { $runner = new ABenchmarkRunner(); if ($this->id > 0) { $runner->benchmarks = array(ABenchmark::model()->findByPk($this->id)); echo "Benchmarking test for #{$this->id}, please wait...\n"; $runner->run(); } else { $runner->benchmarks = ABenchmark::model()->findAll(); echo "Benchmarking all tests, please wait...\n"; $runner->run(); } echo "Done\n"; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return ABenchmark the loaded model * @throws CHttpException if the model doesn't exist */ public function loadModel($id) { $model = ABenchmark::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }