TubeTK/Code Optimization in Linux: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
The following script demonstrates profiling on linux using oprofile
The following script demonstrates profiling on linux using oprofile
* OProfile Web Page: http://oprofile.sourceforge.net/about/
* OProfile Web Page: http://oprofile.sourceforge.net/about/
* In order to see see function names, you need to install the debug symbol packages. To see callgraphs, you also need to recompile the software with frame pointers (-fno-omit-frame-pointer) before profiling them with oprofile.
* You can download the following script from this link: [[file:TubeTK_OProfileExampleScript.txt‎ | TubeTK_OProfileExampleScript.txt‎]]
* You can download the following script from this link: [[file:TubeTK_OProfileExampleScript.txt‎ | TubeTK_OProfileExampleScript.txt‎]]



Revision as of 02:07, 15 August 2011

The following script demonstrates profiling on linux using oprofile


#! /bin/bash

# notes:
# opcontrol: controls data collection
# opreport: retrieves profile data
# opannotate: produce notated source code

# configure
opcontrol --no-vmlinux
opcontrol --callgraph=6
#opcontrol --event=CPU_CLK_UNHALTED:100000:0:1:1
#opcontrol --event=CPU_CLK_UNHALTED:1000:0:1:1
opcontrol --event=default

# TODO: could potentially increase count = number of samples to take

# start opcontrol
opcontrol --reset
opcontrol --start

# run the test
/home/dpace/TubeTKRepo/daniellepace-tubetk-debug/TubeTK-Build/lib/TubeTK/Plugins/tubeAnisotropicDiffusiveDeformableRegistration /home/dpace/TubeTKRepo/daniellepace-tubetk/Data/tubeAnisotropicDiffusiveSphereRegistration_origFixedImage.mhd /home/dpace/TubeTKRepo/daniellepace-tubetk/Data/tubeAnisotropicDiffusiveSphereRegistration_origMovingImage.mhd -n /home/dpace/TubeTKRepo/daniellepace-tubetk/Data/tubeAnisotropicDiffusiveSphereRegistration_normalVectorImage.mhd -w /home/dpace/TubeTKRepo/daniellepace-tubetk/Data/tubeAnisotropicDiffusiveSphereRegistration_weightImage.mhd -d /home/dpace/TubeTKRepo/daniellepace-tubetk-debug/TubeTK-Build/Temporary/tubeAnisotropicDiffusiveSphereRegistration_anisotropic_resultingMotionField.mhd -o /home/dpace/TubeTKRepo/daniellepace-tubetk-debug/TubeTK-Build/Temporary/tubeAnisotropicDiffusiveSphereRegistration_anisotropic_transformedMovingImage.mhd -i 500 -s 0.125 -l -0.1 > anisotropicTestOutput.txt

# dump the profiler results
opcontrol --dump

opcontrol --stop

# get the report

# Get an overview report of all images - not super helpful, but might as well save it out
opreport > completeOverview.txt

# Get a report on the samples for all individual binary images (libraries + applications) used by the tubeAnisotropicDiffusiveDeformableRegistration image
opreport image:/home/dpace/TubeTKRepo/daniellepace-tubetk-debug/TubeTK-Build/lib/TubeTK/Plugins/tubeAnisotropicDiffusiveDeformableRegistration > anisotropicOverview.txt

# Get a symbol report for the tubeAnisotropicDiffusiveDeformableRegistration image
opreport -l image:/home/dpace/TubeTKRepo/daniellepace-tubetk-debug/TubeTK-Build/lib/TubeTK/Plugins/tubeAnisotropicDiffusiveDeformableRegistration --demangle smart --debug-info > anisotropicSymbols.txt

# Get code annotations
opannotate --source --output-dir=annotated --demangle smart

# Get callgraph information
opreport -l image:/home/dpace/TubeTKRepo/daniellepace-tubetk-debug/TubeTK-Build/lib/TubeTK/Plugins/tubeAnisotropicDiffusiveDeformableRegistration --demangle smart --callgraph > callgraph.txt

# TODO oparchive for comparison to changed code

# stop the profiler
opcontrol --shutdown