Changeset 2133


Ignore:
Timestamp:
Aug 21, 2012, 2:42:45 PM (6 years ago)
Author:
matthijs
Message:

luci: Correct traffic status bandwidth calculation.

The graphs showed twice the actual bandwidth, because the calculation
was wrong. The calculation became incorrect when the update interval was
changed in r19, but the calculation (which implicitly used the interval)
was not updated to follow this.

This commit updates the calculation and makes the interval explicit in
the calculation, to prevent this problem from ocurring again.

Closes: #544

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/luci/modules/admin-fon/luasrc/view/fon_status/main.htm

    r2132 r2133  
    2828<script type="text/javascript">
    2929        function initTrafGraphs() {
     30                var interval = 4; /* Seconds */
    3031                var rpc = new GraphRPC(
    3132                        document.getElementById('traf_graphs'),
    3233                        '<%=luci.dispatcher.build_url('fon_rpc', 'livestats')%>', 'traffic',
    33                         4000,
     34                        interval * 1000, /* ms */
    3435
    3536                        // Data sources
     
    5455                        // transform function
    5556                        function (cur, last) {
    56                                 return (cur - last) / 2048;
     57                                /* (cur - last) are bytes / interval.
     58                                   Translate that to kBytes / second */
     59                                return (cur - last) / 1024 / interval;
    5760                        },
    5861                        'traf_graphs'
Note: See TracChangeset for help on using the changeset viewer.