summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.samples
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.samples')
-rw-r--r--testsuite/systemtap.samples/crash.exp45
-rwxr-xr-xtestsuite/systemtap.samples/crash.sh8
-rw-r--r--testsuite/systemtap.samples/iotask.stp44
-rw-r--r--testsuite/systemtap.samples/iotask2.stp42
-rw-r--r--testsuite/systemtap.samples/kmalloc-stacks.stp35
-rwxr-xr-xtestsuite/systemtap.samples/kmalloc-top97
-rw-r--r--testsuite/systemtap.samples/poll_map.exp14
-rwxr-xr-xtestsuite/systemtap.samples/poll_map.stp33
-rw-r--r--testsuite/systemtap.samples/profile.exp15
-rw-r--r--testsuite/systemtap.samples/profile.stp35
-rw-r--r--testsuite/systemtap.samples/symbols.exp14
-rw-r--r--testsuite/systemtap.samples/symbols.stp11
-rw-r--r--testsuite/systemtap.samples/syscalls.stp7
-rw-r--r--testsuite/systemtap.samples/syscalls1.exp14
-rw-r--r--testsuite/systemtap.samples/syscalls2.exp15
15 files changed, 0 insertions, 429 deletions
diff --git a/testsuite/systemtap.samples/crash.exp b/testsuite/systemtap.samples/crash.exp
deleted file mode 100644
index 9c3e5e05..00000000
--- a/testsuite/systemtap.samples/crash.exp
+++ /dev/null
@@ -1,45 +0,0 @@
-# Simple test for staplog.so crash(8) extension
-set test "crash"
-
-if {![installtest_p]} { untested $test; return }
-if {![file exists $env(CRASH_LIBDIR)/staplog.so]} { untested "$test - no staplog.so"; return }
-
-# Load a test script
-spawn stap $srcdir/$subdir/testlog.stp -m testlog
-expect {
- -timeout 120
- "HelloWorld\r\n" {
- pass "$test - testlog.stp"
- # Need to run crash(8) while this script is still running.
- # Since crash(8) needs /dev/mem access, need it run as_root too.
- # This [ eval ... \{ \} ] business is necessary because as_root
- # evals the given list/variables in its own scope.
- eval as_root \{ $srcdir/$subdir/crash.sh $env(CRASH_LIBDIR) \}
- }
- timeout { fail "$test - testlog.stp timeout" }
- timeout { fail "$test - testlog.stp eof" }
-}
-catch { exec kill -INT -[exp_pid]; close ; wait }
-
-# The crash(8) script creates testlog/global or testlog/cpu<n>
-as_root { chmod -R a+rX testlog }
-
-set ok 0
-foreach f [glob -nocomplain testlog/*] {
- pass "$test - crash(8) generated $f"
- set fp [open $f]
- set chars [read $fp]
- close $fp
- if [string match "HelloWorld*" $chars] {
- incr ok
- pass "$test - crash(8) data"
- } else {
- fail "$test - crash(8) data $chars"
- }
-}
-if {$ok == 0} {
- fail "$test - crash(8) data"
-}
-
-as_root { rm -rf testlog testlog.ko }
-
diff --git a/testsuite/systemtap.samples/crash.sh b/testsuite/systemtap.samples/crash.sh
deleted file mode 100755
index 06aa414e..00000000
--- a/testsuite/systemtap.samples/crash.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /bin/sh
-
-crash --readnow << END
-mod -s testlog testlog.ko
-extend $1/staplog.so
-staplog testlog
-exit
-END
diff --git a/testsuite/systemtap.samples/iotask.stp b/testsuite/systemtap.samples/iotask.stp
deleted file mode 100644
index 1b4c7243..00000000
--- a/testsuite/systemtap.samples/iotask.stp
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /usr/bin/env stap
-# iotask.stp
-# A reimplementation of user script: iotask.stp given at OLS 2005
-# in the current language.
-#
-# Will Cohen
-# 9/22/2005
-
-global names, opens
-global reads, read_bytes
-global writes, write_bytes
-
-probe kernel.function("sys_open") {
- ++names[execname()]; ++opens[execname()];
-}
-
-probe kernel.function("sys_read") {
- ++names[execname()]; ++reads[execname()];
- read_bytes[execname()] += $count;
-}
-
-probe kernel.function("sys_write") {
- ++names[execname()]; ++writes[execname()];
- write_bytes[execname()] += $count;
-}
-
-probe begin { println( "starting probe" ); }
-
-probe end {
- foreach( name in names){
- printf ("process: %s\n", name);
- if (opens[name])
- printf ("opens=%d\n",opens[name])
- if (reads[name]){
- count = reads[name]; total=read_bytes[name];
- printf("reads=%d, sum=%d, avg=%d\n", count, total, total/count);
- }
- if (writes[name]){
- count = writes[name]; total=write_bytes[name];
- printf("writes=%d, sum=%d, avg=%d\n", count, total, total/count);
- }
- println("");
- }
-}
diff --git a/testsuite/systemtap.samples/iotask2.stp b/testsuite/systemtap.samples/iotask2.stp
deleted file mode 100644
index cc4707b7..00000000
--- a/testsuite/systemtap.samples/iotask2.stp
+++ /dev/null
@@ -1,42 +0,0 @@
-global names, opens, reads, writes
-
-probe begin { println("starting probe") }
-
-probe timer.ms(10000) {
- println("stopping probe after 10 seconds")
- exit()
-}
-
-probe kernel.function("sys_open") {
- e=execname(); names[e]=1
- opens[e] ++ # simple integer array
-}
-
-probe kernel.function("sys_read") {
- e=execname(); names[e]=1
- reads[e] <<< $count # statistics array
-}
-
-probe kernel.function("sys_write") {
- e=execname(); names[e]=1
- writes[e] <<< $count # statistics array
-}
-
-
-probe end {
- foreach (name+ in names) { # sort by name
- printf("process: %s\n", name)
- if (opens[name])
- printf("opens n=%d\n", opens[name])
- if (@count(reads[name]))
- printf("reads n=%d, sum=%d, avg=%d\n",
- @count(reads[name]), # extracting stat results
- @sum(reads[name]),
- @avg(reads[name]))
- if (@count(writes[name]))
- printf("writes n=%d, sum=%d, avg=%d\n",
- @count(writes[name]), # extracting stat results
- @sum(writes[name]),
- @avg(writes[name]))
- }
-}
diff --git a/testsuite/systemtap.samples/kmalloc-stacks.stp b/testsuite/systemtap.samples/kmalloc-stacks.stp
deleted file mode 100644
index 25a23f2d..00000000
--- a/testsuite/systemtap.samples/kmalloc-stacks.stp
+++ /dev/null
@@ -1,35 +0,0 @@
-global kmalloc_stack
-
-function reset_maxaction () %{
- if (CONTEXT && CONTEXT->actioncount)
- CONTEXT->actioncount=0;
-%}
-
-function write_output()
-{
- foreach (stack in kmalloc_stack) {
- log("<hashkey>");
- print_stack(stack);
- log("</hashkey>");
- print("<hashval>");
- print(sprint(kmalloc_stack[stack]));
- log("</hashval>");
- reset_maxaction();
- }
-}
-
-probe timer.jiffies(5000)
-{
- write_output();
- delete kmalloc_stack;
-}
-
-probe kernel.function("__kmalloc")
-{
- kmalloc_stack[backtrace()]++;
-}
-
-probe end
-{
- write_output();
-}
diff --git a/testsuite/systemtap.samples/kmalloc-top b/testsuite/systemtap.samples/kmalloc-top
deleted file mode 100755
index 42a6d152..00000000
--- a/testsuite/systemtap.samples/kmalloc-top
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/perl
-#
-# This script accumulates the execution paths of all calls to kmalloc
-# in the kernel. On Ctrl-C, it sorts, filters and displays them on
-# stdout.
-#
-# The -e (exclude) option can be used to specify a comma-separated list
-# - any stack with contents matching any of the items in the list will
-# be excluded from the output.
-#
-# The -m (min) option can be used to specify the minimum number of
-# occurrences a stack needs to be included in the output.
-#
-# Usage: ./kmalloc-top [-m min] [-i exclude list]
-# Ctrl-c
-
-use Getopt::Std;
-
-my $kmalloc_stacks;
-my $total_kmallocs;
-my $sorted_stacks;
-my $min_count = 1;
-my $exclude;
-
-$SIG{INT} = \&sigint_handler;
-
-getopts('e:m:');
-
-if ($opt_e) {
- $exclude = join('|', split(/,/, $opt_e));
- print "Will exclude stacks containing: $exclude\n";
-}
-
-if ($opt_m) {
- $min_count = $opt_n;
-}
-print "Will print stacks with counts >= $min_count.\n";
-print STDERR "Press Ctrl-C to stop.\n";
-
-open STREAM, "stap -g kmalloc-stacks.stp |" or die "Couldn't get output stream $!";
-
-while (<STREAM>) {
- if (/<hashval>(.*?)<\/hashval>/) {
- update_hash($key, $1);
- $key = "";
- } elsif ($_ !~ (/<hashkey>|<\/hashkey>/)) {
- $key .= $_;
- }
-}
-
-$num_keys_before_filtering = scalar keys %kmalloc_stacks;
-filter_stacks();
-$num_keys_after_filtering = scalar keys %kmalloc_stacks;
-sort_stacks();
-summarize();
-exit();
-
-sub update_hash
-{
- my($key, $val) = @_;
- $kmalloc_stacks{$key} += $val;
- $total_kmallocs += $val;
-}
-
-sub filter_stacks
-{
- while (($stack, $count) = each %kmalloc_stacks) {
- if ($count < $min_count) {
- delete $kmalloc_stacks{$stack};
- } elsif ($exclude && $stack =~ /$exclude/) {
- delete $kmalloc_stacks{$stack};
- }
- }
-}
-
-sub sort_stacks
-{
- @sorted_stacks = sort { $kmalloc_stacks{$b} <=> $kmalloc_stacks{$a} } keys %kmalloc_stacks;
-}
-
-sub summarize {
- print "\n";
- foreach $stack(@sorted_stacks) {
- print "This path seen $kmalloc_stacks{$stack} times:\n$stack\n";
- }
-
- print "Total kmallocs (before filtering): $total_kmallocs\n";
- print "Num stacks before filtering: $num_keys_before_filtering\n";
- print "Num stacks after filtering: $num_keys_after_filtering\n";
-
- close(STREAM);
-}
-
-sub sigint_handler
-{
- system("pkill kmalloc-stacks");
-}
diff --git a/testsuite/systemtap.samples/poll_map.exp b/testsuite/systemtap.samples/poll_map.exp
deleted file mode 100644
index 5ade48e6..00000000
--- a/testsuite/systemtap.samples/poll_map.exp
+++ /dev/null
@@ -1,14 +0,0 @@
-set test "poll_map"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -g $srcdir/$subdir/poll_map.stp
-set ok 0
-expect {
- -timeout 400
- -ex "SUCCESS" { incr ok }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-close
-wait
-if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.samples/poll_map.stp b/testsuite/systemtap.samples/poll_map.stp
deleted file mode 100755
index cd39b433..00000000
--- a/testsuite/systemtap.samples/poll_map.stp
+++ /dev/null
@@ -1,33 +0,0 @@
-#! stap
-
-# test that polling loops do not exit when conflicts happen
-# see PR 1379
-
-global called, num_polls
-
-probe kernel.function( "sys_*" ).call {
- called[execname(),probefunc()]++
-}
-
-probe timer.ms(1000)
-{
- print("\n\n")
- num_to_do = 10
- foreach ([n,f] in called-) {
- printf("%s called %s\t%d times\n", n, f, called[n,f])
- num_to_do--
- if (num_to_do <= 0)
- break
- }
- delete called
- num_polls++
- if (num_polls > 30)
- exit()
-}
-
-probe end {
- if (num_polls <= 30)
- print ("FAIL\n")
- else
- print ("SUCCESS\n")
-}
diff --git a/testsuite/systemtap.samples/profile.exp b/testsuite/systemtap.samples/profile.exp
deleted file mode 100644
index 87174d2c..00000000
--- a/testsuite/systemtap.samples/profile.exp
+++ /dev/null
@@ -1,15 +0,0 @@
-set test "profile"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -DMAXMAPENTRIES=10000 $srcdir/$subdir/profile.stp
-set ok 0
-expect {
- -timeout 360
- -re {kernel.function[^\r]*ttime=[0-9]*\r} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-#FIXME does not handle case of hanging primes.stp correctly
-wait
-
-if {$ok > 0} { pass $test } { fail $test }
diff --git a/testsuite/systemtap.samples/profile.stp b/testsuite/systemtap.samples/profile.stp
deleted file mode 100644
index 62af76ae..00000000
--- a/testsuite/systemtap.samples/profile.stp
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /usr/bin/env stap
-
-global command, syscall_count, syscall_times, this_syscall_time, this_syscall
-
-function accumulate () {
- tid = tid()
- if (! ([tid] in command)) command[tid] = execname()
- syscall=pp() # just the substring ideally
- syscall_count[tid,syscall] ++
- this_syscall[tid] = syscall
- this_syscall_time[tid] = gettimeofday_us()
-}
-function decumulate () {
- tid = tid()
- syscall = this_syscall[tid]
- syscall_times[tid,syscall] += gettimeofday_us() - this_syscall_time[tid]
- # free up memory
- delete(this_syscall[tid])
- delete(this_syscall_time[tid])
-}
-probe kernel.function("sys_*").call {
- accumulate ()
-}
-probe kernel.function("sys_*").return {
- decumulate ()
-}
-probe timer.ms(5000) {
- exit ()
-}
-probe end {
- foreach ([tid,syscall] in syscall_count- limit 30) {
- printf("%s(%d) %s count=%d ttime=%d\n", command[tid], tid, syscall,
- syscall_count[tid,syscall], syscall_times[tid,syscall])
- }
-}
diff --git a/testsuite/systemtap.samples/symbols.exp b/testsuite/systemtap.samples/symbols.exp
deleted file mode 100644
index 0c599b58..00000000
--- a/testsuite/systemtap.samples/symbols.exp
+++ /dev/null
@@ -1,14 +0,0 @@
-set test "symbols"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -g $srcdir/$subdir/symbols.stp
-set ok 0
-expect {
- -timeout 120
- -re { 0x[a-f0-9]+[^\r]*\r} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-#FIXME does not handle case of hanging symbols.stp correctly
-wait
-if {$ok == 11} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.samples/symbols.stp b/testsuite/systemtap.samples/symbols.stp
deleted file mode 100644
index 040c3444..00000000
--- a/testsuite/systemtap.samples/symbols.stp
+++ /dev/null
@@ -1,11 +0,0 @@
-#! stap
-
-probe begin {
- # a spectrum of figures for 32-bit x86
- print_stack ("0x0 0x80000000 0xc0000000 0xe0000000 0xf0000000 0xffffffff")
- # for x86_64
- print_stack ("0xffffffff00000000 0xffffffff80000000 0xffffffff80120000")
- print_stack ("0xffffffff88000000 0xffffffffffffffff")
- # ... for a total of 11 lines, which symbols.exp counts
- exit ()
-}
diff --git a/testsuite/systemtap.samples/syscalls.stp b/testsuite/systemtap.samples/syscalls.stp
deleted file mode 100644
index 3ccfb8e5..00000000
--- a/testsuite/systemtap.samples/syscalls.stp
+++ /dev/null
@@ -1,7 +0,0 @@
-#! stap
-
-global count
-probe kernel.function("sys_*").call {
- printf("%d %s\n", pid(), pp())
- if (++count > 100) exit()
-}
diff --git a/testsuite/systemtap.samples/syscalls1.exp b/testsuite/systemtap.samples/syscalls1.exp
deleted file mode 100644
index eb8a0c6d..00000000
--- a/testsuite/systemtap.samples/syscalls1.exp
+++ /dev/null
@@ -1,14 +0,0 @@
-set test "syscalls-count"
-if {![installtest_p]} { untested $test; return }
-
-spawn stap -p2 $srcdir/$subdir/syscalls.stp
-set ok 0
-expect {
- -timeout 180
- -re {kernel.function[^\r]*sys_[^\r]*\r} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-#FIXME does not handle case of hanging psyscalls.stp correctly
-wait
-if {$ok > 200 && $ok < 350} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.samples/syscalls2.exp b/testsuite/systemtap.samples/syscalls2.exp
deleted file mode 100644
index 7bbd9a51..00000000
--- a/testsuite/systemtap.samples/syscalls2.exp
+++ /dev/null
@@ -1,15 +0,0 @@
-set test "syscalls-run"
-if {![installtest_p]} { untested $test; return }
-spawn stap $srcdir/$subdir/syscalls.stp
-set ok 0
-expect {
- -timeout 240
- -re {[0-9]* kernel.function[^\r]*\r} { incr ok; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-#FIXME does not handle case of hanging psyscalls.stp correctly
-wait
-# 150 is conservative - it's larger than 100 to allow a bit of slop
-# between the exit() call and the actual shutdown
-if {$ok >= 100 && $ok < 150} { pass "$test ($ok)" } { fail "$test ($ok)" }