[Click] AverageCounter bug

Eddie Kohler kohler at cs.ucla.edu
Thu Jan 11 01:33:33 EST 2007


Seems to me like we'd generally like to divide by CLICK_HZ LAST at low 
rates (to avoid rates that are always multiples of CLICK_HZ), but divide 
by it FIRST at high rates (to avoid truncation).  I've applied the 
attached patch.  Thanks, guys, for your versions.

Eddie



Egi, Norbert wrote:
> Hi,
>  
> Have you recognized after you patched the averagecounter.cc that if you divide the number of arrived packets (/proc/click/ctr/count) by the rate (/proc/click/ctr/rate) then you get an integer number all the times, which I think it's not very realistic?  I think this is because of the line 'd /= CLICK_HZ;' you added to the code. As a consequence, this makes the counter quite inaccurate, especially at high pps rates.
>  
> I made a tiny modification to your patch (attached to this email), check it out, this isn't the perfect solution either, but more accurate. Actually its accuracy is +-(CLICK_HZ) which was at my machine 250, but I'm not sure from where it comes from and whether it is the same all the time.
>  
> Norbert


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: averagecounter.diff
Url: https://amsterdam.lcs.mit.edu/pipermail/click/attachments/20070111/58fae76b/averagecounter.diff


More information about the click mailing list