<?php
include 'inc/head.php';
$sys->head('Данные о нагрузке на сервер');

$day_st=mktime(0, 0, 0, date('n', $time), date('j', $time));
$day_fn=mktime(0, 0, 0, date('n', $time), date('j', $time)+1);
$month_st=mktime(0, 0, 0, date('n', $time),0);
$avg_speed_all=round(mysql_result(mysql_query("SELECT AVG(`speed`) FROM `guard_janitor`"),0),2);
$avg_steps_all=mysql_num_rows(mysql_query("SELECT `id` FROM `guard_janitor`"));
$avg_speed_m=round(mysql_result(mysql_query("SELECT AVG(`speed`) FROM `guard_janitor` WHERE `time` >= '$month_st'"),0),2);
$avg_steps_m=mysql_num_rows(mysql_query("SELECT `id` FROM `guard_janitor` WHERE `time` >= '$month_st'"));
$avg_speed_d=round(mysql_result(mysql_query("SELECT AVG(`speed`) FROM `guard_janitor` WHERE `time` >= '$day_st' AND `time` < '$day_fn'"),0),2);
$avg_steps_d=mysql_num_rows(mysql_query("SELECT `id` FROM `guard_janitor` WHERE `time` >= '$day_st' AND `time` < '$day_fn'"));
$avg_speed_h=round(mysql_result(mysql_query("SELECT AVG(`speed`) FROM `guard_janitor` WHERE `time` > '".($time-3600)."'"),0),2);
$avg_steps_h=mysql_num_rows(mysql_query("SELECT `id` FROM `guard_janitor` WHERE `time` > '".($time-3600)."'"));
$hstep=$sql->mass('guard_janitor','`time` >= '.mktime(null,0,0),'`time` ASC');
$dstep=$sql->mass('guard_janitor','`time` >= '.mktime(0,0,0,0),'`time` ASC');
$mstep=$sql->mass('guard_janitor','`time` >= '.mktime(0,0,0),'`time` ASC');
$astep=$sql->mass('guard_janitor',null,'`time` ASC');

echo '
<div class="menu_razd">Статистика за последний час</div>
'.$sys->icon('speed').' Скорость сервера (AVG): '.$sys->assess($avg_speed_h,0.5,0.15,0.08,0,' сек').'<br />
'.$sys->icon('steps').' Переходов: '.$avg_steps_h.'<br />
'.$sys->icon('freq').' Частота: '.round(($avg_steps_h/($time-$hstep['time'])),3).' перех/сек

<div class="menu_razd">Статистика за '.date('d.m.Y').'</div>
'.$sys->icon('speed').' Скорость сервера (AVG): '.$sys->assess($avg_speed_d,0.5,0.15,0.08,0,' сек').'<br />
'.$sys->icon('steps').' Переходов: '.$avg_steps_d.'<br />
'.$sys->icon('freq').' Частота: '.round(($avg_steps_h/($time-$dstep['time'])),3).' перех/сек

<div class="menu_razd">Статистика за '.$sys->month(date('n')).' '.date('Y').'</div>
'.$sys->icon('speed').' Скорость сервера (AVG): '.$sys->assess($avg_speed_m,0.5,0.15,0.08,0,' сек').'<br />
'.$sys->icon('steps').' Переходов: '.$avg_steps_m.'<br />
'.$sys->icon('freq').' Частота: '.round(($avg_steps_m/($time-$mstep['time'])),3).' перех/сек

<div class="menu_razd">Всего</div>
'.$sys->icon('speed').' Скорость сервера (AVG): '.$sys->assess($avg_speed_all,0.5,0.15,0.08,0,' сек').'<br />
'.$sys->icon('steps').' Переходов: '.$avg_steps_all.'<br />
'.$sys->icon('freq').' Частота: '.round(($avg_steps_all/($time-$astep['time'])),3).' перех/сек';

include 'inc/foot.php';
?>