From: Patrick McHardy <kaber@trash.net>
To: Ranjit Manomohan <ranjitm@google.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH][NET_SCHED] Update htb rate when stats are polled.
Date: Sat, 26 May 2007 09:58:36 +0200 [thread overview]
Message-ID: <4657E8AC.4080505@trash.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0705250923210.27351@ranjit.corp.google.com>
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.
next prev parent reply other threads:[~2007-05-26 7:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 17:11 [PATCH][NET_SCHED] Update htb rate when stats are polled Ranjit Manomohan
2007-05-26 4:10 ` Ilpo Järvinen
2007-05-26 7:58 ` Patrick McHardy [this message]
2007-05-26 12:55 ` Patrick McHardy
2007-05-29 18:39 ` Ranjit Manomohan
2007-05-30 7:33 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4657E8AC.4080505@trash.net \
--to=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=ranjitm@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).