1. Make sure your kernel is compiled with OProfile support (CONFIG_OPROFILE=y, CONFIG_HAVE_OPROFILE=y)
  2. If you want to profile the kernel, have the vmlinux binary ready
  3. If you want to profile a native application, compile it with debug symbols (-g)
  4. After system has loaded, execute once: “opcontrol –setup –event=CPU_CYCLES:50000″
    If you also want to profile the kernel, add the params “–vmlinux=full-path-to-your-vmlinux-file-on-target
    (use your toolchain’s objdump to find the relevant addresses)
  5. Before beginning the profiling, execute on the target: “opcontrol –reset”
  6. To begin profiling, execute: “opcontrol –start”
  7. During profiling, you might want to make sure that samples are being collected: “opcontrol –status”
  8. Stop profiling by executing: “opcontrol –stop”
  9. On your host: cd mydroid/external/oprofile
  10. On your host, execute: “./opimport_pull result_folder” (imports the
    samples collected from the target, saves them in a newly created folder
    and prints a basic report)
  11. On your host, execute: “cd mydroid/prebuilt/linux-x86/oprofile/bin”
  12. To get an annotated report, execute: “./opannotate -p

    -s -d <path-to-source-files-e.g.-mydroid> –session-dir=path-to-your-samples-dir”
  13. To get a simple report, execute: “./opreport -g -l -p <same-path-like-before> –session-dir=path-to-your-samples-dir”