BWM and static ARP optimizations
[tomato.git] / release / src / router / www / bwm-realtime.asp
bloba9a8dc336399eb7ab593a91ca87ef97e530f1834
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Bandwidth: Real-Time</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <style type='text/css'>
22 #txt {
23 width: 550px;
24 white-space: nowrap;
26 #bwm-controls {
27 text-align: right;
28 margin-right: 5px;
29 margin-top: 5px;
30 float: right;
31 visibility: hidden;
33 </style>
35 <script type='text/javascript' src='debug.js'></script>
36 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
37 <script type='text/javascript' src='bwm-common.js'></script>
39 <script type='text/javascript'>
40 // <% nvram("wan_ifname,lan_ifname,wl_ifname,wan_proto,wan_iface,web_svg,rstats_colors"); %>
42 var cprefix = 'bw_r';
43 var updateInt = 2;
44 var updateDiv = updateInt;
45 var updateMaxL = 300;
46 var updateReTotal = 1;
47 var prev = [];
48 var debugTime = 0;
49 var avgMode = 0;
50 var wdog = null;
51 var wdogWarn = null;
54 var ref = new TomatoRefresh('update.cgi', 'exec=netdev', 2);
56 ref.stop = function() {
57 this.timer.start(1000);
60 ref.refresh = function(text) {
61 var c, i, h, n, j, k;
63 watchdogReset();
65 ++updating;
66 try {
67 netdev = null;
68 eval(text);
70 n = (new Date()).getTime();
71 if (this.timeExpect) {
72 if (debugTime) E('dtime').innerHTML = (this.timeExpect - n) + ' ' + ((this.timeExpect + 2000) - n);
73 this.timeExpect += 2000;
74 this.refreshTime = MAX(this.timeExpect - n, 500);
76 else {
77 this.timeExpect = n + 2000;
80 for (i in netdev) {
81 c = netdev[i];
82 if ((p = prev[i]) != null) {
83 h = speed_history[i];
85 h.rx.splice(0, 1);
86 h.rx.push((c.rx < p.rx) ? (c.rx + (0xFFFFFFFF - p.rx)) : (c.rx - p.rx));
88 h.tx.splice(0, 1);
89 h.tx.push((c.tx < p.tx) ? (c.tx + (0xFFFFFFFF - p.tx)) : (c.tx - p.tx));
91 else if (!speed_history[i]) {
92 speed_history[i] = {};
93 h = speed_history[i];
94 h.rx = [];
95 h.tx = [];
96 for (j = 300; j > 0; --j) {
97 h.rx.push(0);
98 h.tx.push(0);
100 h.count = 0;
102 prev[i] = c;
104 loadData();
106 catch (ex) {
108 --updating;
111 function watchdog()
113 watchdogReset();
114 ref.stop();
115 wdogWarn.style.display = '';
118 function watchdogReset()
120 if (wdog) clearTimeout(wdog)
121 wdog = setTimeout(watchdog, 10000);
122 wdogWarn.style.display = 'none';
125 function init()
127 speed_history = [];
129 initCommon(2, 1, 1);
131 wdogWarn = E('warnwd');
132 watchdogReset();
134 ref.start();
136 </script>
138 </head>
139 <body onload='init()'>
140 <form id='_fom' method='post' action='tomato.cgi'>
141 <table id='container' cellspacing=0>
142 <tr><td colspan=2 id='header'>
143 <div class='title'>Tomato</div>
144 <div class='version'>Version <% version(); %></div>
145 </td></tr>
146 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
147 <td id='content'>
148 <div id='ident'><% ident(); %></div>
150 <!-- / / / -->
152 <div id='rstats'>
153 <div id='tab-area'></div>
155 <script type='text/javascript'>
156 if (nvram.web_svg != '0') {
157 // without a div, Opera 9 moves svgdoc several pixels outside of <embed> (?)
158 W("<div style='border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0;visibility:hidden;padding:0;margin:0' id='graph'><embed src='bwm-graph.svg?<% version(); %>' style='width:760px;height:300px;margin:0;padding:0' type='image/svg+xml' pluginspage='http://www.adobe.com/svg/viewer/install/'></embed></div>");
160 </script>
162 <div id='bwm-controls'>
163 <small>(10 minute window, 2 second interval)</small><br>
164 <br>
165 Avg:&nbsp;
166 <a href='javascript:switchAvg(1)' id='avg1'>Off</a>,
167 <a href='javascript:switchAvg(2)' id='avg2'>2x</a>,
168 <a href='javascript:switchAvg(4)' id='avg4'>4x</a>,
169 <a href='javascript:switchAvg(6)' id='avg6'>6x</a>,
170 <a href='javascript:switchAvg(8)' id='avg8'>8x</a><br>
171 Max:&nbsp;
172 <a href='javascript:switchScale(0)' id='scale0'>Uniform</a>,
173 <a href='javascript:switchScale(1)' id='scale1'>Per IF</a><br>
174 Display:&nbsp;
175 <a href='javascript:switchDraw(0)' id='draw0'>Solid</a>,
176 <a href='javascript:switchDraw(1)' id='draw1'>Line</a><br>
177 Color:&nbsp; <a href='javascript:switchColor()' id='drawcolor'>-</a><br>
178 <small><a href='javascript:switchColor(1)' id='drawrev'>[reverse]</a></small><br>
180 <br><br>
181 &nbsp; &raquo; <a href="admin-bwm.asp">Configure</a>
182 </div>
184 <br><br>
185 <table border=0 cellspacing=2 id='txt'>
186 <tr>
187 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='rx-name'>RX</b></td>
188 <td width='15%' align='right' valign='top'><span id='rx-current'></span></td>
189 <td width='8%' align='right' valign='top'><b>Avg</b></td>
190 <td width='15%' align='right' valign='top' id='rx-avg'></td>
191 <td width='8%' align='right' valign='top'><b>Peak</b></td>
192 <td width='15%' align='right' valign='top' id='rx-max'></td>
193 <td width='8%' align='right' valign='top'><b>Total</b></td>
194 <td width='14%' align='right' valign='top' id='rx-total'></td>
195 <td>&nbsp;</td>
196 </tr>
197 <tr>
198 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='tx-name'>TX</b></td>
199 <td width='15%' align='right' valign='top'><span id='tx-current'></span></td>
200 <td width='8%' align='right' valign='top'><b>Avg</b></td>
201 <td width='15%' align='right' valign='top' id='tx-avg'></td>
202 <td width='8%' align='right' valign='top'><b>Peak</b></td>
203 <td width='15%' align='right' valign='top' id='tx-max'></td>
204 <td width='8%' align='right' valign='top'><b>Total</b></td>
205 <td width='14%' align='right' valign='top' id='tx-total'></td>
206 <td>&nbsp;</td>
207 </tr>
208 </table>
209 </div>
210 <br>
211 <br>
213 <!-- / / / -->
215 </td></tr>
216 <tr><td id='footer' colspan=2>
217 <span id='warnwd' style='display:none'>Warning: 10 second session timeout, restarting...&nbsp;</span>
218 <span id='dtime'></span>
219 <img src='spin.gif' id='refresh-spinner' onclick='javascript:debugTime=1'>
220 </td></tr>
221 </table>
222 </form>
223 </body>
224 </html>