nload average function files with high bitrates

Bug #106197 reported by Elie De Brauwer
Affects Status Importance Assigned to Milestone
nload (Ubuntu)
Daniel T Chen

Bug Description

Seen on Feisty, but also exists in Dapper:

edb@lapedb:/tmp/nload-0.6.0/src$ dpkg -l nload
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
ii nload 0.6.0-3 A realtime console network usage monitor

When you start nload the 'normal' way it will provide you with an average value. This value is calculated based on a window, the user can set the window using the -s flag followed by a value between 1 and 9 inclusive, when not passed 9 will be used. This smoothvalue * 45 is the number of values that will be stored. As soon as the bandwidth exceeds a certain value (problem doesn't occur with 60 mbit, but occurs with 90 mbit after approx three minutes) the calculated sum of transferred data will overflow the 32 bit digit which is stored withing it and you will need to restart nload to get a new reading. (or you should specify using the -s flag from the beginning).

The error lies in the file status.cpp in the function unsigned long Status::calcAverage(), I will provide a diff which solves this issue.

Tags: patch
Revision history for this message
Elie De Brauwer (elie) wrote :

Attached it status.cpp.diff which contains a fix for the calcAverage() function, busicly instead of enumerating all the items in the window, it simply starts accumulating numbers and it stops when either the entire window is calculated or when the sum would overflow.

Revision history for this message
Elie De Brauwer (elie) wrote :

Oh I almost forgot, I will also inform the original author.

Revision history for this message
Elie De Brauwer (elie) wrote :

Original author didn't seem to care (I got not reply), as well as nobody here seems to care either. Bug still exists in hardy.

Daniel T Chen (crimsun)
Changed in nload:
assignee: nobody → crimsun
importance: Undecided → Wishlist
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers