ave_delay.awk(有线网络)

BEGIN { highest_packet_id = 0; total_packet = 0; total_delay_time = 0; } { action = $1; time = $2; from = $3; to = $4; type = $5; pktsize = $6; flow_id = $8; src = $9; dst = $10; seq_no = $11; packet_id = $12; if ( packet_id > highest_packet_id ) highest_packet_id = packet_id; if ( start_time[packet_id] == 0 ) start_time[packet_id] = time; if ( flow_id == 2 && action != "d" ) { if ( action == "r" ) { end_time[packet_id] = time; } } else { end_time[packet_id] = -1; } } END { for ( packet_id = 0; packet_id <= highest_packet_id; packet_id++ ) { start = start_time[packet_id]; end = end_time[packet_id]; if (end >start) { total_packet ++; total_delay_time +=end - start; } } printf ("average delay time is: %.9f/n",total_delay_time/total_packet); }

你可能感兴趣的:(ave_delay.awk(有线网络))