码迷,mamicode.com
首页 > 其他好文 > 详细

Trace文件分析

时间:2016-07-19 20:48:11      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

delay.awk

BEGIN {
highest_packet_id = 0;
}
{
action = $1;
time = $2;
from = $3;
to = $4;
type = $5;
pktsize = $6;
flow_id = $8;
src = $9;
dst = $10;
seq_no = $11;
packet_id = $12;

if ( packet_id > highest_packet_id )
highest_packet_id = packet_id;

if ( start_time[packet_id] == 0 )
start_time[packet_id] = time;

if ( flow_id == 2 && action != "d" ) {
if ( action == "r" ) {
end_time[packet_id] = time;
}
} else {
end_time[packet_id] = -1;
}
}
END {
for ( packet_id = 0; packet_id <= highest_packet_id; packet_id++ ) {
start = start_time[packet_id];
end = end_time[packet_id];
packet_duration = end - start;

if ( start < end ) printf("%f %f\n", start, packet_duration);
}
}

命令行输入:gawk -f delay.awk wired.tr >delay

gnuplot

plot "delay" using 1:2 with lines

 技术分享

throughput.awk

BEGIN {
init=0;
i=0;
}
{
action = $1;
time = $2;
from = $3;
to = $4;
type = $5;
pktsize = $6;
flow_id = $8;
src = $9;
dst = $10;
seq_no = $11;
packet_id = $12;

if(action=="r" && from==2 && to==3 && flow_id==2) {
pkt_byte_sum[i+1]=pkt_byte_sum[i]+ pktsize;

if(init==0) {
start_time = time;
init = 1;
}

end_time[i] = time;
i = i+1;
}
}
END {
printf("%.2f\t%.2f\n", end_time[0], 0);

for(j=1 ; j<i ; j++){
th = pkt_byte_sum[j] / (end_time[j] - start_time)*8/1000;
printf("%.2f\t%.2f\n", end_time[j], th);
}
printf("%.2f\t%.2f\n", end_time[i-1], 0);
}

命令行输入:gawk -f throughput.awk wired.tr >delay

gnuplot

plot "throughput" using 1:2 with lines

 

技术分享

 

Trace文件分析

标签:

原文地址:http://www.cnblogs.com/liusikun/p/5685943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!