diff options
-rw-r--r-- | doc/Tapset_Reference_Guide/manpager.sh | 105 | ||||
-rw-r--r-- | runtime/task_finder_vma.c | 1 | ||||
-rw-r--r-- | tapset/signal.stp | 15 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 18 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.txt | 13 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/ioblktime.meta | 13 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/ioblktime.stp | 29 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.txt | 13 | ||||
-rw-r--r-- | testsuite/systemtap.samples/ioblocktest.exp | 11 | ||||
-rw-r--r-- | testsuite/systemtap.samples/ioblocktest.stp | 12 |
12 files changed, 134 insertions, 102 deletions
diff --git a/doc/Tapset_Reference_Guide/manpager.sh b/doc/Tapset_Reference_Guide/manpager.sh index 2b9873b7..0051d208 100644 --- a/doc/Tapset_Reference_Guide/manpager.sh +++ b/doc/Tapset_Reference_Guide/manpager.sh @@ -3,12 +3,12 @@ # generated herein should be in sync with Tapset Reference Guide # cleanup -rm -rf workingdir +rm -rf man_pages # create working directory mkdir workingdir ; -# create list of man pages to generate; should be in sync with Tapset Reference Guide +# create list of man pages to generate cat ../SystemTap_Tapset_Reference/tapsets.tmpl | grep ^\!Itapset > manpageus ; sed -i -e 's/\!Itapset\///g' manpageus ; @@ -38,8 +38,6 @@ echo $i > tempname ; sed -i -e 's/.stp//g' tempname ; mv $i `cat tempname` ; mv tempname $i ; done ; -# clean all tapsetdescriptions (remove excess spaces) -# for i in `ls | grep tapsetdescription` ; do perl -p -i -e 's|^\n||g' $i ; done ; # create man page headers for i in `ls | grep -v .stp | grep -v tapsetdescription` ; do @@ -51,7 +49,6 @@ echo " " >> $i.template ; echo ".SH DESCRIPTION" >> $i.template ; cat $i.stp.tapsetdescription >> $i.template ; echo " " >> $i.template ; -#echo " " >> $i.template ; echo ".SH PROBES" >> $i.template ; echo ".br" >> $i.template ; echo ".P" >> $i.template ; @@ -59,73 +56,65 @@ echo ".TP" >> $i.template ; done # MOST IMPORTANT: clean man page body! -for i in `ls | grep -v .stp | grep -v tapsetdescription | grep -v template` ; -do cp $i $i.tmp ; +sed -i -e 's/\.stp$//g' ../manpageus ; +for i in `cat ../manpageus` ; +do mv $i $i.tmp ; perl -p -i -e 's| \* sfunction|.BR|g' $i.tmp ; perl -p -i -e 's| \* probe|.BR|g' $i.tmp ; perl -p -i -e 's| -|\ninitlinehere|g' $i.tmp ; -perl -p -i -e 's|^initlinehere([^\n]*)\n|\n.br\n$1\n\n.B Arguments:|g' $i.tmp ; -perl -p -i -e 's| \* @([^:]*):|\n.I $1\n.br\n|g' $i.tmp ; -perl -p -i -e 's| \* ([^:]*):|\n.BR $1:\n.br\n|g' $i.tmp ; +perl -p -i -e 's|^initlinehere([^\n]*)\n|$1\n |g' $i.tmp ; +perl -p -i -e 's| \* @([^:]*):|\n.I $1:\n|g' $i.tmp ; +perl -p -i -e 's| \* ([^:]*):|\n.BR $1:\n|g' $i.tmp ; +perl -p -i -e 's| \* ||g' $i.tmp perl -p -i -e 's|\*probestart|\n.P\n.TP|g' $i.tmp ; -perl -p -i -e 's|\.I|\n\n.I|g' $i.tmp ; -# special formatting for Arguments header -perl -p -i -e 's|.B Arguments: \*\/||g' $i.tmp ; -perl -p -i -e 's|.B Arguments: \*|.B Description:|g' $i.tmp ; - -cat $i.tmp | -perl -p -e 'undef $/;s|.B Arguments:\n.B|.B|msg' | -perl -p -e 'undef $/;s|\n\n\n|\n\n|msg' > $i.manpagebody ; +perl -p -i -e 's|\.I|\n.I|g' $i.tmp ; +# remove empty lines +sed -i -e '/^$/d' $i.tmp ; +sed -i -e '/^$/d' $i.tmp ; +sed -i -e 's/^[ \t]*//g' $i.tmp ; +# process Description headers +perl -p -i -e 's|^\*[^/]|\n.BR Description:\n|g' $i.tmp ; +perl -p -i -e 'undef $/;s|\.BR Description:\n\.BR|.BR|g' $i.tmp ; +perl -p -i -e 'undef $/;s|\.BR Description:\n\*\/||g' $i.tmp ; +# process Argument headers +perl -p -i -e 'undef $/;s|\n\n.I|\n.br\n.BR Arguments:\n.I|g' $i.tmp ; +# clean up formatting of arguments +perl -p -i -e 's|^.I([^:]*:)|\n.br\n.br\n.IR$1\n.br\n\t|g' $i.tmp ; done +# make tags work +for i in `cat ../manpageus` ; do +perl -p -i -e 's|</[^>]*>([^.])|$1\n|g' $i.tmp ; +perl -p -i -e 's|<[^>]*>|\n.B |g' $i.tmp ; +# the previous two statements create excess empty lines, remove some of them +sed -i -e '/^$/d' $i.tmp ; +# increase whitespace between some headers +perl -p -i -e 's|^\.BR ([^:]*:)|\n.br\n.BR $1\n.br\n|g' $i.tmp +done + # generate footer template -mv ../manpageus . -sed -i -e 's/.stp//g' manpageus echo ".SH SEE ALSO" >> footer echo ".IR stap (1)," >> footer echo ".IR stapprobes (5)," >> footer -for i in `cat manpageus`; do echo ".IR stapprobes."$i" (5)," >> footer ; done +for i in `cat ../manpageus`; do echo ".IR stapprobes."$i" (5)," >> footer ; done # assemble parts -for i in `cat manpageus`; do -cat $i.template >> $i.5 ; -cat $i.manpagebody >> $i.5 ; -cat footer >> $i.5 ; +for i in `cat ../manpageus`; do +cat $i.template >> stapprobes.$i.5 ; +cat $i.tmp >> stapprobes.$i.5 ; +cat footer >> stapprobes.$i.5 ; +# final polish +sed -i -e 's/\*\/$//g' stapprobes.$i.5 ; done # cleanup -for i in `cat manpageus`; do -# context.stp -perl -p -i -e 's|.B Description:/|\n.P\n.TP|g' $i.5 ; -perl -p -i -e 's|.B Description:|.B Description:\n\n |g' $i.5 ; -# convert tags -perl -p -i -e 's|</[^>]*>([^.])|$1\n|g' $i.5 ; -perl -p -i -e 's|<[^>]*>|\n.B |g' $i.5 ; -cat $i.5 | -perl -p -e 'undef $/;s|\.B Arguments:\n\n\.B |.B|msg' | -# for tagged commands followed by periods -perl -p -e 'undef $/;s|\n\.B \.|.\n|msg' | -perl -p -e 'undef $/;s|\n \* | |msg' > stapprobes.$i.5.in ; -# cleanup all remaining stars, excess initial whitespace, and trailing "/" per line -perl -p -i -e 's|^ \*||g' stapprobes.$i.5.in; -perl -p -i -e 's|^[ ]*||g' stapprobes.$i.5.in; -perl -p -i -e 's|^/||g' stapprobes.$i.5.in; -# cleanup remaining excess whitespace -perl -p -i -e 's|\t\t| |g' stapprobes.$i.5.in; -perl -p -i -e 's|^ ||g' stapprobes.$i.5.in; -sed -i -e 's/ / /g' stapprobes.$i.5.in; +for i in `ls | grep -v 'stapprobes.*.5'` ; do +rm $i ; done -# file cleanup -rm `ls | grep -v stapprobes` -#mv workingdir final_manpages -# perl -p -i -e 's|||g' stapprobes.$i.5.in ; - -# perl -p -i -e 's|||g' $i.manpagebody -# use to move marked strings. -# sed -n '/\/\/ <tapsetdescription>/,/\/\/ <\/tapsetdescription>/ s/.*/&/w bleh' < ioscheduler -# remove excess initial whitespace for each line -# perl -p -i -e 's|^ ||g' stapprobes.$i.5.in; -# convert tags -# perl -p -i -e 's|</[^>]*>|\n|g' stapprobes.$i.5.in ; -# perl -p -i -e 's|<[^>]*>|\n.B |g' stapprobes.$i.5.in ;
\ No newline at end of file +rm ../manpageus ; +cd .. +mv workingdir man_pages +echo " " +echo "Finished! man pages generated in ./man_pages." +echo " "
\ No newline at end of file diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c index 87a32fe5..83b206e5 100644 --- a/runtime/task_finder_vma.c +++ b/runtime/task_finder_vma.c @@ -203,7 +203,6 @@ __stp_tf_get_vma_map_entry_internal(struct task_struct *tsk, hlist_for_each_entry(entry, node, head, hlist) { if (tsk->pid == entry->pid && vm_start == entry->addr) { - mutex_unlock(&__stp_tf_vma_mutex); return entry; } } diff --git a/tapset/signal.stp b/tapset/signal.stp index 711ee70f..e8470a9c 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -31,7 +31,7 @@ * @send2queue: Indicates whether the signal is sent to an existing * <command>sigqueue</command> * @name: The name of the function used to send out the signal - * + * * Context: * The signal's sender. * @@ -124,10 +124,10 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") * @send2queue: Indicates whether the sent signal was sent to an * existing <command>sigqueue</command> * @name: The name of the function used to send out the signal - * + * * Context: * The signal's sender. <remark>(correct?)</remark> - * + * * Possible <command>__group_send_sig_info</command> and * <command>specific_send_sig_info</command> return values are as follows; * @@ -139,19 +139,18 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") * * <command>-EAGAIN</command> -- The <command>sigqueue</command> of the receiving process is * overflowing, the signal was RT, and the signal was sent by a user using something other - * than <command>kill()</command> - * + * than <command>kill()</command>. + * * Possible <command>send_group_sigqueue</command> and * <command>send_sigqueue</command> return values are as follows; - * + * * <command>0</command> -- The signal was either sucessfully added into the * <command>sigqueue</command> of the receiving process, or a <command>SI_TIMER</command> entry is already * queued (in which case, the overrun count will be simply incremented). * * <command>1</command> -- The signal was ignored by the receiving process. * - * - * <command>-1</command> - (<command>send_sigqueue</command> only) The task was marked + * <command>-1</command> -- (<command>send_sigqueue</command> only) The task was marked * <command>exiting</command>, allowing * <command>posix_timer_event</command> to redirect it to the group * leader. * diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index a4bd5e2c..b4214436 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,5 +1,4 @@ - -set test "sduprobes" +set test "static_uprobes" # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" @@ -115,9 +114,7 @@ if { $res != "" } { pass "$test compiling C -g" } -spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" -set sup_srcpath "[pwd]/static_uprobes.cc" -set sup_flags "$sup_flags c++" +set sup_flags "$sup_flags additional_flags=-x additional_flags=c++" set res [target_compile $sup_srcpath $supcplus_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 @@ -163,9 +160,9 @@ if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" } set ok 0 -# spawn objcopy -R .probes $supcplus_exepath $sup_exepath -verbose -log "cp $supcplus_exepath $sup_exepath" -spawn cp $supcplus_exepath $sup_exepath +# Test setting a probe without .probes using only dwarf label info +verbose -log "objcopy -R .probes $supcplus_exepath $sup_exepath" +spawn objcopy -R .probes $supcplus_exepath $sup_exepath verbose -log "spawn stap -c $sup_exepath $sup_stppath" spawn stap -c $sup_exepath $sup_stppath expect { @@ -182,7 +179,4 @@ wait if {$ok == 5} { pass "$test C++" } { fail "$test C++ ($ok)" } -# catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath} - -# It's not so important to clean up, and it's unhelpful if -# one needs to diagnose a test failure. +catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_dpath $sup_hpath $sup_stppath} diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 7b76baa1..0f4b2572 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -58,6 +58,9 @@ keywords: <a href="keyword-index.html#DISK">DISK</a> <br> <li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> <p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li> +<li><a href="io/ioblktime.stp">io/ioblktime.stp</a> - Average Time Block IO Requests Spend in Queue <br> +keywords: <a href="keyword-index.html#IO">IO</a> <br> +<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script compute the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</p></li> <li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br> <p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li> diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index fdcd3b31..e31baf4f 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -52,6 +52,19 @@ keywords: io backtrace list from most common to least common backtrace. +io/ioblktime.stp - Average Time Block IO Requests Spend in Queue +keywords: io + + The ioblktime.stp script tracks the amount of time that each block IO + requests spend waiting for completion. The script compute the average + time waiting time for block IO per device and prints list every 10 + seconds. In some cases there can be too many oustanding block IO + operations and the script may exceed the default number of + MAXMAPENTRIES allowed. In this case the allowed number can be + increased with "-DMAXMAPENTRIES=10000" option on the stap command + line. + + io/iostats.stp - List Executables Reading and Writing the Most Data keywords: io profiling diff --git a/testsuite/systemtap.examples/io/ioblktime.meta b/testsuite/systemtap.examples/io/ioblktime.meta new file mode 100644 index 00000000..18a8b168 --- /dev/null +++ b/testsuite/systemtap.examples/io/ioblktime.meta @@ -0,0 +1,13 @@ +title: Average Time Block IO Requests Spend in Queue +name: ioblktime.stp +version: 1.0 +author: William Cohen +keywords: io +subsystem: kernel +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. +test_check: stap -p4 ioblktime.stp +test_installcheck: stap ioblktime.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp new file mode 100755 index 00000000..5ff59cf7 --- /dev/null +++ b/testsuite/systemtap.examples/io/ioblktime.stp @@ -0,0 +1,29 @@ +#! /usr/bin/env stap + +global req_time, etimes + +probe ioblock.request +{ + req_time[$bio] = gettimeofday_us() +} + +probe ioblock.end +{ + t = gettimeofday_us() + s = req_time[$bio] + delete req_time[$bio] + if (s) { + etimes[devname, bio_rw_str(rw)] <<< t - s + } +} + +probe timer.s(10), end { + printf("\033[2J\033[1;1H") /* clear screen */ + printf("%10s %3s %10s %10s %10s\n", + "device", "rw", "total (us)", "count", "avg (us)") + foreach ([dev,rw] in etimes - limit 20) { + printf("%10s %3s %10d %10d %10d\n", dev, rw, + @sum(etimes[dev,rw]), @count(etimes[dev,rw]), @avg(etimes[dev,rw])) + } + delete etimes +} diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index b3ea0943..75768709 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -102,6 +102,9 @@ keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword- <li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> <p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li> +<li><a href="io/ioblktime.stp">io/ioblktime.stp</a> - Average Time Block IO Requests Spend in Queue <br> +keywords: <a href="keyword-index.html#IO">IO</a> <br> +<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script compute the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</p></li> <li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br> <p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 5f382e75..d3a9617f 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -125,6 +125,19 @@ keywords: io backtrace list from most common to least common backtrace. +io/ioblktime.stp - Average Time Block IO Requests Spend in Queue +keywords: io + + The ioblktime.stp script tracks the amount of time that each block IO + requests spend waiting for completion. The script compute the average + time waiting time for block IO per device and prints list every 10 + seconds. In some cases there can be too many oustanding block IO + operations and the script may exceed the default number of + MAXMAPENTRIES allowed. In this case the allowed number can be + increased with "-DMAXMAPENTRIES=10000" option on the stap command + line. + + io/iostats.stp - List Executables Reading and Writing the Most Data keywords: io profiling diff --git a/testsuite/systemtap.samples/ioblocktest.exp b/testsuite/systemtap.samples/ioblocktest.exp deleted file mode 100644 index b5ab54c7..00000000 --- a/testsuite/systemtap.samples/ioblocktest.exp +++ /dev/null @@ -1,11 +0,0 @@ -# Test the functionality of the various ioblock probes. - -set test "ioblocktest" - -proc sleep_ten_secs {} { - after 10000; - return 0; -} - -set output_string "ioblock: \\S+\t\\d+\t\[RW]\t\[01]\r\n" -stap_run $srcdir/$subdir/$test.stp sleep_ten_secs $output_string diff --git a/testsuite/systemtap.samples/ioblocktest.stp b/testsuite/systemtap.samples/ioblocktest.stp deleted file mode 100644 index f8a1c568..00000000 --- a/testsuite/systemtap.samples/ioblocktest.stp +++ /dev/null @@ -1,12 +0,0 @@ -#! stap -global teststr -probe begin { println("systemtap starting probe") } - -probe ioblock.request, ioblock.end { - teststr = sprintf("ioblock: %s\t%d\t%s\t%d\n", devname, sector, - bio_rw_str(rw), bio_rw_num(rw)) -} -probe end { - println("systemtap ending probe") - printf("%s", teststr) -} |