Ethereal-dev: [ethereal-dev] High resolution timers

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Christian Brunner <chb@xxxxxx>
Date: Tue, 5 Jan 1999 19:57:30 +0100 (CET)
Since I'm at writing mails, I want to ask a question, too. Maybe someone
has an idea.

I want to generate a constant load on the network, sending out arbitrary
packets. The problem is, that I have to send out the packets at a fairly
high rate (especially on fast networks). My first idea was to simply use
an alarm timer to do this, but under x86-Linux (I don't think other
systems make to much of a difference here) the kernel timer has a
resolution of 20ms, which is half an eternity, when I have to send out a
packet every 50 microsecond.

The solution I'm working with right now, is to fork a child that does a
busy sleep (constantly polling the clock). And sends out a signal to the
parent at the requested rate. This works, but is inaccurate, eats up all
the cpu time and is more than ugly...

Christian