delay.awk

来自「对ns2软件进行UMTS扩展」· AWK 代码 · 共 54 行

AWK
54
字号
BEGIN {   # simple awk script to generate end-to-end packet lifetime statistics   # in a form suitable for plotting with xgraph.   # Lloyd Wood, July 1999.   # http://www.ee.surrey.ac.uk/Personal/L.Wood/ns/   highest_packet_id = 0;}{   action = $1;   time = $3;#   node_1 = $3;#   node_2 = $4;#   src = $5;   flow_id = $39;#   node_1_address = $9;#   node_2_address = $10;#   seq_no = $11;   packet_id = $41;   trace_level = $19;   if ((flow_id == FID) && (trace_level == "AGT")) {      if ( packet_id > highest_packet_id ) highest_packet_id = packet_id;      # getting start time is not a problem, provided you're not starting      # traffic at 0.0.      # could test for sending node_1_address or flow_id here.      if ( start_time[packet_id] == 0 )  start_time[packet_id] = time;      # only useful for small unicast where packet_id doesn't wrap.      # checking receive means avoiding recording drops      if ( action != "d" ) {         if ( action == "r" ) {            # could test for receiving node_2_address or flow_id here.            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];       packet_duration = end - start;       #if ( start < end ) printf("%f %f\n", start, packet_duration);       if ( start < end ) printf("%f %f\n", end, packet_duration);   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?