LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2016, 05:21 PM   #1
genehas
LQ Newbie
 
Registered: Dec 2016
Posts: 3

Rep: Reputation: Disabled
Unhappy URGENT, throughput, delay, jitter calculation of ethernet implementation on NS2


Hello everyone, i am trying to make an ethernet implementation on ns2. I have a tcl script;


Queue set limit_ 10
set opt(node) 8; # No. of nodes, n
set opt(bw) 10Mb; # Nominal link bandwidth
set opt(delay) 0.1ms; # Nominal link delay
set opt(ll) LL; # Link layer to use in ns-2
set opt(ifq) Queue/DropTail
# Drop tail queue to be used for buffers
# Drop tail queue drops from the tail end
# when full.
set opt(mac) Mac/802_3
# MAC protocol type
set opt(chan) Channel;

proc create-topology {} {
global ns opt
global lan node

set num $opt(node)
for {set i 0} {$i < $num} {incr i} {
set node($i) [$ns node]
lappend nodelist $node($i)
}

# This really specifies how the LAN should look like.

set lan [$ns newLan $nodelist $opt(bw) $opt(delay) \
-llType $opt(ll) -ifqType $opt(ifq) \
-macType $opt(mac) -chanType $opt(chan)]
}

## MAIN ##

set ns [new Simulator]
set tracefile [open output.tr w]
$ns trace-all $tracefile

create-topology

proc finish {} {
global ns tracefile
global lan
$ns flush-trace
close $tracefile
exit 0
}
# Set num = n-1
set num [ expr $opt(node) - 1 ]

for {set i 0} {$i < $num} {incr i} {

# Create and attach the UDP agent on the source nodes
set udp($i) [new Agent/UDP]
$ns attach-agent $node($i) $udp($i)

# Create an application (CBR) that will actually generate the
# traffic. Specify the parameters and attach it to UDP.

set cbr($i) [new Application/Traffic/CBR]
$cbr($i) set packetSize_ 64
$cbr($i) set rate_ 1.0Mb
$cbr($i) set random_ 1
$cbr($i) attach-agent $udp($i)

set sink($i) [new Agent/Null]
$ns attach-agent $node($num) $sink($i)
$ns connect $udp($i) $sink($i)

$ns at 0.0 "$cbr($i) start"
$ns at 2.0 "$cbr($i) stop"
}

$ns at 3.0 "finish"

$ns run

I obtain a trace file as a result, and want to analyze throughput, delay, jitter, packet delivery ratio of this file, how can i do this, please help me
 
Old 12-15-2016, 05:39 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by genehas View Post
Hello everyone, i am trying to make an ethernet implementation on ns2. I have a tcl script;
Code:
Queue set limit_ 10
set opt(node)   8;	# No. of nodes, n
set opt(bw)	10Mb;    # Nominal link bandwidth
set opt(delay)	0.1ms;   # Nominal link delay
set opt(ll)	LL;      # Link layer to use in ns-2
set opt(ifq)	Queue/DropTail 
			# Drop tail queue to be used for buffers
			# Drop tail queue drops from the tail end
			# when full.
set opt(mac)	Mac/802_3
			# MAC protocol type
set opt(chan)	Channel;

proc create-topology {} {
	global ns opt
	global lan node 

	set num $opt(node)
	for {set i 0} {$i < $num} {incr i} {
		set node($i) [$ns node]
		lappend nodelist $node($i)
	}

# This really specifies how the LAN should look like.

	set lan [$ns newLan $nodelist $opt(bw) $opt(delay) \
			-llType $opt(ll) -ifqType $opt(ifq) \
			-macType $opt(mac) -chanType $opt(chan)]
}

## MAIN ##

	set ns [new Simulator]
	set tracefile [open output.tr w]
	$ns trace-all $tracefile
	
	create-topology

	proc finish {} {
	global ns tracefile 
	global lan
	$ns flush-trace
	close $tracefile
	exit 0
	}
# Set num = n-1
	set num [ expr $opt(node) - 1 ]

	for {set i 0} {$i < $num} {incr i} {

# Create and attach the UDP agent on the source nodes
		set udp($i) [new Agent/UDP]
		$ns attach-agent $node($i) $udp($i)

# Create an application (CBR) that will actually generate the 
# traffic. Specify the parameters and attach it to UDP.

		set cbr($i) [new Application/Traffic/CBR]
  		$cbr($i) set packetSize_ 64
		$cbr($i) set rate_ 1.0Mb
		$cbr($i) set random_ 1
  		$cbr($i) attach-agent $udp($i)

		set sink($i) [new Agent/Null]
		$ns attach-agent $node($num) $sink($i)
		$ns connect $udp($i) $sink($i)

		$ns at 0.0 "$cbr($i) start"
		$ns at 2.0 "$cbr($i) stop"
		}

	$ns at 3.0 "finish"

	$ns run
I obtain a trace file as a result, and want to analyze throughput, delay, jitter, packet delivery ratio of this file, how can i do this, please help me
First, this is NOT URGENT for anyone here...we volunteer our time, so asking for/expecting 'urgent' help is rude. Secondly, you need to read the "Question Guidelines" link in my posting signature...we're happy to help, but what have you done/tried/researched so far??? Plenty of info here:

http://bfy.tw/91cS
 
Old 12-15-2016, 06:40 PM   #3
genehas
LQ Newbie
 
Registered: Dec 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
First, this is NOT URGENT for anyone here...we volunteer our time, so asking for/expecting 'urgent' help is rude. Secondly, you need to read the "Question Guidelines" link in my posting signature...we're happy to help, but what have you done/tried/researched so far??? Plenty of info here:

http://bfy.tw/91cS
Of course i have done researches, i obtained a trace file but it is in old format, now i am trying to use an awk file to calculate throughput, but awk files generally calculate new format of trace file, so now i'm searching to obtain new trace file from my tcl script, thanks for your "plenty info".
 
Old 12-15-2016, 06:52 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by genehas View Post
Of course i have done researches, i obtained a trace file but it is in old format, now i am trying to use an awk file to calculate throughput, but awk files generally calculate new format of trace file, so now i'm searching to obtain new trace file from my tcl script, thanks for your "plenty info".
If you want to be snotty, ask somewhere else. Otherwise, as you were told, read the "Question Guidelines"...we have NO IDEA what you've done/tried until you actually POST IT, do we??? You don't post what you did get, what you've tried/done, etc., just that it's 'urgent' for you (and your homework is NOT urgent).

Post a sample of your trace file, the awk script you're running, what you're getting, and what you WANT to see, and we can try to help. But we aren't going to look things up for you, nor write your scripts for you. Show your effort, and we'll be glad to help
 
Old 12-16-2016, 07:13 AM   #5
genehas
LQ Newbie
 
Registered: Dec 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Trace File Analysis in NS2

I have a tcl script named etherlan.txt, and trying to use an awk file named throughput.txt in the attached files to obtain throughput characteristic, but I can not view sent packets by the source in my trace file, how can i obtain them? I couldn't attach my trace file because it's size is too big. Here is an example of my output trace file:

h 0 0 8 cbr 512 ------- 0 0.0 7.0 0 0
h 0 1 8 cbr 512 ------- 0 1.0 7.1 0 1
h 0 2 8 cbr 512 ------- 0 2.0 7.2 0 2
h 0 3 8 cbr 512 ------- 0 3.0 7.3 0 3
h 0 4 8 cbr 512 ------- 0 4.0 7.4 0 4
h 0 5 8 cbr 512 ------- 0 5.0 7.5 0 5
h 0 6 8 cbr 512 ------- 0 6.0 7.6 0 6
+ 0.0001 0 8 cbr 512 ------- 0 0.0 7.0 0 0
- 0.0001 0 8 cbr 512 ------- 0 0.0 7.0 0 0
+ 0.0001 1 8 cbr 512 ------- 0 1.0 7.1 0 1
- 0.0001 1 8 cbr 512 ------- 0 1.0 7.1 0 1
+ 0.0001 2 8 cbr 512 ------- 0 2.0 7.2 0 2
- 0.0001 2 8 cbr 512 ------- 0 2.0 7.2 0 2
+ 0.0001 3 8 cbr 512 ------- 0 3.0 7.3 0 3
- 0.0001 3 8 cbr 512 ------- 0 3.0 7.3 0 3
+ 0.0001 4 8 cbr 512 ------- 0 4.0 7.4 0 4
- 0.0001 4 8 cbr 512 ------- 0 4.0 7.4 0 4
+ 0.0001 5 8 cbr 512 ------- 0 5.0 7.5 0 5
- 0.0001 5 8 cbr 512 ------- 0 5.0 7.5 0 5
+ 0.0001 6 8 cbr 512 ------- 0 6.0 7.6 0 6
- 0.0001 6 8 cbr 512 ------- 0 6.0 7.6 0 6
r 0.000658 8 7 cbr 512 ------- 0 1.0 7.1 0 1
r 0.00111 8 7 cbr 512 ------- 0 5.0 7.5 0 5
r 0.001612 8 7 cbr 512 ------- 0 2.0 7.2 0 2
r 0.002046 8 7 cbr 512 ------- 0 6.0 7.6 0 6
Attached Files
File Type: txt etherlan.txt (2.8 KB, 61 views)
File Type: txt throughput.txt (1.4 KB, 64 views)

Last edited by genehas; 12-16-2016 at 07:16 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] end to end delay calculation in satellite links awk file problem-ns2.35 rianariana Linux - Software 3 11-23-2013 09:46 AM
how to calculate throughput,delay,routingload vishalpolara Linux - Newbie 2 01-04-2013 12:54 AM
Using tc or iptables to control jitter (packet delay variation) rladams65 Linux - Networking 5 02-08-2012 01:17 PM
how to calculate throughput and delay characteristics for HCCA stud17 Linux - Newbie 1 11-09-2011 02:59 PM
delay calculation for LSB in timer tkmsr Programming 2 09-05-2010 02:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration