工作環境是suse11sp3系統(內核版本3.0.101-0.47.90-default),需要通過perf排查系統性能問題,但是預設是沒有perf工具的。 在網上搜索了一下,需要linux-tools工具包,幸好手上有SUSE11sp3 ISO文件,直接在ISO的suse/x86_64目錄下 找到 ...
工作環境是suse11sp3系統(內核版本3.0.101-0.47.90-default),需要通過perf排查系統性能問題,但是預設是沒有perf工具的。
在網上搜索了一下,需要linux-tools工具包,幸好手上有SUSE11sp3 ISO文件,直接在ISO的suse/x86_64目錄下
找到了perf-3.0.76-2.10.31.x86_64.rpm 安裝包。
嘗試安裝了一下,報錯:
# rpm -ivh perf-3.0.76-2.10.31.x86_64.rpm
error: Failed dependencies:
libnewt.so.0.52()(64bit) is needed by perf-3.0.76-2.10.31.x86_64
libnewt.so.0.52(NEWT_0.52)(64bit) is needed by perf-3.0.76-2.10.31.x86_64
libslang.so.2()(64bit) is needed by perf-3.0.76-2.10.31.x86_64
libslang.so.2(SLANG2)(64bit) is needed by perf-3.0.76-2.10.31.x86_64
繼續在網上搜索libnewt相關的軟體包(關鍵詞: libnewt which package),找到如下鏈接:
http://www.linuxfromscratch.org/blfs/view/svn/general/newt.html
註意閱讀該網頁信息,newt依賴於popt和slang,這兩個package必須先按照,否則newt編譯出錯。
slang and popt URL:
http://www.linuxfromscratch.org/blfs/view/svn/general/slang.html
http://www.linuxfromscratch.org/blfs/view/svn/general/popt.html
popt、slang和newt的編譯和安裝過程不再贅述,網頁上都有詳細說明。
安裝了libnewt和libslang後還是報錯,檢查了系統LD_LIBRARY_PATH,路徑都正確,而且檢查有相關lib文件:
# ll /usr/local/lib/libnewt.so
lrwxrwxrwx 1 root root 15 Dec 26 19:37 /usr/local/lib/libnewt.so -> libnewt.so.0.52
# ll /usr/local/lib/libslang.so
lrwxrwxrwx 1 root root 13 Dec 26 19:36 /usr/local/lib/libslang.so -> libslang.so.2
# echo $LD_LIBRARY_PATH
/usr/lib:/usr/local/lib:/usr/lib64:/lib:/lib64:/usr/local/lib64:/home/zxagent/lib/usr/lib64:/lib:/lib64:/usr/local/lib64
實在沒轍了,直接強行安裝perf:
rpm -ivh perf-3.0.76-2.10.31.x86_64.rpm --nodeps
安裝完成後,檢查perf是否成功:
# which perf
/usr/bin/perf
執行perf命令:
perf top -e cycles:k
PerfTop: 1612 irqs/sec kernel:99.9% us: 0.1% guest kernel: 0.0% guest us: 0.0% exact: 0.0% [1000Hz cycles], (all, 32 CPUs)
--------------------------------------------------------------------------------------------------------------------------------------------
samples pcnt function DSO
_______ _____ _________________________ __________________________________________________
8773.00 55.6% intel_idle /lib/modules/3.0.101-0.47.90-default/build/vmlinux
1356.00 8.6% find_busiest_group /lib/modules/3.0.101-0.47.90-default/build/vmlinux
267.00 1.7% __schedule /lib/modules/3.0.101-0.47.90-default/build/vmlinux
258.00 1.6% _raw_spin_lock /lib/modules/3.0.101-0.47.90-default/build/vmlinux
209.00 1.3% cpumask_next_and /lib/modules/3.0.101-0.47.90-default/build/vmlinux
179.00 1.1% find_next_bit /lib/modules/3.0.101-0.47.90-default/build/vmlinux
136.00 0.9% cpuidle_idle_call /lib/modules/3.0.101-0.47.90-default/build/vmlinux
123.00 0.8% native_write_msr_safe /lib/modules/3.0.101-0.47.90-default/build/vmlinux
110.00 0.7% menu_select /lib/modules/3.0.101-0.47.90-default/build/vmlinux
106.00 0.7% apic_timer_interrupt /lib/modules/3.0.101-0.47.90-default/build/vmlinux
105.00 0.7% tick_nohz_stop_sched_tick /lib/modules/3.0.101-0.47.90-default/build/vmlinux
105.00 0.7% cpupri_set /lib/modules/3.0.101-0.47.90-default/build/vmlinux
98.00 0.6% update_curr_rt /lib/modules/3.0.101-0.47.90-default/build/vmlinux
97.00 0.6% load_balance /lib/modules/3.0.101-0.47.90-default/build/vmlinux
87.00 0.6% __hrtimer_start_range_ns /lib/modules/3.0.101-0.47.90-default/build/vmlinux
86.00 0.5% select_nohz_load_balancer /lib/modules/3.0.101-0.47.90-default/build/vmlinux
82.00 0.5% leave_mm /lib/modules/3.0.101-0.47.90-default/build/vmlinux
74.00 0.5% __switch_to /lib/modules/3.0.101-0.47.90-default/build/vmlinux
73.00 0.5% idle_balance /lib/modules/3.0.101-0.47.90-default/build/vmlinux
73.00 0.5% getnstimeofday /lib/modules/3.0.101-0.47.90-default/build/vmlinux
72.00 0.5% timerqueue_add /lib/modules/3.0.101-0.47.90-default/build/vmlinux
71.00 0.4% read_tsc /lib/modules/3.0.101-0.47.90-default/build/vmlinux
69.00 0.4% do_select /lib/modules/3.0.101-0.47.90-default/build/vmlinux
69.00 0.4% hrtimer_interrupt /lib/modules/3.0.101-0.47.90-default/build/vmlinux
67.00 0.4% core_sys_select /lib/modules/3.0.101-0.47.90-default/build/vmlinux
perf可用,也算安裝成功了!
PS:
您的支持是對博主最大的鼓勵