Re: Interval Timers on Windows



Martijn Lievaart wrote:

On Sun, 29 Apr 2007 10:47:30 +0100, Brian Wakem wrote:

Surely you would need to time sendPacket() and subtract it from the next
delay?

Surely time spend in sendPacket is negligible om modern machines?

Thanks for your replies.

Actually I have tried a version making similar adjustments to the delay
before, but there was no noticeable improvements (the packet rate is still
highly fluctuating while tending to be slightly < 50Hz in the long term). In
fact the time lag seems to be even more substantial in this version. This is
the exact code of what I tried:

sub sendPacketThread {
my ($t_s, $t_us);
while ($continue) {
($t_s, $t_us) = (time(), ${[gettimeofday()]}[1]);
sendPacket();
my ($t2_s, $t2_us) = (time(), ${[gettimeofday()]}[1]);
my $workTime = ($t2_s - $t_s)*(10**6) + ($t2_us - $t_us);
($t_s, $t_us) = ($t2_s, $t2_us);
select(undef, undef, undef,
($ptime*1000-$workTime)/(10**6));
}
}

This subroutine is what was immediately called from thread->new(). In the
test, both the sender and receiver are on localhost so there should not be
any packet transit issue.

Therefore, I am wondering whether there are any "real" timers accessible on
Windows Perl that gives a more accurate timer. Some fluctuations of delay
in between individual packets is acceptable, but the long-term rate should
be very close to 50Hz or the receiver side will start to drop each packet
on arrival ...

--
Regards,
Bernard Chan

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: Should i disable Nagels Algorithm in my http client?
    ... The data in the buffer is packaged and sent immediately UNLESS ... stream a packet will be sent. ... turn off Delayed Acknowledgements or adjust the delay time. ... The delayed ACK of the second packet doesn't have any effect because the ...
    (comp.lang.perl.misc)
  • Re: how much size is enough ?
    ... If I assume my minimum rx packet length of 64 bytes and maximum packet ... You are not going to be able to do 200 metre segments with existing ... and available fibre types) affects the bit encoding used, ... The 802.3ae-2002 standard indicates that a conservative delay estimate ...
    (comp.dcom.lans.ethernet)
  • Re: estimate the cdf 95% with a confidence interval of a 95%
    ... in each file I have the delay of all the packets that the station has ... then if packet n saw a delay very high because the ... to again compute the 95% cdf out of them. ... distribution function for a binomial distribution, ...
    (sci.math)
  • Re: Bandwidth
    ... >simulate the network at a bandwidth of 9.6kbps). ... The time from when you START sending the packet to the time when the ... The speed-of-light propagation delay is negligible ... in twisted-pair or shielded cables is somewhat less than the speed ...
    (comp.unix.programmer)
  • Re: Socket Send
    ... without delay, but without TCP_NODELAY a delay is almost guaranteed in this ... If you have no idea what the timing pattern of your data is going to ... know better than the TCP stack how to segment the data. ... packet, so there's no problem with acknowledged data that doesn't ...
    (comp.unix.programmer)