| To: | Ben Greear <greearb@xxxxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: inter-packet gap in pktgen |
| From: | Lennert Buytenhek <buytenh@xxxxxxxxxxxxxx> |
| Date: | Wed, 8 Dec 2004 08:38:58 +0100 |
| Cc: | Robert Olsson <Robert.Olsson@xxxxxxxxxxx>, hadi@xxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <41B632F3.1090104@xxxxxxxxxxxxxxx> |
| References: | <20041207222522.GA30266@xxxxxxxxxxxxxxxxx> <41B632F3.1090104@xxxxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | Mutt/1.4.1i |
On Tue, Dec 07, 2004 at 02:47:15PM -0800, Ben Greear wrote:
> >By tweaking the 'ipg' parameter I can generate pretty much any packet rate
> >I want, as long as I set ipg=(1e9/rate)-496 instead of something possibly
> >more straightforward.
>
> That 496 will also change with load on the system, at least on average. I
> dealt with this by having a user-space app sample the rate and adjust the
> ipg to keep the average rate where I want it.
>
> So, I'd suggest leaving the ipg as it is, and use external tools to get
> the exact pps that you are looking for.
Just because it's possible that way doesn't mean that it's the only
way or even _the_ way of doing it.
Another option is:
next_tx = get_time_in_ns();
while (--count) {
tx_packet();
next_tx += 1e9/intended_pps;
nanospin(next_tx - get_time_in_ns());
}
This should be relatively independent of system load. OK, I know,
time to show some code.
--L
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: _High_ CPU usage while routing (mostly) small UDP packets, Willy Tarreau |
|---|---|
| Next by Date: | Re: [PATCH] fix select() for SOCK_RAW sockets (ipv6), YOSHIFUJI Hideaki / 吉藤英明 |
| Previous by Thread: | Re: inter-packet gap in pktgen, Ben Greear |
| Next by Thread: | Re: inter-packet gap in pktgen, Robert Olsson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |