is what I was thinking of. It just helps make up for an irregular timer a little bit, as if the timer took longer, there will be more packets and the elapsed time will be longer, balancing things out somewhat.$now=time; $packets_sec = $packets / ($now - $lasttime); $lasttime=$now;
Those are really irregular. I wonder if the timer is only going off when packets are received?
If there's some kind of bad interaction between the alarms and the packet capturing (for example, Net::Pcap; is setting its own alarms), one approach would be to split up the packet code and the monitoring code into two processes. The packet sniffing code would just listen for packets, and whenever it found one print something to its standard out. Meanwhile, the monitoring code would count the number of times the packets sniffer printed, and when the alarm went off would print the result. That would split the alarm code and packet code into two seperate processes, so they can't interfere with each other.
Still, that sounds a bit elaborate. Perhaps somebody who knows Net::Pcap better than I do can give you better advice.
In reply to Re: Re: Re: IP Packet count at regular intervals of time
by sgifford
in thread IP Packet count at regular intervals of time
by prakashrj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |