Tag Archives: energy consumption

[AWK Script] An Awk Script to Print Network Statistics

Image

Hi Folks,

In this post I, shall give u an awk file I wrote that prints several network statistics of interest (these are of course the basic ones cuz i ain’t that good at statistics). Being fed up with lots of awk files floating on the net and most of them don’t work or work on old trace formats of ns-2.34. So I planned to write my own awk script for my simulations.

[ AWK FILE SCRIPT DOWNLOAD]

This awk script i wrote is for 50 nodes and by minor modifications it can be changed to any no. I have used it for 150 nodes. The statistics u can calculate with this file are:

  • Total Packets Sent
  • Total Packets Received
  • Total Packets Dropped
  • Total Packets Forwarded
  • Packet Delivery Ratio %
  • The total hop counts are
  • Average Hop Count
  • Routing Overhead
  • Normalized Routing Load
  • Througphut of the network (KBps)
  • Average End to End Delay
  • Total Energy Consumed
  • Protocol Energy Consumption

Some of these metrics I have calculated using the above shown image. However energy consumption metrics have been calculated by me. When u run this awk script using the command :

awk -f statistics.awk xyz.tr   (xyz.tr is your trace file name)

statistics.awk creates 5 files (which contain info related with each node) in your directory they are:

  • energyleft.txt
  • pktdrop.txt
  • pktfwd.txt
  • pktrecvd.txt
  • pktsent.txt

Note:- This statistics.awk file was made for 50 nodes. However in the awk file i have put comments so as to where u need to make changes in order to run it for any number of nodes.

My view:- I wrote it according to my own logic and understanding however some logic may be wrong or may not be optimal or may be very time consuming. If any suggestions are there for improving this code. Please suggest. Thanks

Let’s support the research community by sharing our code and not hiding it.