in reply to IP Packet count at regular intervals of time
produces#!/usr/bin/perl -w use strict; use Time::HiRes qw (alarm time); $SIG{ALRM} = sub { printf "%16.5f\n",time; alarm(0.5); }; alarm(0.5); while(1) { select(undef,undef,undef,1); }
1069651689.38722 1069651689.88720 1069651690.38720 1069651690.88721 1069651691.38721
If you can't alarms at precise times, you can try to make up for it by printing packets/second, which should be the same even if the alarms are off by a little bit. You may also find that using 1-second intervals works better, since that's the traditional interface provided by alarm, but I'm not sure.
This is on RedHat 7.2, kernel 2.4.20, perl 5.6.1, Time::HiRes 1.20.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: IP Packet count at regular intervals of time
by prakashrj (Initiate) on Nov 24, 2003 at 06:19 UTC | |
by sgifford (Prior) on Nov 24, 2003 at 06:26 UTC | |
|
Re: Re: IP Packet count at regular intervals of time
by pg (Canon) on Nov 24, 2003 at 06:22 UTC |