return [ // ... 'components' => [ 'log' => [ 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], 'logFile' => '@runtime/logs/app.log', ], ], ], 'trace' => [ 'class' => 'yii\debug\TraceMiddleware', 'enabled' => YII_DEBUG, ], ], // ... ];
public function actionView($id) { Yii::beginProfile('view'); $model = $this->findModel($id); Yii::beginProfile('render'); return $this->render('view', [ 'model' => $model, ]); Yii::endProfile('render'); Yii::endProfile('view'); }This code uses Yii's profiling API to measure the execution time of the `findModel` and `render` methods. The results will be displayed in the trace panel of Yii's debugger. Overall, Yii trace is a part of the Yii framework's debugging tools and is included in the yii-debug package.