int elapsed_flag, version_flag, count_flag, loop_flag;
int per_recv_flag, report_all_rtts_flag, name_flag, addr_flag, backoff_flag;
int multif_flag;
+int outage_flag = 0;
int timestamp_flag = 0;
int random_data_flag = 0;
#if defined( DEBUG ) || defined( _DEBUG )
/* get command line options */
- while( ( c = getopt( argc, argv, "gedhlmnqusaAvDRz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:" ) ) != EOF )
+ while( ( c = getopt( argc, argv, "gedhlmnqusaAvDRz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:o" ) ) != EOF )
{
switch( c )
{
usage(1);
}
break;
+
+ case 'o':
+ outage_flag = 1;
+ break;
+
default:
fprintf(stderr, "see 'fping -h' for usage information\n");
exit(1);
if( randomly_lose_flag ) fprintf( stderr, " randomly_lose_flag set\n" );
if( sent_times_flag ) fprintf( stderr, " sent_times_flag set\n" );
if( print_per_system_flag ) fprintf( stderr, " print_per_system_flag set\n" );
+ if( outage_flag ) fprintf( stderr, " outage_flag set\n" );
}/* IF */
#endif /* DEBUG || _DEBUG */
void print_per_system_stats( void )
{
- int i, j, avg;
+ int i, j, avg, outage_ms;
HOST_ENTRY *h;
char *buf;
int bufsize;
h->num_sent, h->num_recv, h->num_sent > 0 ?
( ( h->num_sent - h->num_recv ) * 100 ) / h->num_sent : 0 );
- }/* IF */
+ if (outage_flag)
+ {
+ /* Time outage total */
+ outage_ms = (h->num_sent - h->num_recv) * perhost_interval/100;
+ fprintf( stderr, ", outage(ms) = %d", outage_ms );
+ }
+
+ }/* IF */
else
{
fprintf( stderr, " xmt/rcv/%%return = %d/%d/%d%%",
if( h->num_recv )
{
- avg = h->total_time / h->num_recv;
+
+ avg = h->total_time / h->num_recv;
fprintf( stderr, ", min/avg/max = %s", sprint_tm( h->min_reply ) );
fprintf( stderr, "/%s", sprint_tm( avg ) );
fprintf( stderr, "/%s", sprint_tm( h->max_reply ) );
void print_per_system_splits( void )
{
- int i, avg;
+ int i, avg, outage_ms_i;
HOST_ENTRY *h;
char *buf;
int bufsize;
h->num_sent_i, h->num_recv_i, h->num_sent_i > 0 ?
( ( h->num_sent_i - h->num_recv_i ) * 100 ) / h->num_sent_i : 0 );
+ if (outage_flag)
+ {
+ /* Time outage */
+ outage_ms_i = (h->num_sent_i - h->num_recv_i) * perhost_interval/100;
+ fprintf( stderr, ", outage(ms) = %d", outage_ms_i );
+ }
}/* IF */
else
{
fprintf(out, " -l loop sending pings forever\n" );
fprintf(out, " -m ping multiple interfaces on target host\n" );
fprintf(out, " -n show targets by name (-d is equivalent)\n" );
+ fprintf(out, " -o show the accumulated outage time (lost packets * packet interval [option -i]) \n" );
fprintf(out, " -O n set the type of service (tos) flag on the ICMP packets\n" );
fprintf(out, " -p n interval between ping packets to one target (in millisec)\n" );
fprintf(out, " (in looping and counting modes, default %d)\n", perhost_interval / 100 );