pps) { $bigger_stat = $q->pps; } } } else { foreach ($statistics as $q) { if ($bigger_stat < $q->bandwidth) { $bigger_stat = $q->bandwidth; } } } $finscript = ""; foreach ($statistics as $q) { if ($stat_type == "0" && $bigger_stat != "0") { $packet_s = round(100 * ($q->pps / $bigger_stat), 0); } else if ($bigger_stat != "0") { $packet_s = round(100 * ($q->bandwidth / $bigger_stat), 0); } else { $packet_s = 0; } $finscript .= "$('#queue{$q->queuename}width').css('width','{$packet_s}%');"; $finscript .= "$('#queue{$q->queuename}pps').val('" . number_format($q->pps, 1) . "');"; $finscript .= "$('#queue{$q->queuename}bps').val('" . format_bits($q->bandwidth) . "');"; $finscript .= "$('#queue{$q->queuename}borrows').val('{$q->borrows}');"; $finscript .= "$('#queue{$q->queuename}suspends').val('{$q->suspends}');"; $finscript .= "$('#queue{$q->queuename}drops').val('{$q->drops}');"; $finscript .= "$('#queue{$q->queuename}length').val('{$q->queuelength}');"; } unset($statistics, $altqstats); header("Content-type: text/javascript"); echo $finscript; exit; } $pgtitle = array(gettext("Status"), gettext("Queues")); $shortcut_section = "trafficshaper"; include("head.inc"); if (!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < 1) { print_info_box(gettext("Traffic shaping is not configured.")); include("foot.inc"); exit; } if (!$error): ?>



$real_name) { if ($oif == $q['interface']) { $if_name = $real_name; break; } } if ($prev_if != $q['interface']) { echo "Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "\n"; $prev_if = $q['interface']; } ?> +/-"; } if (strstr($q['name'], "root_")) { echo "Root queue"; } else { echo "" . htmlspecialchars($q['name']) . ""; } ?> '); print('
'); print('
'); print('
'); print(''); print(''); print(''); print(''); print(''); print(''); print(''); ?> queuename = $xml['name'] . $xml['interface']; $current->queuelength = $xml['qlength']; $current->pps = $xml['measured']; $current->bandwidth = $xml['measuredspeedint']; $current->borrows = intval($xml['borrows']); $current->suspends = intval($xml['suspends']); $current->drops = intval($xml['droppedpkts']); if (is_array($xml['queue'])) { foreach ($xml['queue'] as $q) { $child = statsQueues($q); $current->pps += $child->pps; $current->bandwidth += $child->bandwidth; $current->borrows += $child->borrows; $current->suspends += $child->suspends; $current->drops += $child->drops; } } unset($child); $statistics[] = $current; return $current; } function format_bits($bits) { if ($bits >= 1000000000) { return sprintf("%.2f Gbps", $bits/1000000000); } else if ($bits >= 1000000) { return sprintf("%.2f Mbps", $bits/1000000); } else if ($bits >= 1000) { return sprintf("%.2f Kbps", $bits/1000); } else { return sprintf("%d bps", $bits); } } ?>