Re: Interval Timers on Windows
- From: Brian Wakem <no@xxxxxxxxx>
- Date: Sun, 29 Apr 2007 10:47:30 +0100
Bernard Chan wrote:
Hi All,
I am writing a script to generate some packets for RTP stream simulation.
As you may know, RTP requires a more-or-less constant packet rate (and
hence UDP is used), and I will need to generate fixed sized packets at
regular intervals, say 20ms, so that will be around 50 packets per second.
On Linux I have tried a version using Time::HiRes ualarm(). On some of my
Linux systems ualarm() can generate a packet rate that approximates 50Hz
pretty well, and the interval variance is infinitesimal. However, I also
have some systems (mostly Fedora) which seem to exhibit increasingly long
intervals after some seconds for reasons unknown to me.
I would also like to have the script usable on Windows that my peers who
have Windows on their systems can perform some tests. There is no ualarm()
in Time::HiRes on Windows, so I tried another approach. I created a
thread-enabled version of the script. A separate thread is created which
does roughly this:
while ($continue) {
sendPacket();
select(undef, undef, undef, 20/1000);
}
However, I find that the sleep between each packet tends to be slightly
higher than 20ms, so after not many packets it is already arriving slower
than the drain rate at the receiver side.
Surely you would need to time sendPacket() and subtract it from the next
delay?
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
.
- Follow-Ups:
- Re: Interval Timers on Windows
- From: Martijn Lievaart
- Re: Interval Timers on Windows
- References:
- Interval Timers on Windows
- From: Bernard Chan
- Interval Timers on Windows
- Prev by Date: Re: Perl routine for cluster detection
- Next by Date: Re: Weird error after a configuration change
- Previous by thread: Interval Timers on Windows
- Next by thread: Re: Interval Timers on Windows
- Index(es):
Relevant Pages
|
|