ubuntu使用perf分析CPU占用率高的原因


1.安裝perf工具

命令:

apt-get install linux-tools-common
apt-get install  linux-tools-4.15.0-48-generic

apt-get install perf 

2.啟動被測服務

命令:./server_linux

3.測試服務是否啟動成功(開第二個終端)

命令:curl http://localhost:12306/perf_issue

如圖顯示啟動成功:

4.壓被測服務

命令:wrk -d100s -c100 -t10 http://localhost:12306/perf_issue

結果如圖:

qps=28.46

5.繼續壓測,打開第三個終端

使用命令:perf  top

可以看出被測服務server_linux很忙。

使用上下鍵選擇server_linux按兩下Enter鍵,如圖:

可以看出大量時間消耗在addsd命令上。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM