Skip to content

Instantly share code, notes, and snippets.

@kay21s
Last active August 29, 2015 14:06
Show Gist options
  • Save kay21s/ba792f4993a45aa48411 to your computer and use it in GitHub Desktop.
Save kay21s/ba792f4993a45aa48411 to your computer and use it in GitHub Desktop.
OProfile
sudo opcontrol --init
sudo opcontrol --vmlinux=/boot/vmlinuz-'uname -r'
OR uname -r ==> 3.13.0-35-generic
sudo opcontrol --vmlinux=/boot/vmlinuz-3.13.0-35-generic
sudo operf --event=CPU_CLK_UNHALTED:100000
OR sudo opcontrol --event=CPU_CLK_UNHALTED:100000
operf --event=CPU_CLK_UNHALTED:100000 --event=LLC_MISSES:100000 ./build/megakv
opcontrol --list-events
Measure cache miss: LLC_MISSES/LLC_REFS
/* opcontrol discouraged */
sudo opcontrol --start
sudo opcontrol --stop
sudo opcontrol --reset
sudo opcontrol --dump
/* use operf instead */
operf ./my_app args...
sudo opreport
# opreport -l /path/to/mybinary
opreport -l ./build/megakv
# opannotate --source --output-dir=[any name] /path/to/mybinary
# [any name] is the directory name to be created under current directory,
# stores the annotated source file.
opannotate --source --output-dir=abc ./build/megakv
调试kernel,要先链接一下
ln -s /home/kay/git.tenKernPktgen/pktgen4Nehalem8/pktgen_pcap_6.ko /pktgen_pcap_6
再opannotate
opannotate --source --output-dir=/home/kay/new /pktgen_pcap_6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment