计算性能摘要日志的最大和最小执行时间:
日志摘要:
st,Y,10000ms,DDD st,N,10ms,EEE o,Y,30000000ms,EEE b,N,399ms,dd c,Y,400ms,mm d,N,20000ms,aa eee,N,388ms,NNN
统计成功情况:
awk -F , 'BEGIN {min=10000000;max=-1;} /,Y,/ {span=substr($3,0,length($3)-2)+0;if(min > span){min = span;min_row=$0}; if(max < span){max=span;max_row=$0};} END {print "Min Time:",min_row;print "Max Time:",max_row}' test.log
统计失败情况:
awk -F , 'BEGIN {min=10000000;max=-1;} /,N,/ {span=substr($3,0,length($3)-2)+0;if(min > span){min = span;min_row=$0}; if(max < span){max=span;max_row=$0};} END {print "Min Time:",min_row;print "Max Time:",max_row}' test.log
结果 :
Min Time: c,Y,400ms,mm Max Time: o,Y,30000000ms,EEE