Linux oprofile command
I. Introduction oProfile is a powerful performance analysis tool on the Linux platform. It supports two sampling methods: Event-based sampling (eventbased) and time-based sampling, which can work on different architectures, including MIPS, ARM, IA32, IA64, and AMD. 2, installation 1) Open the kernel OPROFILE option, otherwise running oProfile will prompt: [root @ localhost oprofile-0.9.6] # opcontrol -- init FATAL: Module oprofile not found. FATAL: Module oprofile not found. kernel doesn' t support oprofile2) edit the Kernel configuration file :. config, change # CONFIG_OPROFILE is not set to CONFIG_OPROFILE = m (or y) [root @ localhost ~] # Cd/usr/src/linux-2.6.37.2 [root @ localhost linux-2.6.37.2] # vi. CONFIG_PROFILING = y CONFIG_X86_LOCAL_APIC = y CONFIG_X86_IO_APIC = y CONFIG_PCI_IOAPIC = y3) Compile the kernel and restart the machine http://www.linuxidc.com/Linux/2014-10/108768.htm4) download source code, compile and install wget http://cznic.dl.sourceforge.net/project/oprofile/oprofile/oprofile-1.0.0/oprofile-1.0.0.tar.gztar-zxvf oprofile-1.0.0.tar.gzcd oprofile-1.0.0. /configuremakemake ins Tall 3. tool set ophelp: list all supported events. Opcontrol: Set the events to be collected. Opreport: outputs statistical results. Opannaotate: generates source/assembly files with annotations. Source Language-level annotations must be supported when source files are compiled. Opstack: generate the call graph profile, but the x86/2.6 platform is required, and the call-graph patchopgprof is installed in linux2.6: generate results similar to gprof. Oparchive: Collects and packages all raw data files and analyzes them on another machine. Op_import: converts the sampled database files from another abi to the local cost format. 4. Use step 1) Start and check modprobe oprofile timer = 1 opcontrol -- no-vmlinuxopcontrol -- separate = kernelopcontrol -- init opcontrol -- reset opcontrol-start2) to run the test program. 3) stop opcontrol -- dumpopcontrol -- stopopcontrol -- shutdownopcontrol -- deinit4) detection result opreportopreport-l. /testopannotate -- source. /test