Search This Blog

[ns-3] TraceMetrics: A trace file analyzer for ns-3

Labels: , , ,

TraceMetrics, developed in Java, is an open source trace file analyzer for analyzing the trace files (.tr) of ns-3 [1]. TraceMetrics does not require installation! You just need to have Java installed on your machine to use it.

Prerequisites for working with TraceMetrics: JDK 7 must be installed on your machine.

Command to install JDK 7 on Ubuntu OS is:

sudo apt-get install openjdk-7-jdk

Before we proceed to work with TraceMetrics, it is important that we have a ns-3 trace file which we can analyze with TraceMetrics. To get the ns-3 trace file, follow any one of the three options given below:

Option 1: If you have already installed ns-3, follow the steps given below:

1. Copy the file named

tcp-bulk-send.cc 

from this directory: ns-allinone-3.xx/ns-3.xx/examples/tcp

and paste it into the following directory: ns-allinone-3.xx/ns-3.xx/scratch

2. Go to ns-allinone-3.xx/ns-3.xx via terminal and give the following command to run tcp-bulk-send.cc

./waf --run "scratch/tcp-bulk-send --tracing=true"

3. If the above mentioned command is successful, search for a file named "tcp-bulk-send.tr" in your ns-allinone-3.xx/ns-3.xx directory.

If you find "tcp-bulk-send.tr", then your trace file is ready for analysis. "tcp-bulk-send.tr" is the trace file which will be analyzed by TraceMetrics.

You may Skip Option 2 and Option 3 and directly read "How to use TraceMetrics" Section!

Option 2: If you have not yet installed ns-3, follow the steps given below:

1. Install ns-3. I have written a separate post for installation of ns-3. Here is the link:


2. After successfully installing ns-3, follow the steps given in "Option 1" of this post.

Option 3: If you just want to see how TraceMetrics works and would like to generate your trace files at a later point, just download the "tcp-bulk-send.tr" from the link given below:

Download tcp-bulk-send.tr

How to use TraceMetrics

Follow the steps given below to start analyzing "tcp-bulk-send.tr" by using TraceMetrics:

1. Download TraceMetrics from the following link:


2. Unzip the downloaded file i.e., tracemetrics-1.3.0.zip.

3. Go in the extracted folder i.e., tracemetrics and open the file named "tracemetrics.jar". You should see tracemetrics loading like shown in the Image below:

[Click on the Image to enlarge]

and then the following window should open:

[Click on the Image to enlarge]

4. Select File -> Choose File and then navigate to the folder where you stored "tcp-bulk-send.tr". Select "tcp-bulk-send.tr"

5. The next window that appears will look like the Image shown below:

[Click on the Image to enlarge]

6. Click on "Execute analysis" button on the bottom right corner.

You are done with it!

NOTE: A wonderful tutorial on how to analyze the parameters is provided by the developers of TraceMetrics. You can download it from the following link:


References:

[1] TraceMetrics Official Webpage: http://www.tracemetrics.net/

Hope it helps.

Best Regards,
Mohit P. Tahiliani

Comments (4)

Hi Mohit,

Please assist in explaining the first three rows especially after 1000 bytes. I am not show what 0's mean until to the end of the row.
MAC level and IP level information???

This is a trace file on NS2. Please email me on hans.medupe@gmail.com

s 1.000000000 _0_ AGT --- 0 cbr 1000 [0 0 0 0] ------- [0:0 3:0 32 0] [0] 0 0
r 1.000000000 _0_ RTR --- 0 cbr 1000 [0 0 0 0] ------- [0:0 3:0 32 0] [0] 0 0
s 1.000000000 _0_ RTR --- 0 AODV 48 [0 0 0 0] ------- [0:255 -1:255 30 0] [0x2 1 1 [3 0] [0 4]] (REQUEST)
r 1.001408374 _4_ RTR --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [3 0] [0 4]] (REQUEST)
r 1.001408667 _1_ RTR --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [3 0] [0 4]] (REQUEST)
s 1.001550421 _4_ RTR --- 0 AODV 48 [0 ffffffff 0 800] ------- [4:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
s 1.002289893 _1_ RTR --- 0 AODV 48 [0 ffffffff 0 800] ------- [1:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
r 1.002818795 _0_ RTR --- 0 AODV 48 [0 ffffffff 4 800] ------- [4:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
r 1.002818798 _1_ RTR --- 0 AODV 48 [0 ffffffff 4 800] ------- [4:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
r 1.003717175 _4_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
r 1.003717465 _2_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
r 1.003717465 _0_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 29 0] [0x2 2 1 [3 0] [0 4]] (REQUEST)
s 1.006063482 _2_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [2:255 -1:255 28 0] [0x2 3 1 [3 0] [0 4]] (REQUEST)
r 1.007371858 _5_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 28 0] [0x2 3 1 [3 0] [0 4]] (REQUEST)
s 1.007371858 _5_ RTR --- 0 AODV 44 [0 0 0 0] ------- [5:255 0:255 30 2] [0x4 1 [3 4] 10.000000] (REPLY)

by analysing tr files using trace metrics,the received packets are more than the sent ones. I generated them for the aodv.cc code which is in the examples. How is it possible?

Hi sir,
May i get any document or any source link for the explaination of the aodv.cc and csma.cc code and how to run their trace file and analysis of it in ns3. Kindly provide the information asap.
Thank you
Regards,
Shrishti

hi sir,
i am running my code in tracemetrics but the total execution time is getting increased continuously, even more than 24 hrs.
is it an usual time what it takes to execute or i am doing something wrong?

Please help me out

Regards
Anjali