HOWTO use oprofile: Difference between revisions

From Nsnam
Jump to navigation Jump to search
Line 28: Line 28:
   # opcontrol --stop
   # opcontrol --stop
   # opreport -l ./test-program
   # opreport -l ./test-program
Note:  You may need to stop the NMI watchdog to free up counter 0 prior to starting. 
If you receive an error on opcontrol-start, try this:
echo "0" | sudo tee /proc/sys/kernel/watchdog 
For more information:
http://smackerelofopinion.blogspot.com/2013/05/getting-started-with-oprofile-on-ubuntu.html


= Example =
= Example =

Revision as of 03:58, 9 February 2015

Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects

HOWTOs - Installation - Troubleshooting - User FAQ - 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.

Background

Please read this tutorial on oprofile: http://ssvb.github.com/2011/08/23/yet-another-oprofile-tutorial.html

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.

Use

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


Note: You may need to stop the NMI watchdog to free up counter 0 prior to starting. If you receive an error on opcontrol-start, try this:

echo "0" | sudo tee /proc/sys/kernel/watchdog

For more information: http://smackerelofopinion.blogspot.com/2013/05/getting-started-with-oprofile-on-ubuntu.html

Example

TBD

Additional references