Result of awk script
Hi i have tested script for delay.awk to analyse a tcp trace file and i obtain this result
2 0.090344 0.045172 I want to trace the graph of delay for my tcp trace file with this code awk but i did'nt inderstand this result please help me : This is my script awk : ------------------------------------------ BEGIN {highest_packet_id = 0;} { action = $1; time = $2; node =$3; type = $5; packet_id =$6; if (packet_id > highest_packet_id) highest_packet_id = packet_id; if (action == "+"){ if (type == "tcp"){ send_time[packet_id] = time;} #else {send_time[packet_id] = 0;} } else if (action == "r"){ if (type == "tcp"){ rcv_time[packet_id] = time; } #else{rcv_time[packet_id] = 0;} } } END {packet_no = 0; total_delay = 0; for (packet_id = 0; packet_id <=highest_packet_id; packet_id++){ if ((send_time[packet_id]!=0) && (rcv_time[packet_id]!=0)){ start = send_time[packet_id]; end = rcv_time[packet_id]; packet_duration = end-start;} else packet_duration = -1; if (packet_duration > 0) {packet_no++; total_delay = total_delay + packet_duration; } } printf("%d %f %f\n", packet_no, total_delay, total_delay/packet_no); } Thanks for you |
What did you expect it to print? I suspect you want to move the 'printf' line above the brace preceding it (i.e. change
Code:
if (packet_duration > 0) { Code:
if (packet_duration > 0) { Also, use [CODE][/CODE] tags around your code to make it more legible. |
All times are GMT -5. The time now is 08:41 PM. |