如何应用SystemTap下的latencytop.stp脚本
1、 确定linux版本(必须使用root权限)
[root@BL480-64 ~]#uname –a
Linux BL480-64 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
2、 建议使用系统自带版本stap version 1.3
[root@BL480-64 ~]#/usr/bin/stap –V
SystemTap translator/driver (version 1.3/0.148 non-git sources)
Copyright (C) 2005-2010 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS BOOST_SHARED_PTR TR1_UNORDERED_MAP
[root@BL480-64~]# stap -vg -DSTP_NO_OVERLOAD --all-modules -DMAXSKIPPED=1024 ./ latencytap.stp
Pass 1: parsed user script and 144 library script(s) using 105616virt/39624res/2692shr kb, in 470usr/100sys/565real ms.
Pass 2: analyzed script: 9 probe(s), 17 function(s), 4 embed(s), 8 global(s) using 183132virt/58120res/4380shr kb, in 410usr/380sys/823real ms.
Pass 3: using cached /root/.systemtap/cache/8f/stap_8f7ffae0211f5d045d375ce14e89b0d9_21661.c
Pass 4: using cached /root/.systemtap/cache/8f/stap_8f7ffae0211f5d045d375ce14e89b0d9_21661.ko
Pass 5: starting run.
启动后,提示界面:
Reason Count Average(us) Maximum(us) Percent%
2917 20368 145655 6%
30 1884151 2010205 6%
46 1217661 3429048 6%
Waiting for event (select) 34 1590935 5000083 5%
Application requested delay 119 250974 251953 3%
2983 9978 10949 3%
Waiting for event (poll) 148 201075 265377 3%
Application requested delay 158 188327 201952 3%
Waiting for event (poll) 119 249969 250944 3%
Waiting for event (poll) 59 499925 499993 3%
Waiting for event (poll) 59 499901 500003 3%
Application requested delay 29 1002374 1030263 3%
Application requested delay 29 1000997 1001549 3%
Waiting for event (poll) 29 999878 999994 3%
Waiting for event (select) 29 999854 999880 3%
Waiting for event (poll) 29 999849 1000012 3%
Waiting for event (select) 29 999829 1000683 3%
Application requested delay 14 2001029 2001963 3%
Waiting for event (select) 27 999880 1000950 2%
Waking ksoftirqd 1 26023466 26023466 2%
完成以上所有操作即可马上应用了o(∩_∩)o…哈哈,简单吧。
latencytop.stp脚本如下:
3、 Latencytap.stp脚本执行