SlideShare a Scribd company logo
1 of 13
Jean Fellipe de Almeida Pimentel
Túlio César Faria Pinto
   Usado para monitorar números de pacotes transferidos, bem como pacotes
    perdidos.

   Pode ser usado com uma função chamada a cada X segundos e assim obter o
    throughput.
   A classe Agent tem os seguintes atributos:

       addr_         Endereço de origem
       dst_      Endereço de destino
       size_     Tamanho do pacote em bytes
       type_     Tipo do pacote
       fid_          Identificador de fluxo
       prio_     Prioridade
       flags_        Flags
       defttl_       TTL padrão
   A classe LossMonitor herda as funcionalidades de Agent

   Seus próprios atributos são:

       nlost_          Número de pacotes perdidos
       npkts_          Número de pacotes recebidos
       bytes_          Número de bytes recebidos
       lastPktTime_ Hora do último pacote recebido
       expected_       Número de sequência esperado para o próximo pacote
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]


$ns duplex-link $n0 $n3 1Mb 100ms DropTail
$ns duplex-link $n1 $n3 1Mb 100ms DropTail
$ns duplex-link $n2 $n3 1Mb 100ms DropTail
$ns duplex-link $n3 $n4 1Mb 100ms DropTail
proc attach-expoo-traffic { node sink size burst idle rate } {
     set ns [Simulator instance]
     set source [new Agent/UDP]
     $ns attach-agent $node $source
     set traffic [new Application/Traffic/Exponential]
     $traffic set packet-size $size
     $traffic set burst-time $burst
     $traffic set idle-time $idle
     $traffic set rate $rate
     $traffic attach-agent $source
     $ns connect $source $sink
     return $traffic
}
set sink0 [new Agent/LossMonitor]
set sink1 [new Agent/LossMonitor]
set sink2 [new Agent/LossMonitor]


$ns attach-agent $n4 $sink0
$ns attach-agent $n4 $sink1
$ns attach-agent $n4 $sink2


set source0 [attach-expoo-traffic $n0 $sink0 200 2s 1s 100k]
set source1 [attach-expoo-traffic $n1 $sink1 200 2s 1s 200k]
set source2 [attach-expoo-traffic $n2 $sink2 200 2s 1s 300k]
set f0 [open out0.tr w]
set f1 [open out1.tr w]
set f2 [open out2.tr w]


proc finish {} {
      global f0 f1 f2
      close $f0
      close $f1
      close $f2
      exec xgraph out0.tr out1.tr out2.tr -geometry 800x400 &
      exit 0
}
proc record {} {
     global sink0 sink1 sink2 f0 f1 f2
     set ns [Simulator instance]
     set time 0.5
     set bw0 [$sink0 set bytes_]; set bw1 [$sink1 set bytes_]; set bw2 [$sink2 set bytes_];
     set now [$ns now]
     puts $f0 "$now [expr $bw0/$time*8/1000000]"
     puts $f1 "$now [expr $bw1/$time*8/1000000]"
     puts $f2 "$now [expr $bw2/$time*8/1000000]"
     $sink0 set bytes_ 0; $sink1 set bytes_ 0; $sink2 set bytes_ 0;
     $ns at [expr $now+$time] "record"
}
$ns at 0.0 "record"
$ns at 1.0 "$source0 start”
$ns at 1.0 "$source1 start"
$ns at 1.0 "$source2 start"
$ns at 5.0 "$source0 stop"
$ns at 5.0 "$source1 stop"
$ns at 5.0 "$source2 stop"
$ns at 6.0 "finish"
$ns run
Bibliografia:

   LossMonitor Class Reference
    http://www.auto-nomos.de/ns2doku/class_loss_monitor.html


   NS Manual
    www.isi.edu/nsnam/ns/doc/ns_doc.pdf


   Network Simulator – Visão Geral da Ferramenta de Simulação de Redes
    http://www.cis.udel.edu/~portnoi/articles/networksimulator-sepa.pdf

More Related Content

What's hot

Пишем для asyncio - Андрей Светлов, PyCon RU 2014
Пишем для asyncio - Андрей Светлов, PyCon RU 2014Пишем для asyncio - Андрей Светлов, PyCon RU 2014
Пишем для asyncio - Андрей Светлов, PyCon RU 2014
it-people
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
clkao
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
Moriyoshi Koizumi
 
Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)
MoscowDjango
 
Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest Updates
Iftekhar Eather
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
Yasuharu Nakano
 
What's new in PHP 5.5
What's new in PHP 5.5What's new in PHP 5.5
What's new in PHP 5.5
Tom Corrigan
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
Teerawat Issariyakul
 

What's hot (20)

Symfony messenger - PHPers Summit 2019
Symfony messenger - PHPers Summit 2019Symfony messenger - PHPers Summit 2019
Symfony messenger - PHPers Summit 2019
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 
Пишем для asyncio - Андрей Светлов, PyCon RU 2014
Пишем для asyncio - Андрей Светлов, PyCon RU 2014Пишем для asyncio - Андрей Светлов, PyCon RU 2014
Пишем для asyncio - Андрей Светлов, PyCon RU 2014
 
Asyncio
AsyncioAsyncio
Asyncio
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heureCréer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heure
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)
 
Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest Updates
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
 
Jose dossantos.doc
Jose dossantos.docJose dossantos.doc
Jose dossantos.doc
 
GoでKVSを書けるのか
GoでKVSを書けるのかGoでKVSを書けるのか
GoでKVSを書けるのか
 
What's new in PHP 5.5
What's new in PHP 5.5What's new in PHP 5.5
What's new in PHP 5.5
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
A new way to develop with WordPress!
A new way to develop with WordPress!A new way to develop with WordPress!
A new way to develop with WordPress!
 
Swiftの関数型っぽい部分
Swiftの関数型っぽい部分Swiftの関数型っぽい部分
Swiftの関数型っぽい部分
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
 
Hacking parse.y (RubyConf 2009)
Hacking parse.y (RubyConf 2009)Hacking parse.y (RubyConf 2009)
Hacking parse.y (RubyConf 2009)
 
How to send files to remote server via ssh in php
How to send files to remote server via ssh in phpHow to send files to remote server via ssh in php
How to send files to remote server via ssh in php
 

Viewers also liked

(07) instalaã§ã£o de programas
(07) instalaã§ã£o de programas(07) instalaã§ã£o de programas
(07) instalaã§ã£o de programas
Anderson Lago
 
(08)inicializacao e gerencia_de_processos
(08)inicializacao e gerencia_de_processos(08)inicializacao e gerencia_de_processos
(08)inicializacao e gerencia_de_processos
Anderson Lago
 

Viewers also liked (10)

(07) instalaã§ã£o de programas
(07) instalaã§ã£o de programas(07) instalaã§ã£o de programas
(07) instalaã§ã£o de programas
 
AIX - Gerência de Processos
AIX - Gerência de ProcessosAIX - Gerência de Processos
AIX - Gerência de Processos
 
Gerência de Processos: Deadlocks
Gerência de Processos: DeadlocksGerência de Processos: Deadlocks
Gerência de Processos: Deadlocks
 
(08)inicializacao e gerencia_de_processos
(08)inicializacao e gerencia_de_processos(08)inicializacao e gerencia_de_processos
(08)inicializacao e gerencia_de_processos
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithm
 
Scheduling In Linux
Scheduling In LinuxScheduling In Linux
Scheduling In Linux
 
Linux scheduler
Linux schedulerLinux scheduler
Linux scheduler
 
Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
Windows process-scheduling
Windows process-schedulingWindows process-scheduling
Windows process-scheduling
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
 

Similar to Loss Monitor

NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.ppt
Wajath
 
NS-2 Tutorial
NS-2 TutorialNS-2 Tutorial
NS-2 Tutorial
code453
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
Muragesh Kabbinakantimath
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
 

Similar to Loss Monitor (20)

ns-simple.pdf
ns-simple.pdfns-simple.pdf
ns-simple.pdf
 
Ns network simulator
Ns network simulatorNs network simulator
Ns network simulator
 
Ns2 ns3 training in mohali
Ns2 ns3 training in mohaliNs2 ns3 training in mohali
Ns2 ns3 training in mohali
 
NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.ppt
 
NS2-tutorial.pdf
NS2-tutorial.pdfNS2-tutorial.pdf
NS2-tutorial.pdf
 
Ns 2 Network Simulator An Introduction
Ns 2 Network Simulator An IntroductionNs 2 Network Simulator An Introduction
Ns 2 Network Simulator An Introduction
 
NS-2 Tutorial
NS-2 TutorialNS-2 Tutorial
NS-2 Tutorial
 
Working with NS2
Working with NS2Working with NS2
Working with NS2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Ns2 introduction 2
Ns2 introduction 2Ns2 introduction 2
Ns2 introduction 2
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
 
ns2-lecture.ppt
ns2-lecture.pptns2-lecture.ppt
ns2-lecture.ppt
 
Ns tutorial
Ns tutorialNs tutorial
Ns tutorial
 
Extending ns
Extending nsExtending ns
Extending ns
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt II
 
~Ns2~
~Ns2~~Ns2~
~Ns2~
 
Code from LPW 2012 Template::Toolkit Workshop
Code from LPW 2012 Template::Toolkit WorkshopCode from LPW 2012 Template::Toolkit Workshop
Code from LPW 2012 Template::Toolkit Workshop
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Network Simulator Tutorial
Network Simulator TutorialNetwork Simulator Tutorial
Network Simulator Tutorial
 
Workshop on command line tools - day 2
Workshop on command line tools - day 2Workshop on command line tools - day 2
Workshop on command line tools - day 2
 

More from Jean Pimentel (12)

Segurança em P2P
Segurança em P2PSegurança em P2P
Segurança em P2P
 
Introdução ao P2P
Introdução ao P2PIntrodução ao P2P
Introdução ao P2P
 
Multimídia - Imagens
Multimídia - ImagensMultimídia - Imagens
Multimídia - Imagens
 
Fluxo MPEG
Fluxo MPEGFluxo MPEG
Fluxo MPEG
 
Snort
SnortSnort
Snort
 
Sistemas Imunológicos Artificiais
Sistemas Imunológicos ArtificiaisSistemas Imunológicos Artificiais
Sistemas Imunológicos Artificiais
 
AIX - Sistemas de Arquivos
AIX - Sistemas de ArquivosAIX - Sistemas de Arquivos
AIX - Sistemas de Arquivos
 
AIX - Gerência de Memória
AIX - Gerência de MemóriaAIX - Gerência de Memória
AIX - Gerência de Memória
 
Windows Mobile
Windows MobileWindows Mobile
Windows Mobile
 
RIP - Routing Information Protocol
RIP - Routing Information ProtocolRIP - Routing Information Protocol
RIP - Routing Information Protocol
 
Redes Mesh - Protocolos de Roteamento
Redes Mesh - Protocolos de RoteamentoRedes Mesh - Protocolos de Roteamento
Redes Mesh - Protocolos de Roteamento
 
Redes Mesh - Introdução
Redes Mesh - IntroduçãoRedes Mesh - Introdução
Redes Mesh - Introdução
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

Loss Monitor

  • 1. Jean Fellipe de Almeida Pimentel Túlio César Faria Pinto
  • 2.
  • 3. Usado para monitorar números de pacotes transferidos, bem como pacotes perdidos.  Pode ser usado com uma função chamada a cada X segundos e assim obter o throughput.
  • 4. A classe Agent tem os seguintes atributos: addr_ Endereço de origem dst_ Endereço de destino size_ Tamanho do pacote em bytes type_ Tipo do pacote fid_ Identificador de fluxo prio_ Prioridade flags_ Flags defttl_ TTL padrão
  • 5. A classe LossMonitor herda as funcionalidades de Agent  Seus próprios atributos são: nlost_ Número de pacotes perdidos npkts_ Número de pacotes recebidos bytes_ Número de bytes recebidos lastPktTime_ Hora do último pacote recebido expected_ Número de sequência esperado para o próximo pacote
  • 6. set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node] $ns duplex-link $n0 $n3 1Mb 100ms DropTail $ns duplex-link $n1 $n3 1Mb 100ms DropTail $ns duplex-link $n2 $n3 1Mb 100ms DropTail $ns duplex-link $n3 $n4 1Mb 100ms DropTail
  • 7. proc attach-expoo-traffic { node sink size burst idle rate } { set ns [Simulator instance] set source [new Agent/UDP] $ns attach-agent $node $source set traffic [new Application/Traffic/Exponential] $traffic set packet-size $size $traffic set burst-time $burst $traffic set idle-time $idle $traffic set rate $rate $traffic attach-agent $source $ns connect $source $sink return $traffic }
  • 8. set sink0 [new Agent/LossMonitor] set sink1 [new Agent/LossMonitor] set sink2 [new Agent/LossMonitor] $ns attach-agent $n4 $sink0 $ns attach-agent $n4 $sink1 $ns attach-agent $n4 $sink2 set source0 [attach-expoo-traffic $n0 $sink0 200 2s 1s 100k] set source1 [attach-expoo-traffic $n1 $sink1 200 2s 1s 200k] set source2 [attach-expoo-traffic $n2 $sink2 200 2s 1s 300k]
  • 9. set f0 [open out0.tr w] set f1 [open out1.tr w] set f2 [open out2.tr w] proc finish {} { global f0 f1 f2 close $f0 close $f1 close $f2 exec xgraph out0.tr out1.tr out2.tr -geometry 800x400 & exit 0 }
  • 10. proc record {} { global sink0 sink1 sink2 f0 f1 f2 set ns [Simulator instance] set time 0.5 set bw0 [$sink0 set bytes_]; set bw1 [$sink1 set bytes_]; set bw2 [$sink2 set bytes_]; set now [$ns now] puts $f0 "$now [expr $bw0/$time*8/1000000]" puts $f1 "$now [expr $bw1/$time*8/1000000]" puts $f2 "$now [expr $bw2/$time*8/1000000]" $sink0 set bytes_ 0; $sink1 set bytes_ 0; $sink2 set bytes_ 0; $ns at [expr $now+$time] "record" }
  • 11. $ns at 0.0 "record" $ns at 1.0 "$source0 start” $ns at 1.0 "$source1 start" $ns at 1.0 "$source2 start" $ns at 5.0 "$source0 stop" $ns at 5.0 "$source1 stop" $ns at 5.0 "$source2 stop" $ns at 6.0 "finish" $ns run
  • 12.
  • 13. Bibliografia:  LossMonitor Class Reference http://www.auto-nomos.de/ns2doku/class_loss_monitor.html  NS Manual www.isi.edu/nsnam/ns/doc/ns_doc.pdf  Network Simulator – Visão Geral da Ferramenta de Simulação de Redes http://www.cis.udel.edu/~portnoi/articles/networksimulator-sepa.pdf