分析IO数据
分析IO数据,使用GAWK# ======================================================================
#
# 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 == "Z"){
end_node = $14 - 1;
packet_size = $12;
}
# === flow 0 throughput ===
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 %f\n", packet_size, throughput_0);
}
页:
[1]