1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | global syscalllist probe begin { printf("System Call Monitoring Started (10 seconds)...\n") } probe syscall.* { syscalllist[pid(), execname()]++ } probe timer.ms(10000) { foreach ( [pid, procname] in syscalllist ) { printf("%s[%d] = %d\n", procname, pid, syscalllist[pid, procname] ) } exit() } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | $ sudo stap profile.stp System Call Monitoring Started (10 seconds)... stapio[16208] = 104 gnome-terminal[6416] = 196 Xorg[5525] = 90 vmware-guestd[5307] = 764 hald-addon-stor[4969] = 30 hald-addon-stor[4988] = 15 update-notifier[6204] = 10 munin-node[5925] = 5 gnome-panel[6190] = 33 ntpd[5830] = 20 pulseaudio[6152] = 25 miniserv.pl[5859] = 10 syslogd[4513] = 5 gnome-power-man[6215] = 4 gconfd-2[6157] = 5 hald[4877] = 3 $ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | global syscalllist probe begin { printf("Syslog Monitoring Started (10 seconds)...\n") } probe syscall.* { if (execname() == "syslogd") { syscalllist[name]++ } } probe timer.ms(10000) { foreach ( name in syscalllist ) { printf("%s = %d\n", name, syscalllist[name] ) } exit() } |
1 2 3 4 5 6 | $ sudo stap syslog_profile.stp Syslog Monitoring Started (10 seconds)... writev = 3 rt_sigprocmask = 1 select = 1 $ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | global recv, xmit probe begin { printf("Starting network capture (Ctl-C to end)\n") } probe netdev.receive { recv[dev_name, pid(), execname()] <<< length } probe netdev.transmit { xmit[dev_name, pid(), execname()] <<< length } probe end { printf("\nEnd Capture\n\n") printf("Iface Process........ PID.. RcvPktCnt XmtPktCnt\n") foreach ([dev, pid, name] in recv) { recvcount = @count(recv[dev, pid, name]) xmitcount = @count(xmit[dev, pid, name]) printf( "%5s %-15s %-5d %9d %9d\n", dev, name, pid, recvcount, xmitcount ) } delete recv delete xmit } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $ sudo stap net.stp Starting network capture (Ctl-C to end) ^C End Capture Iface Process........ PID.. RcvPktCnt XmtPktCnt eth0 swapper 0 122 85 eth0 metacity 6171 4 2 eth0 gconfd-2 6157 5 1 eth0 firefox 21424 48 98 eth0 Xorg 5525 36 21 eth0 bash 22860 1 0 eth0 vmware-guestd 5307 1 1 eth0 gnome-screensav 6244 6 3 Pass 5: run completed in 0usr/50sys/37694real ms. $ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | global histogram probe begin { printf("Capturing...\n") } probe netdev.receive { histogram <<< length } probe netdev.transmit { histogram <<< length } probe end { printf( "\n" ) print( @hist_log(histogram) ) } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $ sudo stap nethist.stp Capturing... ^C value |-------------------------------------------------- count 8 | 0 16 | 0 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1601 64 |@ 52 128 |@ 46 256 |@@@@ 164 512 |@@@ 140 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2033 2048 | 0 4096 | 0 $ |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |