You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8KB

  1. <?php
  2. /* @var $panel yii\debug\panels\ProfilingPanel */
  3. /* @var $searchModel yii\debug\models\search\Profile */
  4. /* @var $dataProvider yii\data\ArrayDataProvider */
  5. /* @var $time integer */
  6. /* @var $memory integer */
  7. use yii\grid\GridView;
  8. use yii\helpers\Html;
  9. ?>
  10. <h1>Performance Profiling</h1>
  11. <p>Total processing time: <b><?= $time ?></b>; Peak memory: <b><?= $memory ?></b>.</p>
  12. <?php
  13. echo GridView::widget([
  14. 'dataProvider' => $dataProvider,
  15. 'id' => 'profile-panel-detailed-grid',
  16. 'options' => ['class' => 'detail-grid-view table-responsive'],
  17. 'filterModel' => $searchModel,
  18. 'filterUrl' => $panel->getUrl(),
  19. 'columns' => [
  20. ['class' => 'yii\grid\SerialColumn'],
  21. [
  22. 'attribute' => 'seq',
  23. 'label' => 'Time',
  24. 'value' => function ($data) {
  25. $timeInSeconds = $data['timestamp'] / 1000;
  26. $millisecondsDiff = (int) (($timeInSeconds - (int) $timeInSeconds) * 1000);
  27. return date('H:i:s.', $timeInSeconds) . sprintf('%03d', $millisecondsDiff);
  28. },
  29. 'headerOptions' => [
  30. 'class' => 'sort-numerical'
  31. ]
  32. ],
  33. [
  34. 'attribute' => 'duration',
  35. 'value' => function ($data) {
  36. return sprintf('%.1f ms', $data['duration']);
  37. },
  38. 'options' => [
  39. 'width' => '10%',
  40. ],
  41. 'headerOptions' => [
  42. 'class' => 'sort-numerical'
  43. ]
  44. ],
  45. 'category',
  46. [
  47. 'attribute' => 'info',
  48. 'value' => function ($data) {
  49. return str_repeat('<span class="indent">→</span>', $data['level']) . Html::encode($data['info']);
  50. },
  51. 'format' => 'html',
  52. 'options' => [
  53. 'width' => '60%',
  54. ],
  55. ],
  56. ],
  57. ]);