getnoderecv.awk

来自「相关搜索: ns2仿真结果分析 all-awk ns2 ns2 无限网络中awk」· AWK 代码 · 共 49 行

AWK
49
字号
# getData.awkBEGIN {	if(step ==0)		step = 10;	base = 0;	start = 0;	bytes = 0;	total_bytes = 0;	max = 0;	calc = 0;}$0 ~/^s.* AGT/ {	if (base == 0 && $3 == ("_" src "_")) {		base = $2;		start = $2;		calc = 1;	}}$0 ~/^r.* AGT/ && calc == 1{ 	time = $2;	if (time > base) {		bw = bytes/(step * 1000.0);                if (max < bw) max = bw;                printf "%.9f %.9f\n", base, bw >> outfile;                base += step;                bytes = 0;        }	if ($3 == ("_" dst "_") && match($14,"." src ":") >=0 ) {		total_bytes += $8;		bytes += $8;	}}END {								if (total_bytes)		printf "# Avg B/w = %.3fKB/s\n", ((total_bytes/1000.0)/(time-start)) >> outfile;	else			printf "Avg B/w = 0.0KB/s\n";	printf "# Max B/w = %.3fKB/s\n", max >> outfile;		}

⌨️ 快捷键说明

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