[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4657E8AC.4080505@trash.net>
Date: Sat, 26 May 2007 09:58:36 +0200
From: Patrick McHardy <kaber@...sh.net>
To: Ranjit Manomohan <ranjitm@...gle.com>
CC: netdev@...r.kernel.org
Subject: Re: [PATCH][NET_SCHED] Update htb rate when stats are polled.
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists