throughput.awk
上传用户:sy0851
上传日期:2014-07-16
资源大小:4k
文件大小:2k
- # ======================================================================
- #
- # Simulation Goal : Link Throughput
- # Simulation Topology : Chain
- # Trace type : Normal trace
- #
- # ======================================================================
- # ======================================================================
- # Measure Link Throughput
- # ======================================================================
- BEGIN {
- total_pkt_size_0 = 0;
- sim_time = 0;
- packet_size = 0;
- }
- {
- # field parameters of normal trace
- event = $1; #; Event : r , s , d , f
- time = $2; #; Time : send time , receive time , drop time
- node = $3; #; Node : source node , receive node
- trace_type = $4; #; Trace type MAC trace
- error_state = $5; #; Error state : DUP , ERR , RET , STA , BSY , TTL , CBK
- pkt_id = $6; #; Event ID : Frame sequence number for total flows
- pkt_type = $7; #; Packet type : RTS , CTS , Data = cbr , ACK
- pkt_size = $8; #; Packet size (unit : bytes)
-
- # pick the part of number among "node" variables
- node = substr ( node, 2, length(node) - 2 );
-
- if (event == "r"){
- end_node = $14 - 1;
- packet_size = $12;
- }
-
- # === flow 0 throughput ===
- #node == end_node
- if ( event == "r" && node == end_node && pkt_type == "cbr" ) {
- total_pkt_size_0 = total_pkt_size_0 + pkt_size;
- }
-
- sim_time = time;
- }
- END {
- throughput_0 = total_pkt_size_0 * 8 / ( sim_time * 1000000 );
- printf ( "%d %fn", packet_size, throughput_0);
- }