diff options
author | fche <fche> | 2006-08-12 05:13:09 +0000 |
---|---|---|
committer | fche <fche> | 2006-08-12 05:13:09 +0000 |
commit | 814bc89d4635f101b2c0077598f31aad95ed15b7 (patch) | |
tree | 407a49dbaf446af4751f5068607a7fb8dad0611d /testsuite/systemtap.samples/topsys.stp | |
parent | 6b6d04673a1ef175821afc7d4fabdb496698e8e3 (diff) | |
download | systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.gz systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.xz systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.zip |
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* configure.ac, Makefile.am: Descend into testsuite/
directory. Remove local test logic.
* configure, Makefile.in: Regenerated.
* runtest.sh: Not yet removed.
* HACKING: Update for new testsuite layout.
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* all: Reorganized old pass-1..4 tests one dejagnu bucket.
Moved over old pass-5 tests, except for disabled syscalls tests.
* Makefile (installcheck): New target for running pass-1..5
tests against installed systemtap.
Diffstat (limited to 'testsuite/systemtap.samples/topsys.stp')
-rw-r--r-- | testsuite/systemtap.samples/topsys.stp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/topsys.stp b/testsuite/systemtap.samples/topsys.stp new file mode 100644 index 00000000..e6e6bb2a --- /dev/null +++ b/testsuite/systemtap.samples/topsys.stp @@ -0,0 +1,69 @@ +#! stap -g +# +# This script continuously lists the top 20 systemcalls in the interval +# of 2000 jiffies. +# + +global syscalls_count, syscalls + +function syscall_name:string () %{ + char *str, buff[80]; + char *tok; + str = buff; + strlcpy(str, CONTEXT->probe_point, sizeof(buff)); + tok = strsep(&str, "\""); + tok = strsep(&str, "@"); + sprintf(str, "%-25s", tok); + strlcpy(THIS->__retvalue, str, MAXSTRINGLEN); +%} + +function reset_maxaction () %{ + if (CONTEXT && CONTEXT->actioncount) + CONTEXT->actioncount=0; +%} + +function accumulate () { + syscall=syscall_name() + syscalls_count[syscall]++ + # I use this array to refer to syscalls_count array in + # the reset_syscalls_count. Initalize with a non-zero. + syscalls[syscall]=1 +} + + +function print_top () { + lcnt=0 + reset_maxaction () + foreach ([syscall] in syscalls_count-) { + sys_cnt = syscalls_count[syscall] + log (syscall . "\t\t\t\t" . sprint(sys_cnt)) + if (lcnt++ == 20) + break; + } + syscalls_count[lsyscall]=0 +} + +function reset_syscalls_count () { + # For some reason, I have to do this to get pass the elaboration + # phase on RHEL4 (seg fault). Under FC4, it works fine with out + # the 'dummy_init' + syscalls["dummy_init"]=0 + foreach ([sys] in syscalls) + syscalls_count[sys]=0 +} + +function print_systop () { + log ("SYSCALL \t\t\t\tCOUNT") + print_top() + reset_syscalls_count () +} + +probe kernel.function("sys_*") { + accumulate () +} + +probe timer.jiffies(2000) { + print_systop () + log("--------------------------------------------------------------") +} + |