Linux oprofile命令

來源:互聯網
上載者:User

Linux oprofile命令
一、簡介 oProfile是Linux平台上的一個功能強大的效能分析工具,支援兩種採樣(sampling)方式:基於事件的採樣(eventbased)和基於時間的採樣(timebased),它可以工作在不同的體繫結構上,包括MIPS、ARM、IA32、IA64和AMD。   二、安裝 1)開啟核心OPROFILE選項,否則運行oProfile將提示: [root@localhost oprofile-0.9.6]# opcontrol --init FATAL: Module oprofile not found. FATAL: Module oprofile not found. Kernel doesn't support oprofile2)編輯核心設定檔:.config,將其中的# CONFIG_OPROFILE is not set改為CONFIG_OPROFILE=m(或者y)[root@localhost ~]# cd /usr/src/linux-2.6.37.2 [root@localhost linux-2.6.37.2]# vi .config如下: CONFIG_PROFILING=y CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y CONFIG_PCI_IOAPIC=y3)編譯核心並重啟機器 http://www.linuxidc.com/Linux/2014-10/108768.htm4)下載源碼,編譯安裝  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 install   三、工具集  ophelp:    列出所有支援的事件。opcontrol:  設定需要收集的事件。opreport:   對結果進行統計輸出。opannaotate:產生帶注釋的源/彙編檔案,源語言級的注釋需要編譯源檔案時的支援。opstack:     產生調用圖profile,但要求x86/2.6的平台,並且linux2.6安裝了call-graph patchopgprof:     產生如gprof相似的結果。oparchive:   將所有的未經處理資料檔案收集打包,可以到另一台機器上進行分析。op_import:   將採樣的資料庫檔案從另一種abi轉化成本地格式。   四、使用步驟 1)啟動檢測 modprobe oprofile timer=1 opcontrol --no-vmlinuxopcontrol --separate=kernelopcontrol --init opcontrol --reset opcontrol –start2)運行程式 運行測試程式3)停止檢測 opcontrol --dumpopcontrol --stopopcontrol --shutdownopcontrol --deinit4)檢測結果 opreportopreport -l ./testopannotate --source ./test

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.