diff options
Diffstat (limited to 'testsuite/systemtap.samples')
-rw-r--r-- | testsuite/systemtap.samples/queue_demo.exp | 13 | ||||
-rw-r--r-- | testsuite/systemtap.samples/queue_demo.stp | 32 | ||||
-rw-r--r-- | testsuite/systemtap.samples/tcp_connections.stp | 49 | ||||
-rw-r--r-- | testsuite/systemtap.samples/tcp_connections_wa.stp | 55 | ||||
-rw-r--r-- | testsuite/systemtap.samples/topsys.stp | 69 |
5 files changed, 0 insertions, 218 deletions
diff --git a/testsuite/systemtap.samples/queue_demo.exp b/testsuite/systemtap.samples/queue_demo.exp deleted file mode 100644 index 49dfac05..00000000 --- a/testsuite/systemtap.samples/queue_demo.exp +++ /dev/null @@ -1,13 +0,0 @@ -set test "queue_demo" -if {![installtest_p]} { untested $test; return } - -spawn stap $srcdir/$subdir/queue_demo.stp -set ok 0 -expect { - -timeout 240 - -re {block-[^\r]*} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} - -if {$ok > 4 && $ok < 10} { pass "$test" } { fail "$test" } diff --git a/testsuite/systemtap.samples/queue_demo.stp b/testsuite/systemtap.samples/queue_demo.stp deleted file mode 100644 index 61a3b6d1..00000000 --- a/testsuite/systemtap.samples/queue_demo.stp +++ /dev/null @@ -1,32 +0,0 @@ - -probe begin { - qsq_start ("block-read") - qsq_start ("block-write") -} - -probe timer.ms(3500), end { - qsq_print ("block-read") - qsq_start ("block-read") - qsq_print ("block-write") - qsq_start ("block-write") -} - -probe timer.ms(10000) { exit () } - - -# synthesize queue work/service using three randomized "threads" for each queue. - -global tc -function qs_doit (thread, name) { - n = tc[thread] = (tc[thread]+1) % 3 # per-thread state counter - if (n==1) qs_wait (name) - else if (n==2) qs_run (name) - else if (n==0) qs_done (name) -} - -probe timer.ms(100).randomize(100) { qs_doit (0, "block-read") } -probe timer.ms(100).randomize(100) { qs_doit (1, "block-read") } -probe timer.ms(100).randomize(100) { qs_doit (2, "block-read") } -probe timer.ms(100).randomize(100) { qs_doit (3, "block-write") } -probe timer.ms(100).randomize(100) { qs_doit (4, "block-write") } -probe timer.ms(100).randomize(100) { qs_doit (5, "block-write") } diff --git a/testsuite/systemtap.samples/tcp_connections.stp b/testsuite/systemtap.samples/tcp_connections.stp deleted file mode 100644 index a4449b60..00000000 --- a/testsuite/systemtap.samples/tcp_connections.stp +++ /dev/null @@ -1,49 +0,0 @@ -#! stap - -%{ -#include <linux/version.h> -#include <net/sock.h> -#include <net/tcp.h> - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) -#define LPORT (inet->inet.num) -#define DADDR (&inet->inet.daddr) -#else -#define LPORT (inet->num) -#define DADDR (&inet->daddr) -#endif -%} - -function get_local_port:long(sock) -%{ - unsigned long ptr = (unsigned long) THIS->sock; - - struct inet_sock *inet = (struct inet_sock *) ptr; - THIS->__retvalue = (long long) LPORT; -%} - -function get_ip_source:string(sock) -%{ - unsigned long ptr = (unsigned long) THIS->sock; - struct inet_sock *inet = (struct inet_sock *) ptr; - unsigned char addr[4]; - memcpy(addr, DADDR, sizeof(addr)); - sprintf(THIS->__retvalue, "%d.%d.%d.%d", - addr[0], addr[1], addr[2], addr[3]); - -%} - - -probe begin { - log ("UID\tCMD\t\tPID\t\tPORT\tIP_SOURCE") -} - -probe kernel.function("tcp_accept").return { - sock = $return - if (sock != 0) - log(sprint(uid())."\t". - execname()."\t\t". - sprint(pid())."\t\t ". - sprint(get_local_port(sock))."\t". - get_ip_source(sock)) -} diff --git a/testsuite/systemtap.samples/tcp_connections_wa.stp b/testsuite/systemtap.samples/tcp_connections_wa.stp deleted file mode 100644 index 4c5e2399..00000000 --- a/testsuite/systemtap.samples/tcp_connections_wa.stp +++ /dev/null @@ -1,55 +0,0 @@ -%{ -#include <linux/version.h> -#include <net/sock.h> -#include <net/tcp.h> - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) -#define LPORT (inet->inet.num) -#define DADDR (&inet->inet.daddr) -#else -#define LPORT (inet->num) -#define DADDR (&inet->daddr) -#endif -%} - - -function get_eax:long () %{ - if (CONTEXT && CONTEXT->regs) - THIS->__retvalue = CONTEXT->regs->eax; - else - THIS->__retvalue = 0; -%} - -function get_local_port:long(sock) -%{ - unsigned long ptr = (unsigned long) THIS->sock; - - struct inet_sock *inet = (struct inet_sock *) ptr; - THIS->__retvalue = (long long) LPORT; -%} - -function get_ip_source:string(sock) -%{ - unsigned long ptr = (unsigned long) THIS->sock; - struct inet_sock *inet = (struct inet_sock *) ptr; - unsigned char addr[4]; - memcpy(addr, DADDR, sizeof(addr)); - sprintf(THIS->__retvalue, "%d.%d.%d.%d", - addr[0], addr[1], addr[2], addr[3]); - -%} - -probe begin { - log ("UID\tCMD\t\tPID\t\tPORT\tIP_SOURCE") -} -probe kernel.function("tcp_accept").return { - sock = get_eax() - if (sock != 0) - log(sprint(uid())."\t". - execname()."\t\t". - sprint(pid())."\t\t ". - sprint(get_local_port(sock))."\t". - get_ip_source(sock)) -} - - diff --git a/testsuite/systemtap.samples/topsys.stp b/testsuite/systemtap.samples/topsys.stp deleted file mode 100644 index da31c858..00000000 --- a/testsuite/systemtap.samples/topsys.stp +++ /dev/null @@ -1,69 +0,0 @@ -#! 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_*").call { - accumulate () -} - -probe timer.jiffies(2000) { - print_systop () - log("--------------------------------------------------------------") -} - |