Ns2 awk script : throughput 계산

Network/Ns-2 | 2006/12/19 00:01 | adioshun
throughput 계산 awk 스크립트



출처 : http://cs-people.bu.edu/wtwang/cs556/ns-tutorial.ppt
작성 : 2006.12.19 by 임헌정
http://www.4ellene.net



#script: myflowcalcall.awk
# a general script for computing throughput

BEGIN {

arguments = 2;

if (ARGC < arguments || ARGC > arguments || flowtype == 0) {

? ? printf("error: wrong number of arguments.\nawk: usage - awk -f flowcalc.awk [-v graphgran=value] [-v fidfrom=value] [-v fidto=value] [-v fid=value] -v flowtype=\"type\" -v outdata_file=\"filename\" indata_file\n--%d",ARGC);

? ? exit;

}

measure_interval = 0.5;
bits = 0;
first_time = graphgran;

}

{

if (($1 == "r") &&
? ((fidfrom == 0 && fidto ==0) || (($8 == fid) && ($3 == fidfrom) && ($4 == fidto))) &&
? (flowtype == "all" || flowtype == $5)) {

? if (($2 - first_time) > measure_interval) {

? ? first_time = first_time + measure_interval;

? ? rate = (bits/1000000)/first_time;

? ? print filename first_time, rate;

? ?}

? ?bits = bits + $6 * 8;

}

}

END {

measure_interval = 0.5;

first_time = first_time + measure_interval;

rate = (bits/1000000)/first_time;

print filename first_time, rate;

}

#Script: computeall
#compute throughput so far for a certain flow

awk -f myflowcalcall.awk -v graphgran=0 -v fidfrom=2 -v fidto=3 -v fid=1 -v flowtype="tcp" -v outdata_file="nothing" out.tr >thr1

echo "Compute flow1 throughput all and output to thr1"




awk -f myflowcalcall.awk -v graphgran=0 -v fidfrom=2 -v fidto=3 -v fid=2 -v flowtype="cbr" -v outdata_file="nothing" out.tr >thr2

echo "Compute flow2 throughput all and output to thr2"



추가?


ns-2 throughput in 802.11 awk script
http://mailman.isi.edu/pipermail/ns-users/2002-September/025628.html


throughput 계산법
http://mailman.isi.edu/pipermail/ns-users/2002-September/025585.html

출처 :?http://www.joon.pe.kr/blog/30





2006/12/19 00:01 2006/12/19 00:01
TAG
Trackback address :: http://4ellene.net/tt/trackback/1085

Comments List

  1. 궁금하군요. 2008/02/02 23:07

    awk 스크립트 파일을 .tr파일이 생성되는 폴더에 위치 시키고 파란색 명령을 실행하면 되는거 아닌가요?

    실행하는 법좀 자세히 알려주시면 감사하겠습니다.

    • adioshun 2008/02/03 21:45

      awk를 실행 시키는 것입니다..단지 -f 옵션을 주어서 파일을 지정한거고요(참고 : -f = awk의 실행 Action을 가진 프로그램 파일 지정

      위 경우 tr파일과 awk파일을 동일한 위치에 두어야 하죠..

      실행이 안된다면..뒤에 추가 파라미터 정보가 틀려서 안되는 경우가 클꺼에요.

Write a comment.

[로그인][오픈아이디란?]