Computation time calculation

52 views
Skip to first unread message

Saurabh

unread,
Jul 15, 2024, 11:51:01 AM (7 days ago) Jul 15
to ns-3-users
Hi All,

I have .tr file available with me for a ns3 simulation but unable to calculate computation time for the same. Please help

Tommaso Pecorella

unread,
Jul 15, 2024, 8:13:16 PM (6 days ago) Jul 15
to ns-3-users
Please elaborate.

Saurabh

unread,
Jul 16, 2024, 11:40:13 AM (6 days ago) Jul 16
to ns-3-users
Dear Sir,

After executing a particular ns3 .cc file, I want to know how much computation time it takes for complete execution. 
Is there any command that can be used within the .cc file or after the execution of the same file to know the value mentioned above?

Regards

Tommaso Pecorella

unread,
Jul 16, 2024, 1:43:01 PM (6 days ago) Jul 16
to ns-3-users
The time required by your simulation can be measured in various ways.
The simplest one is to just use the unix's "time" command (https://en.wikipedia.org/wiki/Time_(Unix)).
Alternatively, you can add some code in the script to measure the time required to execute the run (see for example this post).
If you need it for performance measuring (e.g., to optimise your code), check the ns-3 manual about profiling.

Saurabh

unread,
Jul 21, 2024, 8:11:31 AM (23 hours ago) Jul 21
to ns-3-users
Dear Sir,

Thanks a ton for your guidance.
One another thing would like to seek your guidance on how to check the initial energy level of a node in the .cc file and how to check the energy level of a node after some simulation has been executed. This is just to check how much energy of a node got depleted during the process.

Please Guide...

Regards

Tommaso Pecorella

unread,
Jul 21, 2024, 10:01:53 AM (21 hours ago) Jul 21
to ns-3-users
No need to guide you. There are plenty of examples - in the "examples" directory.
Please - please - don't tell me you need guidance to find "examples/energy"

Reply all
Reply to author
Forward
0 new messages