From 8248283a040f8193c55680ae88f1e82fcaa7542c Mon Sep 17 00:00:00 2001 From: mmason Date: Tue, 24 Apr 2007 23:04:43 +0000 Subject: Added a couple simple syscall example scripts. --- examples/syscalls_by_pid.stp | 28 +++++++++++++++++++++ examples/syscalls_by_pid.txt | 35 ++++++++++++++++++++++++++ examples/syscalls_by_proc.stp | 28 +++++++++++++++++++++ examples/syscalls_by_proc.txt | 58 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100755 examples/syscalls_by_pid.stp create mode 100644 examples/syscalls_by_pid.txt create mode 100755 examples/syscalls_by_proc.stp create mode 100644 examples/syscalls_by_proc.txt (limited to 'examples') diff --git a/examples/syscalls_by_pid.stp b/examples/syscalls_by_pid.stp new file mode 100755 index 00000000..6870f28a --- /dev/null +++ b/examples/syscalls_by_pid.stp @@ -0,0 +1,28 @@ +#! stap + +# Copyright (C) 2006 IBM Corp. +# +# This file is part of systemtap, and is free software. You can +# redistribute it and/or modify it under the terms of the GNU General +# Public License (GPL); either version 2, or (at your option) any +# later version. + +# +# Print the system call count by process ID in descending order. +# + +global syscalls + +probe begin { + print ("Collecting data... Type Ctrl-C to exit and display results\n") +} + +probe syscall.* { + syscalls[pid()]++ +} + +probe end { + printf ("%-10s %-s\n", "#SysCalls", "PID") + foreach (pid in syscalls-) + printf("%-10d %-d\n", syscalls[pid], pid) +} diff --git a/examples/syscalls_by_pid.txt b/examples/syscalls_by_pid.txt new file mode 100644 index 00000000..4943a139 --- /dev/null +++ b/examples/syscalls_by_pid.txt @@ -0,0 +1,35 @@ +# stap syscalls_by_pid.stp +Collecting data... Type Ctrl-C to exit and display results +^C +#SysCalls PID +2293 31866 +765 31081 +567 30983 +557 30965 +554 31008 +523 30985 +273 30991 +118 9585 +115 2130 +77 30928 +65 1988 +50 31006 +42 2492 +40 31077 +36 2487 +35 2490 +23 2257 +22 2366 +20 8682 +20 2048 +17 31197 +16 31067 +14 2313 +10 31011 +8 1 +5 31074 +3 1978 +3 1975 +3 2467 +3 30932 + diff --git a/examples/syscalls_by_proc.stp b/examples/syscalls_by_proc.stp new file mode 100755 index 00000000..b28d4553 --- /dev/null +++ b/examples/syscalls_by_proc.stp @@ -0,0 +1,28 @@ +#! stap + +# Copyright (C) 2006 IBM Corp. +# +# This file is part of systemtap, and is free software. You can +# redistribute it and/or modify it under the terms of the GNU General +# Public License (GPL); either version 2, or (at your option) any +# later version. + +# +# Print the system call count by process name in descending order. +# + +global syscalls + +probe begin { + print ("Collecting data... Type Ctrl-C to exit and display results\n") +} + +probe syscall.* { + syscalls[execname()]++ +} + +probe end { + printf ("%-10s %-s\n", "#SysCalls", "Process Name") + foreach (proc in syscalls-) + printf("%-10d %-s\n", syscalls[proc], proc) +} diff --git a/examples/syscalls_by_proc.txt b/examples/syscalls_by_proc.txt new file mode 100644 index 00000000..dd554083 --- /dev/null +++ b/examples/syscalls_by_proc.txt @@ -0,0 +1,58 @@ +# stap syscalls_by_proc.stp +Collecting data... Type Ctrl-C to exit and display results +^C +#SysCalls Process Name +53832 make +15275 sh +6764 staprun +2291 gcc +2225 mixer_applet2 +1638 gnome-settings- +1603 gnome-panel +1577 rm +1567 nautilus +1557 trashapplet +1443 cat +1404 sshd +1207 cc1 +779 ls +764 gnome-vfs-daemo +638 bash +610 collect2 +356 mkdir +354 artsd +340 hald-addon-stor +338 hidd +280 ld +260 irqbalance +238 xterm +212 automount +182 sed +176 as +141 dnsdomainname +130 date +129 cmp +124 clock-applet +122 nm-applet +104 grep +88 hostname +75 whoami +70 rpc.idmapd +68 httpd +68 python +61 gam_server +56 pam_timestamp_c +53 wc +49 sendmail +46 echo +40 tail +39 expr +37 uname +35 pam-panel-icon +24 init +17 mapping-daemon +9 syslogd +3 klogd +3 hald +3 gconfd-2 +1 cupsd -- cgit