Ranjit Manomohan wrote:
> Currently the HTB rate for a class is update very slowly (once
> every 16 seconds). This patch updates the rate whenever the stats
> are requested from user space. This enables more accurate rate
> monitoring.
> 
> +/* Update packet/byte rate for a class. */
> +static void calc_rate(struct htb_class *cl)
> +{
> +    unsigned long now = jiffies;
> +    if (time_after(now, (cl->rate_est_when + HZ))) {
> +    unsigned int elapsed_secs =
> +            (now - cl->rate_est_when)/HZ;
> +        cl->sum_bytes /= elapsed_secs;
> +        cl->sum_packets /= elapsed_secs;
> +        RT_GEN (cl->sum_bytes,cl->rate_bytes);
> +        RT_GEN (cl->sum_packets,cl->rate_packets);
> +        cl->rate_est_when = now;
> +    } else if time_before(now, cl->rate_est_when)
> +        cl->rate_est_when = now; /* Wraparound */
> +}


We have a generic rate estimator, I think we should convert HTB over
to use it and then maybe add this feature to the generic estimator.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to