WLAN can now be assigned to any LAN bridge. Changing VLAN/bridge settings no longer...
[tomato.git] / release / src / router / www / bwm-realtime.asp
blob4153980cd5a157aa322748cb2a4582c2b777c440
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>
37 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
38 <script type='text/javascript' src='bwm-common.js'></script>
40 <script type='text/javascript'>
41 // <% nvram("wan_ifname,lan_ifname,wl_ifname,wan_proto,wan_iface,web_svg,rstats_colors"); %>
43 var cprefix = 'bw_r';
44 var updateInt = 2;
45 var updateDiv = updateInt;
46 var updateMaxL = 300;
47 var updateReTotal = 1;
48 var prev = [];
49 var debugTime = 0;
50 var avgMode = 0;
51 var wdog = null;
52 var wdogWarn = null;
55 var ref = new TomatoRefresh('update.cgi', 'exec=netdev', 2);
57 ref.stop = function() {
58 this.timer.start(1000);
61 ref.refresh = function(text) {
62 var c, i, h, n, j, k;
64 watchdogReset();
66 ++updating;
67 try {
68 netdev = null;
69 eval(text);
71 n = (new Date()).getTime();
72 if (this.timeExpect) {
73 if (debugTime) E('dtime').innerHTML = (this.timeExpect - n) + ' ' + ((this.timeExpect + 2000) - n);
74 this.timeExpect += 2000;
75 this.refreshTime = MAX(this.timeExpect - n, 500);
77 else {
78 this.timeExpect = n + 2000;
81 for (i in netdev) {
82 c = netdev[i];
83 if ((p = prev[i]) != null) {
84 h = speed_history[i];
86 h.rx.splice(0, 1);
87 h.rx.push((c.rx < p.rx) ? (c.rx + (0xFFFFFFFF - p.rx)) : (c.rx - p.rx));
89 h.tx.splice(0, 1);
90 h.tx.push((c.tx < p.tx) ? (c.tx + (0xFFFFFFFF - p.tx)) : (c.tx - p.tx));
92 else if (!speed_history[i]) {
93 speed_history[i] = {};
94 h = speed_history[i];
95 h.rx = [];
96 h.tx = [];
97 for (j = 300; j > 0; --j) {
98 h.rx.push(0);
99 h.tx.push(0);
101 h.count = 0;
103 prev[i] = c;
105 loadData();
107 catch (ex) {
109 --updating;
112 function watchdog()
114 watchdogReset();
115 ref.stop();
116 wdogWarn.style.display = '';
119 function watchdogReset()
121 if (wdog) clearTimeout(wdog)
122 wdog = setTimeout(watchdog, 10000);
123 wdogWarn.style.display = 'none';
126 function init()
128 speed_history = [];
130 initCommon(2, 1, 1);
132 wdogWarn = E('warnwd');
133 watchdogReset();
135 ref.start();
137 </script>
139 </head>
140 <body onload='init()'>
141 <form>
142 <table id='container' cellspacing=0>
143 <tr><td colspan=2 id='header'>
144 <div class='title'>Tomato</div>
145 <div class='version'>Version <% version(); %></div>
146 </td></tr>
147 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
148 <td id='content'>
149 <div id='ident'><% ident(); %></div>
151 <!-- / / / -->
153 <div id='rstats'>
154 <div id='tab-area'></div>
156 <script type='text/javascript'>
157 if (nvram.web_svg != '0') {
158 // without a div, Opera 9 moves svgdoc several pixels outside of <embed> (?)
159 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>");
161 </script>
163 <div id='bwm-controls'>
164 <small>(10 minute window, 2 second interval)</small><br>
165 <br>
166 Avg:&nbsp;
167 <a href='javascript:switchAvg(1)' id='avg1'>Off</a>,
168 <a href='javascript:switchAvg(2)' id='avg2'>2x</a>,
169 <a href='javascript:switchAvg(4)' id='avg4'>4x</a>,
170 <a href='javascript:switchAvg(6)' id='avg6'>6x</a>,
171 <a href='javascript:switchAvg(8)' id='avg8'>8x</a><br>
172 Max:&nbsp;
173 <a href='javascript:switchScale(0)' id='scale0'>Uniform</a>,
174 <a href='javascript:switchScale(1)' id='scale1'>Per IF</a><br>
175 Display:&nbsp;
176 <a href='javascript:switchDraw(0)' id='draw0'>Solid</a>,
177 <a href='javascript:switchDraw(1)' id='draw1'>Line</a><br>
178 Color:&nbsp; <a href='javascript:switchColor()' id='drawcolor'>-</a><br>
179 <small><a href='javascript:switchColor(1)' id='drawrev'>[reverse]</a></small><br>
181 <br><br>
182 &nbsp; &raquo; <a href="admin-bwm.asp">Configure</a>
183 </div>
185 <br><br>
186 <table border=0 cellspacing=2 id='txt'>
187 <tr>
188 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='rx-name'>RX</b></td>
189 <td width='15%' align='right' valign='top'><span id='rx-current'></span></td>
190 <td width='8%' align='right' valign='top'><b>Avg</b></td>
191 <td width='15%' align='right' valign='top' id='rx-avg'></td>
192 <td width='8%' align='right' valign='top'><b>Peak</b></td>
193 <td width='15%' align='right' valign='top' id='rx-max'></td>
194 <td width='8%' align='right' valign='top'><b>Total</b></td>
195 <td width='14%' align='right' valign='top' id='rx-total'></td>
196 <td>&nbsp;</td>
197 </tr>
198 <tr>
199 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='tx-name'>TX</b></td>
200 <td width='15%' align='right' valign='top'><span id='tx-current'></span></td>
201 <td width='8%' align='right' valign='top'><b>Avg</b></td>
202 <td width='15%' align='right' valign='top' id='tx-avg'></td>
203 <td width='8%' align='right' valign='top'><b>Peak</b></td>
204 <td width='15%' align='right' valign='top' id='tx-max'></td>
205 <td width='8%' align='right' valign='top'><b>Total</b></td>
206 <td width='14%' align='right' valign='top' id='tx-total'></td>
207 <td>&nbsp;</td>
208 </tr>
209 </table>
210 </div>
211 <br>
212 <br>
214 <!-- / / / -->
216 </td></tr>
217 <tr><td id='footer' colspan=2>
218 <span id='warnwd' style='display:none'>Warning: 10 second timeout, restarting...&nbsp;</span>
219 <span id='dtime'></span>
220 <img src='spin.gif' id='refresh-spinner' onclick='javascript:debugTime=1'>
221 </td></tr>
222 </table>
223 </form>
224 </body>
225 </html>