This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/includes/kohana/system/views/profiler/stats.php
2011-01-14 01:49:56 +11:00

74 lines
3.0 KiB
PHP
Executable File

<?php defined('SYSPATH') or die('No direct script access.') ?>
<style type="text/css">
<?php include Kohana::find_file('views', 'profiler/style', 'css') ?>
</style>
<?php
$group_stats = Profiler::group_stats();
$group_cols = array('min', 'max', 'average', 'total');
$application_cols = array('min', 'max', 'average', 'current');
?>
<div class="kohana">
<?php foreach (Profiler::groups() as $group => $benchmarks): ?>
<table class="profiler">
<tr class="group">
<th class="name" rowspan="2"><?php echo __(ucfirst($group)) ?></th>
<td class="time" colspan="4"><?php echo number_format($group_stats[$group]['total']['time'], 6) ?> <abbr title="seconds">s</abbr></td>
</tr>
<tr class="group">
<td class="memory" colspan="4"><?php echo number_format($group_stats[$group]['total']['memory'] / 1024, 4) ?> <abbr title="kilobyte">kB</abbr></td>
</tr>
<tr class="headers">
<th class="name"><?php echo __('Benchmark') ?></th>
<?php foreach ($group_cols as $key): ?>
<th class="<?php echo $key ?>"><?php echo __(ucfirst($key)) ?></th>
<?php endforeach ?>
</tr>
<?php foreach ($benchmarks as $name => $tokens): ?>
<tr class="mark time">
<?php $stats = Profiler::stats($tokens) ?>
<th class="name" rowspan="2" scope="rowgroup"><?php echo HTML::chars($name), ' (', count($tokens), ')' ?></th>
<?php foreach ($group_cols as $key): ?>
<td class="<?php echo $key ?>">
<div>
<div class="value"><?php echo number_format($stats[$key]['time'], 6) ?> <abbr title="seconds">s</abbr></div>
<?php if ($key === 'total'): ?>
<div class="graph" style="left: <?php echo max(0, 100 - $stats[$key]['time'] / $group_stats[$group]['max']['time'] * 100) ?>%"></div>
<?php endif ?>
</div>
</td>
<?php endforeach ?>
</tr>
<tr class="mark memory">
<?php foreach ($group_cols as $key): ?>
<td class="<?php echo $key ?>">
<div>
<div class="value"><?php echo number_format($stats[$key]['memory'] / 1024, 4) ?> <abbr title="kilobyte">kB</abbr></div>
<?php if ($key === 'total'): ?>
<div class="graph" style="left: <?php echo max(0, 100 - $stats[$key]['memory'] / $group_stats[$group]['max']['memory'] * 100) ?>%"></div>
<?php endif ?>
</div>
</td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</table>
<?php endforeach ?>
<table class="profiler">
<?php $stats = Profiler::application() ?>
<tr class="final mark time">
<th class="name" rowspan="2" scope="rowgroup"><?php echo __('Application Execution').' ('.$stats['count'].')' ?></th>
<?php foreach ($application_cols as $key): ?>
<td class="<?php echo $key ?>"><?php echo number_format($stats[$key]['time'], 6) ?> <abbr title="seconds">s</abbr></td>
<?php endforeach ?>
</tr>
<tr class="final mark memory">
<?php foreach ($application_cols as $key): ?>
<td class="<?php echo $key ?>"><?php echo number_format($stats[$key]['memory'] / 1024, 4) ?> <abbr title="kilobyte">kB</abbr></td>
<?php endforeach ?>
</tr>
</table>
</div>