Skip to content
rysto32 edited this page Aug 24, 2016 · 3 revisions

Quick how-to for generating profiles with this tool:

  1. kenv kern.hwpmc.callchaindepth="32"
  • put 'kern.hwpmc.callchaindepth="32"' in /boot/loader.conf to persist this across a reboot
  1. kldload hwpmc
  2. pmcstat -S unhalted-cycles -O samples.out sleep 10
  • Collect samples for 10 seconds
  1. limits -v 4G pmcprofiler -f samples.out -F flame.out
  • Generate flamegraph input
  1. flamegraph.pl < flame.out > flame.svg

Other options to pmcprofiler:

  • -o flat
  • Generate flat (no callchain) output, including a per-instruction view
  • -G leaf
  • Generate text-based callchain output, starting from leaf functions and moving up the stack
  • -r root
  • Generate text-based callchain output, starting from the root of the callchain and moving down the stack
  • -N kernel
  • Specify alternate kernel file (default is $(sysctl kern.bootfile))
  • -m module path
  • Specify alternate module path (default is $(sysctl kern.module_path))
Clone this wiki locally