HOWTO use oprofile

From Nsnam
Revision as of 18:12, 29 August 2012 by Tomh (Talk | contribs) (oprofile example)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Main Page - Current Development - Developer FAQ - Tools - Related Projects - Project Ideas - Summer Projects

Installation - Troubleshooting - User FAQ - HOWTOs - Samples - Models - Education - Contributed Code - Papers

This is a brief HOWTO on using oprofile to statistically sample the execution performance of an ns-3 program.


Please read this tutorial on oprofile:

There are several open source profilers, including gprof, oprofile, sysprof, and valgrind. This HOWTO focuses on oprofile, which is a good tool for ns-3 because ns-3 programs are logic-heavy with lots of small functions and templates, and therefore a statistical profiler such as oprofile is more relevant than a profile that counts instructions such as gprof or valgrind.


oprofile is available as a package on Linux distros (e.g. 'yum install oprofile').

First, it is strongly recommended to build ns-3 as optimized code before profiling.

 ./waf configure -d optimized --enable-examples --enable-static

Second, you will need to run as root. Third you will want to run the program outside of waf, which may require you to set the LD_LIBRARY_PATH variable to find the ns-3 libraries.

 # opcontrol --deinit
 # opcontrol --no-vmlinux
 # opcontrol --separate=kernel
 # opcontrol --init
 # opcontrol --reset
 # opcontrol --start
 # ./test-program
 # opcontrol --stop
 # opreport -l ./test-program