LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-24-2014, 04:37 PM   #1
nadine01
Member
 
Registered: Oct 2014
Posts: 62

Rep: Reputation: Disabled
packet delivery ratio in awk


hi all,

what is the correct code to calculate packet delivery ratio
Code:
 if($4 == "AGT" && $1 == "s" && seqno < $6) {

   seqno = $6;

  } else if(($4 == "AGT") && ($1 == "r")) {

   receivedPackets++;

   } else if ($1 == "D" && $7 == "cbr" && $8 >= 512){

   droppedPackets++; 

   }

end{

 print "Packet Delivery Ratio = " receivedPackets/(seqno+1)*100 "%";}
or

Code:
# number of s packets
if (level == "AGT" && event == "s" )  {

           sendLine ++ ;

  }
# number of r packets

if (level == "AGT" && event == "r" ){

          recvLine ++ ;

   }

end {

printf "cbr s:%d r:%d, r/s Ratio:%.4f, f:%d \n", sendLine, recvLine, (recvLine/sendLine);}
 
Old 11-25-2014, 12:53 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,841

Rep: Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756
When you make a post, re-read it from the point of view of someone who doesn't know you or what you are working on.
 
  


Reply

Tags
awk-ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to calculate location update cost and packet delivery cost masju Linux - Newbie 0 12-14-2013 04:44 PM
[SOLVED] example for netwrok packet code for creating a module and access the packet data oracle89divi22 Linux - Newbie 13 01-13-2012 05:27 PM
A packet filter using libipq which uses ether type field to capture the packet can26_manish Programming 2 10-16-2007 06:35 AM
how to program IP checking of packet for its delivery cranium2004 Programming 0 05-08-2005 02:46 AM

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

All times are GMT -5. The time now is 06:15 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration