getNodeRecv.awk
上传用户:sy0851
上传日期:2014-07-16
资源大小:4k
文件大小:1k
- # getData.awk
- BEGIN {
- 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 %.9fn", base, bw >> outfile;
- base += step;
- bytes = 0;
- }
- if ($3 == ("_" dst "_") && match($14,"." src ":") >=0 ) {
- #dst收到src发送的数据
- #增加总的数据接收量
- total_bytes += $8;
- #增加当前时段的数据接收量
- bytes += $8;
- }
- }
- END {
- if (total_bytes)
- #输出整个运行时间平均传输速率
- printf "# Avg B/w = %.3fKB/sn", ((total_bytes/1000.0)/(time-start)) >> outfile;
- else
- printf "Avg B/w = 0.0KB/sn";
- printf "# Max B/w = %.3fKB/sn", max >>outfile;
- }