On Fri, Jun 10, 2011 at 08:41:26PM -0500, Adam Majer wrote: > Package: nload > Version: 0.7.2-1 > Followup-For: Bug #586943 > > Any feedback on this? I'll upload this fix as a NMU in the next few > days unless there is some objection. nload hasn't really worked for me > without this fix.
Ok, I've uploaded a 7-day delayed NMU. The complete patch follows. I couldn't push the patch to git as it appears to be a private git repository. - Adam commit 98fe413bd4d8cf8021a22a8c4dd133dbde903f39 Author: Adam Majer <[email protected]> Date: Mon Jun 13 21:03:11 2011 -0500 NMU to fix wrong output. Statistics::getUnitFactor and Statistics::getUnitString were not consistent and difficult to understand. The readout displayed incorrect values like 0.9kBps while the actual rate was 0.9MBps. The new function will switch to next-higher rate value when rate exceeds 512.0 units/s. src/statistics.cpp | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) From http://bugs.debian.org/586943 Outgoing traffic is correct. Incoming traffic is incorrect. Incoming shows correctly @ 1.5MBps, but when bitrate drops to 800kbps, it gets reported at 0.8. Anyway, below incoming average should be about 800kbps - 1Mbps. I haven't seen this problem before, maybe it is kernel related. Currently running 2.6.34-1-amd64 Device br0 [192.168.53.2] (1/7): ======================================================= Incoming: Curr: 0.46 kBit/s Avg: 0.52 kBit/s Min: 0.00 Bit/s .... Max: 1.50 MBit/s . . ..|#####. Ttl: 1.44 GByte Outgoing: Curr: 20.82 kBit/s Avg: 19.93 kBit/s Min: 0.00 Bit/s Max: 43.30 kBit/s Ttl: 106.46 MByt diff --git a/debian/changelog b/debian/changelog index 9fd9de1..670bc19 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nload (0.7.2-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix wrong output under certain circumstances (closes: #586943) + + -- Adam Majer <[email protected]> Mon, 13 Jun 2011 21:01:00 -0500 + nload (0.7.2-1) unstable; urgency=low * [8119e24] Imported Upstream version 0.7.2 (Closes: #490384) diff --git a/debian/patches/03_fix_wrong_output.patch b/debian/patches/03_fix_wrong_output.patch new file mode 100644 index 0000000..ce110ec --- /dev/null +++ b/debian/patches/03_fix_wrong_output.patch @@ -0,0 +1,50 @@ +Index: nload/src/statistics.cpp +=================================================================== +--- nload.orig/src/statistics.cpp 2011-06-13 21:00:39.744677518 -0500 ++++ nload/src/statistics.cpp 2011-06-13 21:00:44.116677515 -0500 +@@ -81,13 +81,12 @@ + { + case humanReadableBit: + case humanReadableByte: +- factor *= 1024 * 1024 * 1024; +- for(int i = 3; i >= 0; --i) ++ for(int i = 0; i < 3; i++) + { +- if(value * (unit % 2 == 0 ? 8 : 1) >= factor) ++ if(value / factor < 512.0) + return factor; + +- factor /= 1024; ++ factor *= 1024.0; + } + return factor; + case bit: +@@ -114,14 +113,20 @@ + switch(unit) + { + case humanReadableBit: +- case humanReadableByte: +- if(value >= 1024 * 1024 * 1024 / (unit % 2 == 0 ? 8 : 1)) +- return 'G' + description; +- if(value >= 1024 * 1024 / (unit % 2 == 0 ? 8 : 1)) +- return 'M' + description; +- if(value >= 1024 / (unit % 2 == 0 ? 8 : 1)) +- return 'k' + description; +- return description; ++ case humanReadableByte: ++ { ++ const string units[4] = { "", "k", "M", "G" }; ++ ++ value *= (unit % 2 == 0 ? 8 : 1); ++ for(int i=0; i<4; i++){ ++ if(value < 512) ++ return units[i] + description; ++ ++ value /= 1024; ++ } ++ ++ return units[3] + description; // return 'G'units/s ++ } + case bit: + case byte: + return description; diff --git a/debian/patches/series b/debian/patches/series index eb40451..7561ea2 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ 01_remove_strip_from_makefile.patch 02_fix_hyphen-used-as-minus-sign.patch +03_fix_wrong_output.patch -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

