stats.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <style type="text/css">
  2. <?php include KO7::find_file('views', 'profiler/style', 'css') ?>
  3. </style>
  4. <?php
  5. $group_stats = Profiler::group_stats();
  6. $group_cols = ['min', 'max', 'average', 'total'];
  7. $application_cols = ['min', 'max', 'average', 'current'];
  8. ?>
  9. <div class="ko7">
  10. <?php foreach (Profiler::groups() as $group => $benchmarks): ?>
  11. <table class="profiler">
  12. <tr class="group">
  13. <th class="name" rowspan="2"><?php echo I18n::get(ucfirst($group)) ?></th>
  14. <td class="time" colspan="4"><?php echo number_format($group_stats[$group]['total']['time'], 6) ?> <abbr title="seconds">s</abbr></td>
  15. </tr>
  16. <tr class="group">
  17. <td class="memory" colspan="4"><?php echo number_format($group_stats[$group]['total']['memory'] / 1024, 4) ?> <abbr title="kilobyte">kB</abbr></td>
  18. </tr>
  19. <tr class="headers">
  20. <th class="name"><?php echo I18n::get('Benchmark') ?></th>
  21. <?php foreach ($group_cols as $key): ?>
  22. <th class="<?php echo $key ?>"><?php echo I18n::get(ucfirst($key)) ?></th>
  23. <?php endforeach ?>
  24. </tr>
  25. <?php foreach ($benchmarks as $name => $tokens): ?>
  26. <tr class="mark time">
  27. <?php $stats = Profiler::stats($tokens) ?>
  28. <th class="name" rowspan="2" scope="rowgroup"><?php echo HTML::chars($name), ' (', count($tokens), ')' ?></th>
  29. <?php foreach ($group_cols as $key): ?>
  30. <td class="<?php echo $key ?>">
  31. <div>
  32. <div class="value"><?php echo number_format($stats[$key]['time'], 6) ?> <abbr title="seconds">s</abbr></div>
  33. <?php if ($key === 'total'): ?>
  34. <div class="graph" style="left: <?php echo $group_stats[$group]['max']['time'] ? max(0, 100 - $stats[$key]['time'] / $group_stats[$group]['max']['time'] * 100) : '0' ?>%"></div>
  35. <?php endif ?>
  36. </div>
  37. </td>
  38. <?php endforeach ?>
  39. </tr>
  40. <tr class="mark memory">
  41. <?php foreach ($group_cols as $key): ?>
  42. <td class="<?php echo $key ?>">
  43. <div>
  44. <div class="value"><?php echo number_format($stats[$key]['memory'] / 1024, 4) ?> <abbr title="kilobyte">kB</abbr></div>
  45. <?php if ($key === 'total'): ?>
  46. <div class="graph" style="left: <?php echo $group_stats[$group]['max']['memory'] ? max(0, 100 - $stats[$key]['memory'] / $group_stats[$group]['max']['memory'] * 100) : '0' ?>%"></div>
  47. <?php endif ?>
  48. </div>
  49. </td>
  50. <?php endforeach ?>
  51. </tr>
  52. <?php endforeach ?>
  53. </table>
  54. <?php endforeach ?>
  55. <table class="profiler">
  56. <?php $stats = Profiler::application() ?>
  57. <tr class="final mark time">
  58. <th class="name" rowspan="2" scope="rowgroup"><?php echo I18n::get('Application Execution').' ('.$stats['count'].')' ?></th>
  59. <?php foreach ($application_cols as $key): ?>
  60. <td class="<?php echo $key ?>"><?php echo number_format($stats[$key]['time'], 6) ?> <abbr title="seconds">s</abbr></td>
  61. <?php endforeach ?>
  62. </tr>
  63. <tr class="final mark memory">
  64. <?php foreach ($application_cols as $key): ?>
  65. <td class="<?php echo $key ?>"><?php echo number_format($stats[$key]['memory'] / 1024, 4) ?> <abbr title="kilobyte">kB</abbr></td>
  66. <?php endforeach ?>
  67. </tr>
  68. </table>
  69. </div>