diff options
author | Dave Brolley <brolley@redhat.com> | 2008-08-08 15:15:19 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2008-08-08 15:15:19 -0400 |
commit | 71906647386a9684086b0542318b536d95ae089c (patch) | |
tree | fb0348d7bb34095e95ad830da8e832bad9187a55 /testsuite/systemtap.examples | |
parent | d5658775da9fa0ac792eb3f874df9f7c4d60de7e (diff) | |
parent | f1118e1032612170cae8cd979cd529722ad95fdb (diff) | |
download | systemtap-steved-71906647386a9684086b0542318b536d95ae089c.tar.gz systemtap-steved-71906647386a9684086b0542318b536d95ae089c.tar.xz systemtap-steved-71906647386a9684086b0542318b536d95ae089c.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Conflicts:
ChangeLog
testsuite/ChangeLog
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r-- | testsuite/systemtap.examples/ChangeLog | 51 | ||||
-rw-r--r-- | testsuite/systemtap.examples/README | 52 | ||||
-rw-r--r-- | testsuite/systemtap.examples/examples-index-gen.pl | 318 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/general/ansi_colors.stp (renamed from testsuite/systemtap.examples/small_demos/ansi_colors.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/click.wav (renamed from testsuite/systemtap.examples/small_demos/click.wav) | bin | 1290 -> 1290 bytes | |||
-rw-r--r-- | testsuite/systemtap.examples/general/graphs.meta (renamed from testsuite/systemtap.examples/graphs.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/graphs.stp (renamed from testsuite/systemtap.examples/graphs.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/helloworld.meta (renamed from testsuite/systemtap.examples/helloworld.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/general/helloworld.stp (renamed from testsuite/systemtap.examples/helloworld.stp) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/general/key.stp (renamed from testsuite/systemtap.examples/small_demos/key.stp) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/general/keyhack.stp (renamed from testsuite/systemtap.examples/small_demos/keyhack.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/para-callgraph.meta (renamed from testsuite/systemtap.examples/para-callgraph.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/para-callgraph.stp (renamed from testsuite/systemtap.examples/para-callgraph.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/return.wav (renamed from testsuite/systemtap.examples/small_demos/return.wav) | bin | 6584 -> 6584 bytes | |||
-rw-r--r-- | testsuite/systemtap.examples/html/html_footer.tmpl | 14 | ||||
-rw-r--r-- | testsuite/systemtap.examples/html/html_header.tmpl | 41 | ||||
-rw-r--r-- | testsuite/systemtap.examples/html/systemtap.css | 164 | ||||
-rw-r--r-- | testsuite/systemtap.examples/html/systemtapcorner.gif | bin | 0 -> 970 bytes | |||
-rw-r--r-- | testsuite/systemtap.examples/html/systemtaplogo.png | bin | 0 -> 1860 bytes | |||
-rw-r--r-- | testsuite/systemtap.examples/index.html | 130 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.txt | 214 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/disktop.meta (renamed from testsuite/systemtap.examples/disktop.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/disktop.stp (renamed from testsuite/systemtap.examples/disktop.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/io_submit.meta (renamed from testsuite/systemtap.examples/io_submit.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/io_submit.stp (renamed from testsuite/systemtap.examples/io_submit.stp) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/iostat-scsi.stp (renamed from testsuite/systemtap.examples/iostat-scsi.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/iostat-scsi.txt (renamed from testsuite/systemtap.examples/iostat-scsi.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/iotime.meta (renamed from testsuite/systemtap.examples/iotime.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/iotime.stp (renamed from testsuite/systemtap.examples/iotime.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/iotop.meta (renamed from testsuite/systemtap.examples/iotop.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/iotop.stp (renamed from testsuite/systemtap.examples/iotop.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio.meta (renamed from testsuite/systemtap.examples/traceio.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio.stp (renamed from testsuite/systemtap.examples/traceio.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio2.meta (renamed from testsuite/systemtap.examples/traceio2.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio2.stp (renamed from testsuite/systemtap.examples/traceio2.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.html | 258 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.txt | 458 | ||||
-rw-r--r-- | testsuite/systemtap.examples/network/nettop.meta (renamed from testsuite/systemtap.examples/nettop.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/nettop.stp (renamed from testsuite/systemtap.examples/nettop.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/network/nettop.txt (renamed from testsuite/systemtap.examples/nettop.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/network/socket-trace.meta (renamed from testsuite/systemtap.examples/socket-trace.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/socket-trace.stp (renamed from testsuite/systemtap.examples/socket-trace.stp) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/socktop (renamed from testsuite/systemtap.examples/socktop) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/network/socktop.txt (renamed from testsuite/systemtap.examples/socktop.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/futexes.meta (renamed from testsuite/systemtap.examples/futexes.meta) | 2 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/futexes.stp (renamed from testsuite/systemtap.examples/futexes.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/futexes.txt (renamed from testsuite/systemtap.examples/futexes.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/pf2.meta (renamed from testsuite/systemtap.examples/pf2.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/pf2.stp (renamed from testsuite/systemtap.examples/pf2.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/pf2.txt (renamed from testsuite/systemtap.examples/pf2.txt) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/proc_snoop.stp (renamed from testsuite/systemtap.examples/small_demos/proc_snoop.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sig_by_pid.meta (renamed from testsuite/systemtap.examples/sig_by_pid.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/sig_by_pid.stp (renamed from testsuite/systemtap.examples/sig_by_pid.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sig_by_pid.txt (renamed from testsuite/systemtap.examples/sig_by_pid.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sig_by_proc.meta (renamed from testsuite/systemtap.examples/sig_by_proc.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/sig_by_proc.stp (renamed from testsuite/systemtap.examples/sig_by_proc.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sig_by_proc.txt (renamed from testsuite/systemtap.examples/sig_by_proc.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sigkill.meta (renamed from testsuite/systemtap.examples/sigkill.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sigkill.stp (renamed from testsuite/systemtap.examples/sigkill.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sigmon.meta (renamed from testsuite/systemtap.examples/sigmon.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/sigmon.stp (renamed from testsuite/systemtap.examples/sigmon.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sleepingBeauties.meta (renamed from testsuite/systemtap.examples/sleepingBeauties.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sleepingBeauties.stp (renamed from testsuite/systemtap.examples/sleepingBeauties.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/sleeptime.meta (renamed from testsuite/systemtap.examples/sleeptime.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/sleeptime.stp (renamed from testsuite/systemtap.examples/sleeptime.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/syscalls_by_pid.meta (renamed from testsuite/systemtap.examples/syscalls_by_pid.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/syscalls_by_pid.stp (renamed from testsuite/systemtap.examples/syscalls_by_pid.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/syscalls_by_pid.txt (renamed from testsuite/systemtap.examples/syscalls_by_pid.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/syscalls_by_proc.meta (renamed from testsuite/systemtap.examples/syscalls_by_proc.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/syscalls_by_proc.stp (renamed from testsuite/systemtap.examples/syscalls_by_proc.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/syscalls_by_proc.txt (renamed from testsuite/systemtap.examples/syscalls_by_proc.txt) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/syscalltimes (renamed from testsuite/systemtap.examples/syscalltimes) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/syscalltimes.txt (renamed from testsuite/systemtap.examples/syscalltimes.txt) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/process/wait4time.meta (renamed from testsuite/systemtap.examples/wait4time.meta) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/process/wait4time.stp (renamed from testsuite/systemtap.examples/wait4time.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/profiling/functioncallcount.meta (renamed from testsuite/systemtap.examples/functioncallcount.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/profiling/functioncallcount.stp (renamed from testsuite/systemtap.examples/functioncallcount.stp) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/profiling/thread-times.meta (renamed from testsuite/systemtap.examples/thread-times.meta) | 0 | ||||
-rw-r--r-- | testsuite/systemtap.examples/profiling/thread-times.stp (renamed from testsuite/systemtap.examples/thread-times.stp) | 0 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/close.stp | 14 | ||||
-rw-r--r-- | testsuite/systemtap.examples/small_demos/demo_script.txt | 102 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/fileopen.stp | 24 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/kmalloc.stp | 22 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/kmalloc2.stp | 26 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/prof.stp | 35 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/rwtiming.stp | 74 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/sched_snoop.stp | 35 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/sys.stp | 17 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/small_demos/top.stp | 24 | ||||
-rw-r--r-- | testsuite/systemtap.examples/subsystem-index.html | 162 | ||||
-rw-r--r-- | testsuite/systemtap.examples/subsystem-index.txt | 242 |
91 files changed, 2103 insertions, 376 deletions
diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog index 7cb39fb9..a7fcd069 100644 --- a/testsuite/systemtap.examples/ChangeLog +++ b/testsuite/systemtap.examples/ChangeLog @@ -1,3 +1,54 @@ +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * examples-index-gen.pl: Add index of subsystem and keywords at top of + HTML indexes. + * *index.html: Regenerated. + * *index.txt: Likewise. + +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * examples-index-gen.pl (add_meta_txt): Don't output output, exits, + status line. + (add_meta_html): Likewise. + * *index.html: Regenerated. + * *index.txt: Likewise. + +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * examples-index-gen.pl (inputdir): Make absolute. + (outputdir): Likewise. + (supportfiles): Copy from new html dir. Add README. Make sure + new html subdir is created in outputdir. + +2008-08-07 Frank Ch. Eigler <fche@elastic.org> + + * *index.txt, *index.html: New generated files. + * .gitignore: Zap it. + * html/*, examples-index-gen.pl: Adapt to html/ boilerplate subdir. + +2008-08-07 Frank Ch. Eigler <fche@elastic.org> + + * small_demos: Unique parts kept, others dropped. + * all other samples: Moved into new subdirectories. + +2008-08-07 David Smith <dsmith@redhat.com> + + * .gitignore: New file. + +2008-08-07 Mark Wielaard <mwielaard@redhat.com> + + * examples-index-gen.pl: New file. + * systemtap.css: Likewise. + * systemtapcorner.gif: Likewise. + * systemtaplogo.png: Likewise. + * html_footer.tmpl: Likewise. + * html_header.tmpl: Likewise. + * Makefile.am (EXTRA_DIST): Add new support files. + +2008-08-07 Mark Wielaard <mwielaard@redhat.com> + + * futexes.meta: Correct name: entry. + 2008-08-01 William Cohen <wcohen@redhat.com> * helloworld.meta, traceio2.meta: Tweak test_installcheck. diff --git a/testsuite/systemtap.examples/README b/testsuite/systemtap.examples/README index 6718a55a..e505bdfb 100644 --- a/testsuite/systemtap.examples/README +++ b/testsuite/systemtap.examples/README @@ -5,5 +5,53 @@ Each script should be checked in as executable. The first line should be #! /usr/bin/env stap -There should be an accompanying ".txt" file describing what the -script does and how to use it. +There should be an accompanying ".meta" file describing what the +script does and how to use it, and how the testsuite should compile +and run it. The meta files are also used to create a txt and html +index (by keyword and subsystem) of all the examples by the +examples-index-gen.pl script. + +The meta file contains the following elements. Each element (key and +value) are on one line. If a key can have a list of values, the list +elements are separated by spaces. + +title: Descriptive title for the script (required) +name: the file name for the script, e.g. iotime.stp (required) +version: versioning if any fixes and developed can be identified (required) +author: name of author(s), "anonymous" if unknown (required) +exclusivearch: Stated if the script can only run on some arches + this concept borrowed from rpm, matches types for rpm: + x86 i386 x86_64 ppc ppc64, s390 (optional) +requires: Some scripts may require software to be available. In some cases + may need version numbering, e.g. kernel >= 2.6 + Can have multiple "requires:" tags. (optional) +keywords: List of likely words to categorize the script (required) + keywords are separated by spaces. + #FIXME have list of keyword +subsystem: List what part of the kernel the instrumentation probes (required) + audit cpu blockio file filesystem locking memory numa network + process scheduler or user-space (probes are in the user-space) +application: when user-space probing becomes available (optional) + a script might probe a particular application + this tag indicates the applicaton +status: describes the state of development for the script (required) + proposed just an idea + experimental an implemented idea, but use at own risk + alpha + beta + production should be safe to use +exit: how long do the script run? (required) + fixed exits in a fixed amount of time + user-controlled exits with "cntrl-c" + event-ended exits with some arbitrary event +output: what kind of output does the script generate? (required) + trace histogram graph sorted batch timed +scope: How much of the processes on the machine does the script watch? + system-wide or pid +arg_[0-9]+: Describe what the arguments into the script are. (optional) +description: A text description what the script does. (required) +test_check: How to check that the example compiles. + (e.g. stap -p4 iotime.stp) +test_installcheck: How to check that the example runs. + (e.g. stap iotime.stp -c "sleep 1") + diff --git a/testsuite/systemtap.examples/examples-index-gen.pl b/testsuite/systemtap.examples/examples-index-gen.pl new file mode 100644 index 00000000..9bdc1174 --- /dev/null +++ b/testsuite/systemtap.examples/examples-index-gen.pl @@ -0,0 +1,318 @@ +#! /usr/bin/perl +# Generates index files from examples .meta file info. +# Copyright (C) 2008 Red Hat Inc. +# +# 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. + +use strict; +use warnings; + +use Cwd 'abs_path'; +use File::Copy; +use File::Find; +use File::Path; +use Text::Wrap; + +my $inputdir; +if ($#ARGV >= 0) { + $inputdir = $ARGV[0]; +} else { + $inputdir = "."; +} +$inputdir = abs_path($inputdir); + +my $outputdir; +if ($#ARGV >= 1) { + $outputdir = $ARGV[1]; +} else { + $outputdir = $inputdir; +} +$outputdir = abs_path($outputdir); + +my %scripts = (); +print "Parsing .meta files in $inputdir...\n"; +find(\&parse_meta_files, $inputdir); + +my $meta; +my $subsystem; +my %subsystems; +my $keyword; +my %keywords; + +# Adds a formatted meta entry to a given file handle as text. +sub add_meta_txt(*;$) { + my($file,$meta) = @_; + + print $file "$scripts{$meta}{name} - $scripts{$meta}{title}\n"; + + # Don't output these, the description mentions all these in general. + #print $file "output: $scripts{$meta}{output}, "; + #print $file "exits: $scripts{$meta}{exit}, "; + #print $file "status: $scripts{$meta}{status}\n"; + + print $file "subsystems: $scripts{$meta}{subsystem}, "; + print $file "keywords: $scripts{$meta}{keywords}\n\n"; + + $Text::Wrap::columns = 72; + my $description = wrap(' ', ' ', $scripts{$meta}{description}); + print $file "$description\n\n\n"; +} + +# Adds a formatted meta entry to a given file handle as text. +sub add_meta_html(*;$) { + my($file,$meta) = @_; + + my $name = $scripts{$meta}{name}; + print $file "<li><a href=\"$name\">$name</a> "; + print $file "- $scripts{$meta}{title}<br>\n"; + + # Don't output these, the description mentions all these in general. + #print $file "output: $scripts{$meta}{output}, "; + #print $file "exits: $scripts{$meta}{exit}, "; + #print $file "status: $scripts{$meta}{status}<br>\n"; + + print $file "subsystems: $scripts{$meta}{subsystem}, "; + print $file "keywords: $scripts{$meta}{keywords}<br>\n"; + + print $file "<p>$scripts{$meta}{description}"; + print $file "</p></li>\n"; +} + +my $HEADER = "SYSTEMTAP EXAMPLES INDEX\n" + . "(see also subsystem-index.txt, keyword-index.txt)\n\n"; + +my $header_tmpl = "$inputdir/html/html_header.tmpl"; +open(TEMPLATE, "<$header_tmpl") + || die "couldn't open $header_tmpl, $!"; +my $HTMLHEADER = do { local $/; <TEMPLATE> }; +close(TEMPLATE); +my $footer_tmpl = "$inputdir/html/html_footer.tmpl"; +open(TEMPLATE, "<$footer_tmpl") + || die "couldn't open $footer_tmpl, $!"; +my $HTMLFOOTER = do { local $/; <TEMPLATE> }; +close(TEMPLATE); + +# Output full index and collect subsystems and keywords +my $fullindex = "$outputdir/index.txt"; +open (FULLINDEX, ">$fullindex") + || die "couldn't open $fullindex: $!"; +print "Creating $fullindex...\n"; +print FULLINDEX $HEADER; + +my $fullhtml = "$outputdir/index.html"; +open (FULLHTML, ">$fullhtml") + || die "couldn't open $fullhtml: $!"; +print "Creating $fullhtml...\n"; +print FULLHTML $HTMLHEADER; +print FULLHTML "<h2>All Examples</h2>\n"; +print FULLHTML "<ul>\n"; + +foreach $meta (sort keys %scripts) { + + add_meta_txt(\*FULLINDEX, $meta); + add_meta_html(\*FULLHTML, $meta); + + # Collect subsystems + foreach $subsystem (split(/ /, $scripts{$meta}{subsystem})) { + if (defined $subsystems{$subsystem}) { + push(@{$subsystems{$subsystem}}, $meta); + } else { + $subsystems{$subsystem} = [ $meta ]; + } + } + + # Collect keywords + foreach $keyword (split(/ /, $scripts{$meta}{keywords})) { + if (defined $keywords{$keyword}) { + push(@{$keywords{$keyword}}, $meta); + } else { + $keywords{$keyword} = [ $meta ]; + } + } +} +print FULLHTML "</ul>\n"; +print FULLHTML $HTMLFOOTER; +close (FULLINDEX); +close (FULLHTML); + +my $SUBHEADER = "SYSTEMTAP EXAMPLES INDEX BY SUBSYSTEM\n" + . "(see also index.txt, keyword-index.txt)\n\n"; + +# Output subsystem index +my $subindex = "$outputdir/subsystem-index.txt"; +open (SUBINDEX, ">$subindex") + || die "couldn't open $subindex: $!"; +print "Creating $subindex...\n"; +print SUBINDEX $SUBHEADER; + +my $subhtml = "$outputdir/subsystem-index.html"; +open (SUBHTML, ">$subhtml") + || die "couldn't open $subhtml: $!"; +print "Creating $subhtml...\n"; +print SUBHTML $HTMLHEADER; +print SUBHTML "<h2>Examples by Subsystem</h2>\n"; + +# On top link list +print SUBHTML "<p><tt>"; +foreach $subsystem (sort keys %subsystems) { + print SUBHTML '<a href="#' . (uc $subsystem) . '">' + . (uc $subsystem) . "</a> "; +} +print SUBHTML "</tt></p>\n"; + +foreach $subsystem (sort keys %subsystems) { + print SUBINDEX "= " . (uc $subsystem) . " =\n\n"; + print SUBHTML "<h3>" . '<a name="' . (uc $subsystem) . '">' + . (uc $subsystem) . "</a></h3>\n"; + print SUBHTML "<ul>\n"; + + foreach $meta (sort @{$subsystems{$subsystem}}) { + add_meta_txt(\*SUBINDEX,$meta); + add_meta_html(\*SUBHTML,$meta); + } + print SUBHTML "</ul>\n"; +} +print SUBHTML $HTMLFOOTER; +close (SUBINDEX); +close (SUBHTML); + +my $KEYHEADER = "SYSTEMTAP EXAMPLES INDEX BY KEYWORD\n" + . "(see also index.txt, subsystem-index.txt)\n\n"; + +# Output subsystem index +my $keyindex = "$outputdir/keyword-index.txt"; +open (KEYINDEX, ">$keyindex") + || die "couldn't open $keyindex: $!"; +print "Creating $keyindex...\n"; +print KEYINDEX $KEYHEADER; + +my $keyhtml = "$outputdir/keyword-index.html"; +open (KEYHTML, ">$keyhtml") + || die "couldn't open $keyhtml: $!"; +print "Creating $keyhtml...\n"; +print KEYHTML $HTMLHEADER; +print KEYHTML "<h2>Examples by Keyword</h2>\n"; + +# On top link list +print KEYHTML "<p><tt>"; +foreach $keyword (sort keys %keywords) { + print KEYHTML '<a href="#' . (uc $keyword) . '">' + . (uc $keyword) . "</a> "; +} +print KEYHTML "</tt></p>\n"; + +foreach $keyword (sort keys %keywords) { + print KEYINDEX "= " . (uc $keyword) . " =\n\n"; + print KEYHTML "<h3>" . '<a name="' . (uc $keyword) . '">' + . (uc $keyword) . "</a></h3>\n"; + print KEYHTML "<ul>\n"; + + foreach $meta (sort @{$keywords{$keyword}}) { + add_meta_txt(\*KEYINDEX,$meta); + add_meta_html(\*KEYHTML,$meta); + } + print KEYHTML "</ul>\n"; +} +print KEYHTML $HTMLFOOTER; +close (KEYINDEX); +close (KEYHTML); + +my @supportfiles + = ("html/systemtapcorner.gif", + "html/systemtap.css", + "html/systemtaplogo.png", + "README"); +if ($inputdir ne $outputdir) { + my $file; + print "Copying support files...\n"; + if (! -d "$outputdir/html") { + mkpath("$outputdir/html", 1, 0711); + } + foreach $file (@supportfiles) { + my $orig = "$inputdir/$file"; + my $dest = "$outputdir/$file"; + print "Copying $file to $dest...\n"; + copy($orig, $dest) or die "$file cannot be copied to $dest, $!"; + } +} + +sub parse_meta_files { + my $file = $_; + my $filename = $File::Find::name; + + if (-f $file && $file =~ /\.meta$/) { + open FILE, $file or die "couldn't open '$file': $!\n"; + + print "Parsing $filename...\n"; + + my $title; + my $name; + my $keywords; + my $subsystem; + my $status; + my $exit; + my $output; + my $description; + while (<FILE>) { + if (/^title: (.*)/) { $title = $1; } + if (/^name: (.*)/) { $name = $1; } + if (/^keywords: (.*)/) { $keywords = $1; } + if (/^subsystem: (.*)/) { $subsystem = $1; } + if (/^status: (.*)/) { $status = $1; } + if (/^exit: (.*)/) { $exit = $1; } + if (/^output: (.*)/) { $output = $1; } + if (/^description: (.*)/) { $description = $1; } + } + close FILE; + + # Remove extra whitespace + $keywords =~ s/^\s*//; + $keywords =~ s/\s*$//; + $subsystem =~ s/^\s*//; + $subsystem =~ s/\s*$//; + + # The subdir without the inputdir prefix, nor any slashes. + my $subdir = substr $File::Find::dir, (length $inputdir); + $subdir =~ s/^\///; + if ($subdir ne "") { + $name = "$subdir/$name"; + } + + my $script = { + name => $name, + title => $title, + keywords => $keywords, + subsystem => $subsystem, + status => $status, + exit => $exit, + output => $output, + description => $description + }; + + # chop off the search dir prefix. + $inputdir =~ s/\/$//; + $meta = substr $filename, (length $inputdir) + 1; + $scripts{$meta} = $script; + + # Put .stp script in output dir if necessary and create + # subdirs if they don't exist yet. + if ($inputdir ne $outputdir) { + # The subdir without the inputdir prefix, nor any slashes. + my $destdir = substr $File::Find::dir, (length $inputdir); + $destdir =~ s/^\///; + if ($subdir ne "") { + if (! -d "$outputdir/$subdir") { + mkpath("$outputdir/$subdir", 1, 0711); + } + } + my $orig = substr $name, (length $subdir); + $orig =~ s/^\///; + my $dest = "$outputdir/$name"; + print "Copying $orig to $dest...\n"; + copy($orig, $dest) or die "$orig cannot be copied to $dest, $!"; + } + } +} diff --git a/testsuite/systemtap.examples/small_demos/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp index 0d9d7c47..0d9d7c47 100755 --- a/testsuite/systemtap.examples/small_demos/ansi_colors.stp +++ b/testsuite/systemtap.examples/general/ansi_colors.stp diff --git a/testsuite/systemtap.examples/small_demos/click.wav b/testsuite/systemtap.examples/general/click.wav Binary files differindex 8214b229..8214b229 100644 --- a/testsuite/systemtap.examples/small_demos/click.wav +++ b/testsuite/systemtap.examples/general/click.wav diff --git a/testsuite/systemtap.examples/graphs.meta b/testsuite/systemtap.examples/general/graphs.meta index 60a522b3..60a522b3 100644 --- a/testsuite/systemtap.examples/graphs.meta +++ b/testsuite/systemtap.examples/general/graphs.meta diff --git a/testsuite/systemtap.examples/graphs.stp b/testsuite/systemtap.examples/general/graphs.stp index 0c8e3796..0c8e3796 100644 --- a/testsuite/systemtap.examples/graphs.stp +++ b/testsuite/systemtap.examples/general/graphs.stp diff --git a/testsuite/systemtap.examples/helloworld.meta b/testsuite/systemtap.examples/general/helloworld.meta index 60bc53f2..60bc53f2 100644 --- a/testsuite/systemtap.examples/helloworld.meta +++ b/testsuite/systemtap.examples/general/helloworld.meta diff --git a/testsuite/systemtap.examples/helloworld.stp b/testsuite/systemtap.examples/general/helloworld.stp index efe45b79..efe45b79 100755 --- a/testsuite/systemtap.examples/helloworld.stp +++ b/testsuite/systemtap.examples/general/helloworld.stp diff --git a/testsuite/systemtap.examples/small_demos/key.stp b/testsuite/systemtap.examples/general/key.stp index 6d2d6c3f..6d2d6c3f 100755 --- a/testsuite/systemtap.examples/small_demos/key.stp +++ b/testsuite/systemtap.examples/general/key.stp diff --git a/testsuite/systemtap.examples/small_demos/keyhack.stp b/testsuite/systemtap.examples/general/keyhack.stp index 3137baad..3137baad 100755 --- a/testsuite/systemtap.examples/small_demos/keyhack.stp +++ b/testsuite/systemtap.examples/general/keyhack.stp diff --git a/testsuite/systemtap.examples/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta index 3ce4b648..3ce4b648 100644 --- a/testsuite/systemtap.examples/para-callgraph.meta +++ b/testsuite/systemtap.examples/general/para-callgraph.meta diff --git a/testsuite/systemtap.examples/para-callgraph.stp b/testsuite/systemtap.examples/general/para-callgraph.stp index 1afb8837..1afb8837 100644 --- a/testsuite/systemtap.examples/para-callgraph.stp +++ b/testsuite/systemtap.examples/general/para-callgraph.stp diff --git a/testsuite/systemtap.examples/small_demos/return.wav b/testsuite/systemtap.examples/general/return.wav Binary files differindex 20f978cc..20f978cc 100644 --- a/testsuite/systemtap.examples/small_demos/return.wav +++ b/testsuite/systemtap.examples/general/return.wav diff --git a/testsuite/systemtap.examples/html/html_footer.tmpl b/testsuite/systemtap.examples/html/html_footer.tmpl new file mode 100644 index 00000000..27eccd3c --- /dev/null +++ b/testsuite/systemtap.examples/html/html_footer.tmpl @@ -0,0 +1,14 @@ + </td> + </tr> + </table> + </div> + </div> + + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td align="center" class="footer"><a href= + "http://sourceware.org/systemtap">SystemTap</a></td> + </tr> + </table> +</body> +</html> diff --git a/testsuite/systemtap.examples/html/html_header.tmpl b/testsuite/systemtap.examples/html/html_header.tmpl new file mode 100644 index 00000000..25c7e5a0 --- /dev/null +++ b/testsuite/systemtap.examples/html/html_header.tmpl @@ -0,0 +1,41 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<html> +<head> + <title>SystemTap Examples</title> + <link rel="stylesheet" href="html/systemtap.css" type="text/css"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta http-equiv="Content-Style-Type" content="text/css"> +</head> + +<body> + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td valign="bottom" height="80"><img src="html/systemtaplogo.png" + alt="SystemTap logo" width="165" height="25"></td> + <td valign="bottom" class="topnavright" align="right"> + <a href="http://sourceware.org/systemtap/">SystemTap</a> | + </td> + </tr> + </table> + + <div class="mainbackground"> + <div class="maintextregion"> + <img src="html/systemtapcorner.gif"> + <table cellspacing="2" cellpadding="4" border="0" width="99%" + style="margin-top:17;"> + <tr> + <td width="200"> </td> + <td valign="bottom"><h1>Examples</h1></td> + </tr> + <tr> + <td> </td> + <td valign="top"> + + <h2>Example Indexes</h2> + <ul> + <li><a href="index.html">All Examples</a></li> + <li><a href="subsystem-index.html">By Subsystem</a></li> + <li><a href="keyword-index.html">By Keyword</a></li> + </ul> + diff --git a/testsuite/systemtap.examples/html/systemtap.css b/testsuite/systemtap.examples/html/systemtap.css new file mode 100644 index 00000000..445d95f4 --- /dev/null +++ b/testsuite/systemtap.examples/html/systemtap.css @@ -0,0 +1,164 @@ +body { + background-color: #cccccc; +} + +.topnavright { + color: #787878; + text-align: right; + font-family: verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 14px; + margin-right: 10px; +} + +.topnavright a:link { + text-decoration: none; + color: #944E0F; +} + +.topnavright a:visited { + text-decoration: none; + color: #944E0F; +} + +div.mainbackground { + background-color: #ffffff; + padding: 17 17 17 17; +} + +div.maintextregion { + background-color: #5b5b5b; + color: #ffffff; +} + +div.maintextregion h1 { + color: #F38019; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 28px +} + +div.maintextregion h2 { + color: #F38019; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + margin-bottom: 2px; + font-size: 18px; + margin-top: 28px; +} + +div.maintextregion h4 { + color: #ffffff; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight: bold; +} + +div.maintextregion p { + color: #ffffff; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 14px; + line-height: 150%; + text-align: justify; +} + +div.maintextregion ul { + color: #ffffff; + list-style-type: square; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 14px; + line-height: 150%; + text-align: justify; +} + +div.maintextregion td ul ul { + color: #ffffff; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; +} + +div.maintextregion dt { + color: #ffffff; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + margin-top: 10px; +} + +div.maintextregion pre { + color: #ffffff; + font-size: 14px; +} + +div.maintextregion td pre { + color: #ffffff; + font-size: 14px; +} + +div.maintextregion dd { + color: #ffffff; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 14px; + line-height: 150%; + text-align: justify; + margin-left: 10px; +} + +div.maintextregion table { + margin-top: 20; +} + +div.maintextregion th { + color: #ffffff; + background-color: #494949; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + text-align: left; +} + +div.maintextregion tr.odd { + color: #ffffff; + background-color: #393939; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; +} + +div.maintextregion tr.even { + color: #ffffff; + background-color: #4d4d4d; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; +} + +div.maintextregion form { + color: #ffffff; + background-color: #4d4d4d; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + border: thin solid #424242; + padding: 6; +} + +div.maintextregion dd.left { + color: #ffffff; + margin-left: 0; +} + +a:link { + color: #ff9600; + text-decoration: none; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; +} + +a:visited { + color: #ff9600; + text-decoration: none; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; +} + +.imgholder { + text-align: center; + padding: 8; +} +.footer a:link { + text-decoration: none; + color: #944E0F; + font-size: 12px; + font-weight: bold; +} +.footer a:visited { + text-decoration: none; + color: #944E0F; + font-size: 12px; + font-weight: bold; +} + diff --git a/testsuite/systemtap.examples/html/systemtapcorner.gif b/testsuite/systemtap.examples/html/systemtapcorner.gif Binary files differnew file mode 100644 index 00000000..c44f2c75 --- /dev/null +++ b/testsuite/systemtap.examples/html/systemtapcorner.gif diff --git a/testsuite/systemtap.examples/html/systemtaplogo.png b/testsuite/systemtap.examples/html/systemtaplogo.png Binary files differnew file mode 100644 index 00000000..c223babd --- /dev/null +++ b/testsuite/systemtap.examples/html/systemtaplogo.png diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html new file mode 100644 index 00000000..327e9ef9 --- /dev/null +++ b/testsuite/systemtap.examples/index.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<html> +<head> + <title>SystemTap Examples</title> + <link rel="stylesheet" href="html/systemtap.css" type="text/css"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta http-equiv="Content-Style-Type" content="text/css"> +</head> + +<body> + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td valign="bottom" height="80"><img src="html/systemtaplogo.png" + alt="SystemTap logo" width="165" height="25"></td> + <td valign="bottom" class="topnavright" align="right"> + <a href="http://sourceware.org/systemtap/">SystemTap</a> | + </td> + </tr> + </table> + + <div class="mainbackground"> + <div class="maintextregion"> + <img src="html/systemtapcorner.gif"> + <table cellspacing="2" cellpadding="4" border="0" width="99%" + style="margin-top:17;"> + <tr> + <td width="200"> </td> + <td valign="bottom"><h1>Examples</h1></td> + </tr> + <tr> + <td> </td> + <td valign="top"> + + <h2>Example Indexes</h2> + <ul> + <li><a href="index.html">All Examples</a></li> + <li><a href="subsystem-index.html">By Subsystem</a></li> + <li><a href="keyword-index.html">By Keyword</a></li> + </ul> + +<h2>All Examples</h2> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +<li><a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br> +subsystems: none, keywords: simple<br> +<p>A basic "Hello World" program implemented in SystemTap script. It prints out "hello world" message and then immediately exits.</p></li> +<li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Tracing Calls for Sections of Code<br> +subsystems: kernel, keywords: trace callgraph<br> +<p>The script takes two arguments: the first argument is the function to starts/stops the per thread call graph traces and the second argument is the list of functions to generate trace information on. The script prints out a timestap for the thread, the function name and pid, followed by entry or exit symboly and function name.</p></li> +<li><a href="io/disktop.stp">io/disktop.stp</a> - Summarize Disk Read/Write Traffic<br> +subsystems: disk, keywords: disk<br> +<p>Get the status of reading/writing disk every 5 seconds, output top ten entries during that period.</p></li> +<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br> +subsystems: io, keywords: io backtrace<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/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +<li><a href="io/iotop.stp">io/iotop.stp</a> - Periodically Print I/O Activity by Process Name<br> +subsystems: io, keywords: io<br> +<p>Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.</p></li> +<li><a href="io/traceio.stp">io/traceio.stp</a> - Track Cumulative I/O Activity by Process Name<br> +subsystems: io, keywords: io<br> +<p>Every second print out the top ten executables sorted in descending order based on cumulative I/O traffic observed.</p></li> +<li><a href="io/traceio2.stp">io/traceio2.stp</a> - Watch I/O Activity on a Particular Device<br> +subsystems: io, keywords: io<br> +<p>Print out the executable name and process number as reads and writes to the specified device occur.</p></li> +<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> +subsystems: network, keywords: network traffic per-process<br> +<p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> +<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> +subsystems: network, keywords: network socket<br> +<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li> +<li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> +subsystems: locking, keywords: syscall locking futex<br> +<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li> +<li><a href="process/pf2.stp">process/pf2.stp</a> - Profile kernel functions<br> +subsystems: kernel, keywords: profiling<br> +<p>The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.</p></li> +<li><a href="process/sig_by_pid.stp">process/sig_by_pid.stp</a> - Signal Counts by Process ID<br> +subsystems: signals, keywords: signals<br> +<p>Print signal counts by process ID in descending order.</p></li> +<li><a href="process/sig_by_proc.stp">process/sig_by_proc.stp</a> - Signal Counts by Process Name<br> +subsystems: signals, keywords: signals<br> +<p>Print signal counts by process name in descending order.</p></li> +<li><a href="process/sigkill.stp">process/sigkill.stp</a> - Track SIGKILL Signals<br> +subsystems: signals, keywords: signals<br> +<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.</p></li> +<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br> +subsystems: signals, keywords: signals<br> +<p>The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.</p></li> +<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> +subsystems: scheduler, keywords: io scheduler<br> +<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li> +<li><a href="process/sleeptime.stp">process/sleeptime.stp</a> - Trace Time Spent in nanosleep Syscalls<br> +subsystems: syscall, keywords: syscall sleep<br> +<p>The script watches each nanosleep syscall on the system. At the end of each nanosleep syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "nanosleep:" key, and the duration of the sleep in microseconds.</p></li> +<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br> +subsystems: syscall, keywords: syscall<br> +<p>The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each PID ordered from greatest to least number of syscalls.</p></li> +<li><a href="process/syscalls_by_proc.stp">process/syscalls_by_proc.stp</a> - System-Wide Count of Syscalls by Executable<br> +subsystems: syscall, keywords: syscall<br> +<p>The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each executable ordered from greates to least number of syscalls.</p></li> +<li><a href="process/wait4time.stp">process/wait4time.stp</a> - Trace Time Spent in wait4 Syscalls<br> +subsystems: syscall, keywords: syscall wait4<br> +<p>The script watches each wait4 syscall on the system. At the end of each wait4 syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "wait4:" key, the duration of the wait and the PID that the wait4 was waiting for. If the waited for PID is not specified , it is "-1".</p></li> +<li><a href="profiling/functioncallcount.stp">profiling/functioncallcount.stp</a> - Count Times Functions Called<br> +subsystems: kernel, keywords: profiling functions<br> +<p>The functioncallcount.stp script takes one argument, a list of functions to probe. The script will run and count the number of times that each of the functions on the list is called. On exit the script will print a sorted list from most frequently to least frequently called function.</p></li> +<li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br> +subsystems: kernel, keywords: profiling<br> +<p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li> +</ul> + </td> + </tr> + </table> + </div> + </div> + + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td align="center" class="footer"><a href= + "http://sourceware.org/systemtap">SystemTap</a></td> + </tr> + </table> +</body> +</html> diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt new file mode 100644 index 00000000..aed6f457 --- /dev/null +++ b/testsuite/systemtap.examples/index.txt @@ -0,0 +1,214 @@ +SYSTEMTAP EXAMPLES INDEX +(see also subsystem-index.txt, keyword-index.txt) + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + +general/helloworld.stp - SystemTap "Hello World" Program +subsystems: none, keywords: simple + + A basic "Hello World" program implemented in SystemTap script. It + prints out "hello world" message and then immediately exits. + + +general/para-callgraph.stp - Tracing Calls for Sections of Code +subsystems: kernel, keywords: trace callgraph + + The script takes two arguments: the first argument is the function to + starts/stops the per thread call graph traces and the second argument + is the list of functions to generate trace information on. The script + prints out a timestap for the thread, the function name and pid, + followed by entry or exit symboly and function name. + + +io/disktop.stp - Summarize Disk Read/Write Traffic +subsystems: disk, keywords: disk + + Get the status of reading/writing disk every 5 seconds, output top + ten entries during that period. + + +io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call +subsystems: io, keywords: io backtrace + + 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. + + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + +io/iotop.stp - Periodically Print I/O Activity by Process Name +subsystems: io, keywords: io + + Every five seconds print out the top ten executables generating I/O + traffic during that interval sorted in descending order. + + +io/traceio.stp - Track Cumulative I/O Activity by Process Name +subsystems: io, keywords: io + + Every second print out the top ten executables sorted in descending + order based on cumulative I/O traffic observed. + + +io/traceio2.stp - Watch I/O Activity on a Particular Device +subsystems: io, keywords: io + + Print out the executable name and process number as reads and writes + to the specified device occur. + + +network/nettop.stp - Periodic Listing of Processes Using Network Interfaces +subsystems: network, keywords: network traffic per-process + + Every five seconds the nettop.stp script prints out a list of + processed (PID and command) with the number of packets sent/received + and the amount of data sent/received by the process during that + interval. + + +network/socket-trace.stp - Trace Functions called in Network Socket Code +subsystems: network, keywords: network socket + + The script instrument each of the functions inn the Linux kernel's + net/socket.c file. The script prints out trace. The first element of + a line is time delta in microseconds from the previous entry. This + is followed by the command name and the PID. The "->" and "<-" + indicates function entry and function exit, respectively. The last + element of the line is the function name. + + +process/futexes.stp - System-Wide Futex Contention +subsystems: locking, keywords: syscall locking futex + + The script watches the futex syscall on the system. On exit the + futexes address, the number of contentions, and the average time for + each contention on the futex are printed from lowest pid number to + highest. + + +process/pf2.stp - Profile kernel functions +subsystems: kernel, keywords: profiling + + The pf2.stp script sets up time-based sampling. Every five seconds it + prints out a sorted list with the top ten kernel functions with + samples. + + +process/sig_by_pid.stp - Signal Counts by Process ID +subsystems: signals, keywords: signals + + Print signal counts by process ID in descending order. + + +process/sig_by_proc.stp - Signal Counts by Process Name +subsystems: signals, keywords: signals + + Print signal counts by process name in descending order. + + +process/sigkill.stp - Track SIGKILL Signals +subsystems: signals, keywords: signals + + The script traces any SIGKILL signals. When that SIGKILL signal is + sent to a process, the script prints out the signal name, the + desination executable and process ID, the executable name user ID + that sent the signal. + + +process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +subsystems: signals, keywords: signals + + The script watches for a particular signal sent to a specific + process. When that signal is sent to the specified process, the + script prints out the PID and executable of the process sending the + signal, the PID and executable name of the process receiving the + signal, and the signal number and name. + + +process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations +subsystems: scheduler, keywords: io scheduler + + The script monitor time threads spend waiting for IO operations (in + "D" state) in the wait_for_completion function. If a thread spends + over 10ms wall-clock time waiting, information is printed out + describing the thread number and executable name. When slow the + wait_for_completion function complete, backtraces for the long + duration calls are printed out. + + +process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls +subsystems: syscall, keywords: syscall sleep + + The script watches each nanosleep syscall on the system. At the end + of each nanosleep syscall the script prints out a line with a + timestamp in microseconds, the pid, the executable name in + paretheses, the "nanosleep:" key, and the duration of the sleep in + microseconds. + + +process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +subsystems: syscall, keywords: syscall + + The script watches all syscall on the system. On exit the script + prints a list showing the number of systemcalls executed by each PID + ordered from greatest to least number of syscalls. + + +process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable +subsystems: syscall, keywords: syscall + + The script watches all syscall on the system. On exit the script + prints a list showing the number of systemcalls executed by each + executable ordered from greates to least number of syscalls. + + +process/wait4time.stp - Trace Time Spent in wait4 Syscalls +subsystems: syscall, keywords: syscall wait4 + + The script watches each wait4 syscall on the system. At the end of + each wait4 syscall the script prints out a line with a timestamp in + microseconds, the pid, the executable name in paretheses, the + "wait4:" key, the duration of the wait and the PID that the wait4 was + waiting for. If the waited for PID is not specified , it is "-1". + + +profiling/functioncallcount.stp - Count Times Functions Called +subsystems: kernel, keywords: profiling functions + + The functioncallcount.stp script takes one argument, a list of + functions to probe. The script will run and count the number of times + that each of the functions on the list is called. On exit the script + will print a sorted list from most frequently to least frequently + called function. + + +profiling/thread-times.stp - Profile kernel functions +subsystems: kernel, keywords: profiling + + The thread-times.stp script sets up time-based sampling. Every five + seconds it prints out a sorted list with the top twenty processes + with samples broken down into percentage total time spent in + user-space and kernel-space. + + diff --git a/testsuite/systemtap.examples/disktop.meta b/testsuite/systemtap.examples/io/disktop.meta index b063075b..b063075b 100644 --- a/testsuite/systemtap.examples/disktop.meta +++ b/testsuite/systemtap.examples/io/disktop.meta diff --git a/testsuite/systemtap.examples/disktop.stp b/testsuite/systemtap.examples/io/disktop.stp index 2637d735..2637d735 100644 --- a/testsuite/systemtap.examples/disktop.stp +++ b/testsuite/systemtap.examples/io/disktop.stp diff --git a/testsuite/systemtap.examples/io_submit.meta b/testsuite/systemtap.examples/io/io_submit.meta index 911cb837..911cb837 100644 --- a/testsuite/systemtap.examples/io_submit.meta +++ b/testsuite/systemtap.examples/io/io_submit.meta diff --git a/testsuite/systemtap.examples/io_submit.stp b/testsuite/systemtap.examples/io/io_submit.stp index 735dd6f9..735dd6f9 100644 --- a/testsuite/systemtap.examples/io_submit.stp +++ b/testsuite/systemtap.examples/io/io_submit.stp diff --git a/testsuite/systemtap.examples/iostat-scsi.stp b/testsuite/systemtap.examples/io/iostat-scsi.stp index ef778e53..ef778e53 100755 --- a/testsuite/systemtap.examples/iostat-scsi.stp +++ b/testsuite/systemtap.examples/io/iostat-scsi.stp diff --git a/testsuite/systemtap.examples/iostat-scsi.txt b/testsuite/systemtap.examples/io/iostat-scsi.txt index 8222f659..8222f659 100644 --- a/testsuite/systemtap.examples/iostat-scsi.txt +++ b/testsuite/systemtap.examples/io/iostat-scsi.txt diff --git a/testsuite/systemtap.examples/iotime.meta b/testsuite/systemtap.examples/io/iotime.meta index f656ff85..f656ff85 100644 --- a/testsuite/systemtap.examples/iotime.meta +++ b/testsuite/systemtap.examples/io/iotime.meta diff --git a/testsuite/systemtap.examples/iotime.stp b/testsuite/systemtap.examples/io/iotime.stp index 4fbd6b6e..4fbd6b6e 100755 --- a/testsuite/systemtap.examples/iotime.stp +++ b/testsuite/systemtap.examples/io/iotime.stp diff --git a/testsuite/systemtap.examples/iotop.meta b/testsuite/systemtap.examples/io/iotop.meta index d5331eda..d5331eda 100644 --- a/testsuite/systemtap.examples/iotop.meta +++ b/testsuite/systemtap.examples/io/iotop.meta diff --git a/testsuite/systemtap.examples/iotop.stp b/testsuite/systemtap.examples/io/iotop.stp index 6050343c..6050343c 100644 --- a/testsuite/systemtap.examples/iotop.stp +++ b/testsuite/systemtap.examples/io/iotop.stp diff --git a/testsuite/systemtap.examples/traceio.meta b/testsuite/systemtap.examples/io/traceio.meta index da0b99f3..da0b99f3 100644 --- a/testsuite/systemtap.examples/traceio.meta +++ b/testsuite/systemtap.examples/io/traceio.meta diff --git a/testsuite/systemtap.examples/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index d3757c23..d3757c23 100644 --- a/testsuite/systemtap.examples/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp diff --git a/testsuite/systemtap.examples/traceio2.meta b/testsuite/systemtap.examples/io/traceio2.meta index 4b63108c..4b63108c 100644 --- a/testsuite/systemtap.examples/traceio2.meta +++ b/testsuite/systemtap.examples/io/traceio2.meta diff --git a/testsuite/systemtap.examples/traceio2.stp b/testsuite/systemtap.examples/io/traceio2.stp index 656c38b3..656c38b3 100644 --- a/testsuite/systemtap.examples/traceio2.stp +++ b/testsuite/systemtap.examples/io/traceio2.stp diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html new file mode 100644 index 00000000..5d1c79e0 --- /dev/null +++ b/testsuite/systemtap.examples/keyword-index.html @@ -0,0 +1,258 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<html> +<head> + <title>SystemTap Examples</title> + <link rel="stylesheet" href="html/systemtap.css" type="text/css"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta http-equiv="Content-Style-Type" content="text/css"> +</head> + +<body> + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td valign="bottom" height="80"><img src="html/systemtaplogo.png" + alt="SystemTap logo" width="165" height="25"></td> + <td valign="bottom" class="topnavright" align="right"> + <a href="http://sourceware.org/systemtap/">SystemTap</a> | + </td> + </tr> + </table> + + <div class="mainbackground"> + <div class="maintextregion"> + <img src="html/systemtapcorner.gif"> + <table cellspacing="2" cellpadding="4" border="0" width="99%" + style="margin-top:17;"> + <tr> + <td width="200"> </td> + <td valign="bottom"><h1>Examples</h1></td> + </tr> + <tr> + <td> </td> + <td valign="top"> + + <h2>Example Indexes</h2> + <ul> + <li><a href="index.html">All Examples</a></li> + <li><a href="subsystem-index.html">By Subsystem</a></li> + <li><a href="keyword-index.html">By Keyword</a></li> + </ul> + +<h2>Examples by Keyword</h2> +<p><tt><a href="#BACKTRACE">BACKTRACE</a> <a href="#CALLGRAPH">CALLGRAPH</a> <a href="#CPU">CPU</a> <a href="#DISK">DISK</a> <a href="#FUNCTIONS">FUNCTIONS</a> <a href="#FUTEX">FUTEX</a> <a href="#GRAPH">GRAPH</a> <a href="#IO">IO</a> <a href="#LOCKING">LOCKING</a> <a href="#NETWORK">NETWORK</a> <a href="#PER-PROCESS">PER-PROCESS</a> <a href="#PROFILING">PROFILING</a> <a href="#READ">READ</a> <a href="#SCHEDULER">SCHEDULER</a> <a href="#SIGNALS">SIGNALS</a> <a href="#SIMPLE">SIMPLE</a> <a href="#SLEEP">SLEEP</a> <a href="#SOCKET">SOCKET</a> <a href="#SYSCALL">SYSCALL</a> <a href="#TIME">TIME</a> <a href="#TRACE">TRACE</a> <a href="#TRAFFIC">TRAFFIC</a> <a href="#USE">USE</a> <a href="#WAIT4">WAIT4</a> <a href="#WRITE">WRITE</a> </tt></p> +<h3><a name="BACKTRACE">BACKTRACE</a></h3> +<ul> +<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br> +subsystems: io, keywords: io backtrace<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> +</ul> +<h3><a name="CALLGRAPH">CALLGRAPH</a></h3> +<ul> +<li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Tracing Calls for Sections of Code<br> +subsystems: kernel, keywords: trace callgraph<br> +<p>The script takes two arguments: the first argument is the function to starts/stops the per thread call graph traces and the second argument is the list of functions to generate trace information on. The script prints out a timestap for the thread, the function name and pid, followed by entry or exit symboly and function name.</p></li> +</ul> +<h3><a name="CPU">CPU</a></h3> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +</ul> +<h3><a name="DISK">DISK</a></h3> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +<li><a href="io/disktop.stp">io/disktop.stp</a> - Summarize Disk Read/Write Traffic<br> +subsystems: disk, keywords: disk<br> +<p>Get the status of reading/writing disk every 5 seconds, output top ten entries during that period.</p></li> +</ul> +<h3><a name="FUNCTIONS">FUNCTIONS</a></h3> +<ul> +<li><a href="profiling/functioncallcount.stp">profiling/functioncallcount.stp</a> - Count Times Functions Called<br> +subsystems: kernel, keywords: profiling functions<br> +<p>The functioncallcount.stp script takes one argument, a list of functions to probe. The script will run and count the number of times that each of the functions on the list is called. On exit the script will print a sorted list from most frequently to least frequently called function.</p></li> +</ul> +<h3><a name="FUTEX">FUTEX</a></h3> +<ul> +<li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> +subsystems: locking, keywords: syscall locking futex<br> +<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li> +</ul> +<h3><a name="GRAPH">GRAPH</a></h3> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +</ul> +<h3><a name="IO">IO</a></h3> +<ul> +<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br> +subsystems: io, keywords: io backtrace<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/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +<li><a href="io/iotop.stp">io/iotop.stp</a> - Periodically Print I/O Activity by Process Name<br> +subsystems: io, keywords: io<br> +<p>Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.</p></li> +<li><a href="io/traceio.stp">io/traceio.stp</a> - Track Cumulative I/O Activity by Process Name<br> +subsystems: io, keywords: io<br> +<p>Every second print out the top ten executables sorted in descending order based on cumulative I/O traffic observed.</p></li> +<li><a href="io/traceio2.stp">io/traceio2.stp</a> - Watch I/O Activity on a Particular Device<br> +subsystems: io, keywords: io<br> +<p>Print out the executable name and process number as reads and writes to the specified device occur.</p></li> +<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> +subsystems: scheduler, keywords: io scheduler<br> +<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li> +</ul> +<h3><a name="LOCKING">LOCKING</a></h3> +<ul> +<li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> +subsystems: locking, keywords: syscall locking futex<br> +<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li> +</ul> +<h3><a name="NETWORK">NETWORK</a></h3> +<ul> +<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> +subsystems: network, keywords: network traffic per-process<br> +<p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> +<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> +subsystems: network, keywords: network socket<br> +<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li> +</ul> +<h3><a name="PER-PROCESS">PER-PROCESS</a></h3> +<ul> +<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> +subsystems: network, keywords: network traffic per-process<br> +<p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> +</ul> +<h3><a name="PROFILING">PROFILING</a></h3> +<ul> +<li><a href="process/pf2.stp">process/pf2.stp</a> - Profile kernel functions<br> +subsystems: kernel, keywords: profiling<br> +<p>The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.</p></li> +<li><a href="profiling/functioncallcount.stp">profiling/functioncallcount.stp</a> - Count Times Functions Called<br> +subsystems: kernel, keywords: profiling functions<br> +<p>The functioncallcount.stp script takes one argument, a list of functions to probe. The script will run and count the number of times that each of the functions on the list is called. On exit the script will print a sorted list from most frequently to least frequently called function.</p></li> +<li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br> +subsystems: kernel, keywords: profiling<br> +<p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li> +</ul> +<h3><a name="READ">READ</a></h3> +<ul> +<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +</ul> +<h3><a name="SCHEDULER">SCHEDULER</a></h3> +<ul> +<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> +subsystems: scheduler, keywords: io scheduler<br> +<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li> +</ul> +<h3><a name="SIGNALS">SIGNALS</a></h3> +<ul> +<li><a href="process/sig_by_pid.stp">process/sig_by_pid.stp</a> - Signal Counts by Process ID<br> +subsystems: signals, keywords: signals<br> +<p>Print signal counts by process ID in descending order.</p></li> +<li><a href="process/sig_by_proc.stp">process/sig_by_proc.stp</a> - Signal Counts by Process Name<br> +subsystems: signals, keywords: signals<br> +<p>Print signal counts by process name in descending order.</p></li> +<li><a href="process/sigkill.stp">process/sigkill.stp</a> - Track SIGKILL Signals<br> +subsystems: signals, keywords: signals<br> +<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.</p></li> +<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br> +subsystems: signals, keywords: signals<br> +<p>The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.</p></li> +</ul> +<h3><a name="SIMPLE">SIMPLE</a></h3> +<ul> +<li><a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br> +subsystems: none, keywords: simple<br> +<p>A basic "Hello World" program implemented in SystemTap script. It prints out "hello world" message and then immediately exits.</p></li> +</ul> +<h3><a name="SLEEP">SLEEP</a></h3> +<ul> +<li><a href="process/sleeptime.stp">process/sleeptime.stp</a> - Trace Time Spent in nanosleep Syscalls<br> +subsystems: syscall, keywords: syscall sleep<br> +<p>The script watches each nanosleep syscall on the system. At the end of each nanosleep syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "nanosleep:" key, and the duration of the sleep in microseconds.</p></li> +</ul> +<h3><a name="SOCKET">SOCKET</a></h3> +<ul> +<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> +subsystems: network, keywords: network socket<br> +<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li> +</ul> +<h3><a name="SYSCALL">SYSCALL</a></h3> +<ul> +<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +<li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> +subsystems: locking, keywords: syscall locking futex<br> +<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li> +<li><a href="process/sleeptime.stp">process/sleeptime.stp</a> - Trace Time Spent in nanosleep Syscalls<br> +subsystems: syscall, keywords: syscall sleep<br> +<p>The script watches each nanosleep syscall on the system. At the end of each nanosleep syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "nanosleep:" key, and the duration of the sleep in microseconds.</p></li> +<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br> +subsystems: syscall, keywords: syscall<br> +<p>The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each PID ordered from greatest to least number of syscalls.</p></li> +<li><a href="process/syscalls_by_proc.stp">process/syscalls_by_proc.stp</a> - System-Wide Count of Syscalls by Executable<br> +subsystems: syscall, keywords: syscall<br> +<p>The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each executable ordered from greates to least number of syscalls.</p></li> +<li><a href="process/wait4time.stp">process/wait4time.stp</a> - Trace Time Spent in wait4 Syscalls<br> +subsystems: syscall, keywords: syscall wait4<br> +<p>The script watches each wait4 syscall on the system. At the end of each wait4 syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "wait4:" key, the duration of the wait and the PID that the wait4 was waiting for. If the waited for PID is not specified , it is "-1".</p></li> +</ul> +<h3><a name="TIME">TIME</a></h3> +<ul> +<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +</ul> +<h3><a name="TRACE">TRACE</a></h3> +<ul> +<li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Tracing Calls for Sections of Code<br> +subsystems: kernel, keywords: trace callgraph<br> +<p>The script takes two arguments: the first argument is the function to starts/stops the per thread call graph traces and the second argument is the list of functions to generate trace information on. The script prints out a timestap for the thread, the function name and pid, followed by entry or exit symboly and function name.</p></li> +</ul> +<h3><a name="TRAFFIC">TRAFFIC</a></h3> +<ul> +<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> +subsystems: network, keywords: network traffic per-process<br> +<p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> +</ul> +<h3><a name="USE">USE</a></h3> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +</ul> +<h3><a name="WAIT4">WAIT4</a></h3> +<ul> +<li><a href="process/wait4time.stp">process/wait4time.stp</a> - Trace Time Spent in wait4 Syscalls<br> +subsystems: syscall, keywords: syscall wait4<br> +<p>The script watches each wait4 syscall on the system. At the end of each wait4 syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "wait4:" key, the duration of the wait and the PID that the wait4 was waiting for. If the waited for PID is not specified , it is "-1".</p></li> +</ul> +<h3><a name="WRITE">WRITE</a></h3> +<ul> +<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +</ul> + </td> + </tr> + </table> + </div> + </div> + + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td align="center" class="footer"><a href= + "http://sourceware.org/systemtap">SystemTap</a></td> + </tr> + </table> +</body> +</html> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt new file mode 100644 index 00000000..d2e20148 --- /dev/null +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -0,0 +1,458 @@ +SYSTEMTAP EXAMPLES INDEX BY KEYWORD +(see also index.txt, subsystem-index.txt) + += BACKTRACE = + +io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call +subsystems: io, keywords: io backtrace + + 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. + + += CALLGRAPH = + +general/para-callgraph.stp - Tracing Calls for Sections of Code +subsystems: kernel, keywords: trace callgraph + + The script takes two arguments: the first argument is the function to + starts/stops the per thread call graph traces and the second argument + is the list of functions to generate trace information on. The script + prints out a timestap for the thread, the function name and pid, + followed by entry or exit symboly and function name. + + += CPU = + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + += DISK = + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + +io/disktop.stp - Summarize Disk Read/Write Traffic +subsystems: disk, keywords: disk + + Get the status of reading/writing disk every 5 seconds, output top + ten entries during that period. + + += FUNCTIONS = + +profiling/functioncallcount.stp - Count Times Functions Called +subsystems: kernel, keywords: profiling functions + + The functioncallcount.stp script takes one argument, a list of + functions to probe. The script will run and count the number of times + that each of the functions on the list is called. On exit the script + will print a sorted list from most frequently to least frequently + called function. + + += FUTEX = + +process/futexes.stp - System-Wide Futex Contention +subsystems: locking, keywords: syscall locking futex + + The script watches the futex syscall on the system. On exit the + futexes address, the number of contentions, and the average time for + each contention on the futex are printed from lowest pid number to + highest. + + += GRAPH = + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + += IO = + +io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call +subsystems: io, keywords: io backtrace + + 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. + + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + +io/iotop.stp - Periodically Print I/O Activity by Process Name +subsystems: io, keywords: io + + Every five seconds print out the top ten executables generating I/O + traffic during that interval sorted in descending order. + + +io/traceio.stp - Track Cumulative I/O Activity by Process Name +subsystems: io, keywords: io + + Every second print out the top ten executables sorted in descending + order based on cumulative I/O traffic observed. + + +io/traceio2.stp - Watch I/O Activity on a Particular Device +subsystems: io, keywords: io + + Print out the executable name and process number as reads and writes + to the specified device occur. + + +process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations +subsystems: scheduler, keywords: io scheduler + + The script monitor time threads spend waiting for IO operations (in + "D" state) in the wait_for_completion function. If a thread spends + over 10ms wall-clock time waiting, information is printed out + describing the thread number and executable name. When slow the + wait_for_completion function complete, backtraces for the long + duration calls are printed out. + + += LOCKING = + +process/futexes.stp - System-Wide Futex Contention +subsystems: locking, keywords: syscall locking futex + + The script watches the futex syscall on the system. On exit the + futexes address, the number of contentions, and the average time for + each contention on the futex are printed from lowest pid number to + highest. + + += NETWORK = + +network/nettop.stp - Periodic Listing of Processes Using Network Interfaces +subsystems: network, keywords: network traffic per-process + + Every five seconds the nettop.stp script prints out a list of + processed (PID and command) with the number of packets sent/received + and the amount of data sent/received by the process during that + interval. + + +network/socket-trace.stp - Trace Functions called in Network Socket Code +subsystems: network, keywords: network socket + + The script instrument each of the functions inn the Linux kernel's + net/socket.c file. The script prints out trace. The first element of + a line is time delta in microseconds from the previous entry. This + is followed by the command name and the PID. The "->" and "<-" + indicates function entry and function exit, respectively. The last + element of the line is the function name. + + += PER-PROCESS = + +network/nettop.stp - Periodic Listing of Processes Using Network Interfaces +subsystems: network, keywords: network traffic per-process + + Every five seconds the nettop.stp script prints out a list of + processed (PID and command) with the number of packets sent/received + and the amount of data sent/received by the process during that + interval. + + += PROFILING = + +process/pf2.stp - Profile kernel functions +subsystems: kernel, keywords: profiling + + The pf2.stp script sets up time-based sampling. Every five seconds it + prints out a sorted list with the top ten kernel functions with + samples. + + +profiling/functioncallcount.stp - Count Times Functions Called +subsystems: kernel, keywords: profiling functions + + The functioncallcount.stp script takes one argument, a list of + functions to probe. The script will run and count the number of times + that each of the functions on the list is called. On exit the script + will print a sorted list from most frequently to least frequently + called function. + + +profiling/thread-times.stp - Profile kernel functions +subsystems: kernel, keywords: profiling + + The thread-times.stp script sets up time-based sampling. Every five + seconds it prints out a sorted list with the top twenty processes + with samples broken down into percentage total time spent in + user-space and kernel-space. + + += READ = + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + += SCHEDULER = + +process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations +subsystems: scheduler, keywords: io scheduler + + The script monitor time threads spend waiting for IO operations (in + "D" state) in the wait_for_completion function. If a thread spends + over 10ms wall-clock time waiting, information is printed out + describing the thread number and executable name. When slow the + wait_for_completion function complete, backtraces for the long + duration calls are printed out. + + += SIGNALS = + +process/sig_by_pid.stp - Signal Counts by Process ID +subsystems: signals, keywords: signals + + Print signal counts by process ID in descending order. + + +process/sig_by_proc.stp - Signal Counts by Process Name +subsystems: signals, keywords: signals + + Print signal counts by process name in descending order. + + +process/sigkill.stp - Track SIGKILL Signals +subsystems: signals, keywords: signals + + The script traces any SIGKILL signals. When that SIGKILL signal is + sent to a process, the script prints out the signal name, the + desination executable and process ID, the executable name user ID + that sent the signal. + + +process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +subsystems: signals, keywords: signals + + The script watches for a particular signal sent to a specific + process. When that signal is sent to the specified process, the + script prints out the PID and executable of the process sending the + signal, the PID and executable name of the process receiving the + signal, and the signal number and name. + + += SIMPLE = + +general/helloworld.stp - SystemTap "Hello World" Program +subsystems: none, keywords: simple + + A basic "Hello World" program implemented in SystemTap script. It + prints out "hello world" message and then immediately exits. + + += SLEEP = + +process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls +subsystems: syscall, keywords: syscall sleep + + The script watches each nanosleep syscall on the system. At the end + of each nanosleep syscall the script prints out a line with a + timestamp in microseconds, the pid, the executable name in + paretheses, the "nanosleep:" key, and the duration of the sleep in + microseconds. + + += SOCKET = + +network/socket-trace.stp - Trace Functions called in Network Socket Code +subsystems: network, keywords: network socket + + The script instrument each of the functions inn the Linux kernel's + net/socket.c file. The script prints out trace. The first element of + a line is time delta in microseconds from the previous entry. This + is followed by the command name and the PID. The "->" and "<-" + indicates function entry and function exit, respectively. The last + element of the line is the function name. + + += SYSCALL = + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + +process/futexes.stp - System-Wide Futex Contention +subsystems: locking, keywords: syscall locking futex + + The script watches the futex syscall on the system. On exit the + futexes address, the number of contentions, and the average time for + each contention on the futex are printed from lowest pid number to + highest. + + +process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls +subsystems: syscall, keywords: syscall sleep + + The script watches each nanosleep syscall on the system. At the end + of each nanosleep syscall the script prints out a line with a + timestamp in microseconds, the pid, the executable name in + paretheses, the "nanosleep:" key, and the duration of the sleep in + microseconds. + + +process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +subsystems: syscall, keywords: syscall + + The script watches all syscall on the system. On exit the script + prints a list showing the number of systemcalls executed by each PID + ordered from greatest to least number of syscalls. + + +process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable +subsystems: syscall, keywords: syscall + + The script watches all syscall on the system. On exit the script + prints a list showing the number of systemcalls executed by each + executable ordered from greates to least number of syscalls. + + +process/wait4time.stp - Trace Time Spent in wait4 Syscalls +subsystems: syscall, keywords: syscall wait4 + + The script watches each wait4 syscall on the system. At the end of + each wait4 syscall the script prints out a line with a timestamp in + microseconds, the pid, the executable name in paretheses, the + "wait4:" key, the duration of the wait and the PID that the wait4 was + waiting for. If the waited for PID is not specified , it is "-1". + + += TIME = + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + += TRACE = + +general/para-callgraph.stp - Tracing Calls for Sections of Code +subsystems: kernel, keywords: trace callgraph + + The script takes two arguments: the first argument is the function to + starts/stops the per thread call graph traces and the second argument + is the list of functions to generate trace information on. The script + prints out a timestap for the thread, the function name and pid, + followed by entry or exit symboly and function name. + + += TRAFFIC = + +network/nettop.stp - Periodic Listing of Processes Using Network Interfaces +subsystems: network, keywords: network traffic per-process + + Every five seconds the nettop.stp script prints out a list of + processed (PID and command) with the number of packets sent/received + and the amount of data sent/received by the process during that + interval. + + += USE = + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + += WAIT4 = + +process/wait4time.stp - Trace Time Spent in wait4 Syscalls +subsystems: syscall, keywords: syscall wait4 + + The script watches each wait4 syscall on the system. At the end of + each wait4 syscall the script prints out a line with a timestamp in + microseconds, the pid, the executable name in paretheses, the + "wait4:" key, the duration of the wait and the PID that the wait4 was + waiting for. If the waited for PID is not specified , it is "-1". + + += WRITE = + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + diff --git a/testsuite/systemtap.examples/nettop.meta b/testsuite/systemtap.examples/network/nettop.meta index 61d1c153..61d1c153 100644 --- a/testsuite/systemtap.examples/nettop.meta +++ b/testsuite/systemtap.examples/network/nettop.meta diff --git a/testsuite/systemtap.examples/nettop.stp b/testsuite/systemtap.examples/network/nettop.stp index 96db413a..96db413a 100755 --- a/testsuite/systemtap.examples/nettop.stp +++ b/testsuite/systemtap.examples/network/nettop.stp diff --git a/testsuite/systemtap.examples/nettop.txt b/testsuite/systemtap.examples/network/nettop.txt index 2bfd4967..2bfd4967 100644 --- a/testsuite/systemtap.examples/nettop.txt +++ b/testsuite/systemtap.examples/network/nettop.txt diff --git a/testsuite/systemtap.examples/socket-trace.meta b/testsuite/systemtap.examples/network/socket-trace.meta index 0b26f2fe..0b26f2fe 100644 --- a/testsuite/systemtap.examples/socket-trace.meta +++ b/testsuite/systemtap.examples/network/socket-trace.meta diff --git a/testsuite/systemtap.examples/socket-trace.stp b/testsuite/systemtap.examples/network/socket-trace.stp index 13ab8e06..13ab8e06 100755 --- a/testsuite/systemtap.examples/socket-trace.stp +++ b/testsuite/systemtap.examples/network/socket-trace.stp diff --git a/testsuite/systemtap.examples/socktop b/testsuite/systemtap.examples/network/socktop index 123e37e9..123e37e9 100755 --- a/testsuite/systemtap.examples/socktop +++ b/testsuite/systemtap.examples/network/socktop diff --git a/testsuite/systemtap.examples/socktop.txt b/testsuite/systemtap.examples/network/socktop.txt index 0ebce003..0ebce003 100644 --- a/testsuite/systemtap.examples/socktop.txt +++ b/testsuite/systemtap.examples/network/socktop.txt diff --git a/testsuite/systemtap.examples/futexes.meta b/testsuite/systemtap.examples/process/futexes.meta index 0a34b2d8..ff303122 100644 --- a/testsuite/systemtap.examples/futexes.meta +++ b/testsuite/systemtap.examples/process/futexes.meta @@ -1,5 +1,5 @@ title: System-Wide Futex Contention -name: futex.stp +name: futexes.stp version: 1.0 author: anonymous keywords: syscall locking futex diff --git a/testsuite/systemtap.examples/futexes.stp b/testsuite/systemtap.examples/process/futexes.stp index 16c62937..16c62937 100755 --- a/testsuite/systemtap.examples/futexes.stp +++ b/testsuite/systemtap.examples/process/futexes.stp diff --git a/testsuite/systemtap.examples/futexes.txt b/testsuite/systemtap.examples/process/futexes.txt index 51de4352..51de4352 100644 --- a/testsuite/systemtap.examples/futexes.txt +++ b/testsuite/systemtap.examples/process/futexes.txt diff --git a/testsuite/systemtap.examples/pf2.meta b/testsuite/systemtap.examples/process/pf2.meta index d0a534bd..d0a534bd 100644 --- a/testsuite/systemtap.examples/pf2.meta +++ b/testsuite/systemtap.examples/process/pf2.meta diff --git a/testsuite/systemtap.examples/pf2.stp b/testsuite/systemtap.examples/process/pf2.stp index a804c3ff..a804c3ff 100755 --- a/testsuite/systemtap.examples/pf2.stp +++ b/testsuite/systemtap.examples/process/pf2.stp diff --git a/testsuite/systemtap.examples/pf2.txt b/testsuite/systemtap.examples/process/pf2.txt index 0fafe17e..0fafe17e 100644 --- a/testsuite/systemtap.examples/pf2.txt +++ b/testsuite/systemtap.examples/process/pf2.txt diff --git a/testsuite/systemtap.examples/small_demos/proc_snoop.stp b/testsuite/systemtap.examples/process/proc_snoop.stp index 24499b4b..24499b4b 100755 --- a/testsuite/systemtap.examples/small_demos/proc_snoop.stp +++ b/testsuite/systemtap.examples/process/proc_snoop.stp diff --git a/testsuite/systemtap.examples/sig_by_pid.meta b/testsuite/systemtap.examples/process/sig_by_pid.meta index 03b02fba..03b02fba 100644 --- a/testsuite/systemtap.examples/sig_by_pid.meta +++ b/testsuite/systemtap.examples/process/sig_by_pid.meta diff --git a/testsuite/systemtap.examples/sig_by_pid.stp b/testsuite/systemtap.examples/process/sig_by_pid.stp index 9c1493f5..9c1493f5 100755 --- a/testsuite/systemtap.examples/sig_by_pid.stp +++ b/testsuite/systemtap.examples/process/sig_by_pid.stp diff --git a/testsuite/systemtap.examples/sig_by_pid.txt b/testsuite/systemtap.examples/process/sig_by_pid.txt index 927b4607..927b4607 100644 --- a/testsuite/systemtap.examples/sig_by_pid.txt +++ b/testsuite/systemtap.examples/process/sig_by_pid.txt diff --git a/testsuite/systemtap.examples/sig_by_proc.meta b/testsuite/systemtap.examples/process/sig_by_proc.meta index eea42be4..eea42be4 100644 --- a/testsuite/systemtap.examples/sig_by_proc.meta +++ b/testsuite/systemtap.examples/process/sig_by_proc.meta diff --git a/testsuite/systemtap.examples/sig_by_proc.stp b/testsuite/systemtap.examples/process/sig_by_proc.stp index ce845aed..ce845aed 100755 --- a/testsuite/systemtap.examples/sig_by_proc.stp +++ b/testsuite/systemtap.examples/process/sig_by_proc.stp diff --git a/testsuite/systemtap.examples/sig_by_proc.txt b/testsuite/systemtap.examples/process/sig_by_proc.txt index d09da9fe..d09da9fe 100644 --- a/testsuite/systemtap.examples/sig_by_proc.txt +++ b/testsuite/systemtap.examples/process/sig_by_proc.txt diff --git a/testsuite/systemtap.examples/sigkill.meta b/testsuite/systemtap.examples/process/sigkill.meta index 57032224..57032224 100644 --- a/testsuite/systemtap.examples/sigkill.meta +++ b/testsuite/systemtap.examples/process/sigkill.meta diff --git a/testsuite/systemtap.examples/sigkill.stp b/testsuite/systemtap.examples/process/sigkill.stp index 8f754219..8f754219 100644 --- a/testsuite/systemtap.examples/sigkill.stp +++ b/testsuite/systemtap.examples/process/sigkill.stp diff --git a/testsuite/systemtap.examples/sigmon.meta b/testsuite/systemtap.examples/process/sigmon.meta index 18834997..18834997 100644 --- a/testsuite/systemtap.examples/sigmon.meta +++ b/testsuite/systemtap.examples/process/sigmon.meta diff --git a/testsuite/systemtap.examples/sigmon.stp b/testsuite/systemtap.examples/process/sigmon.stp index 31d7822e..31d7822e 100755 --- a/testsuite/systemtap.examples/sigmon.stp +++ b/testsuite/systemtap.examples/process/sigmon.stp diff --git a/testsuite/systemtap.examples/sleepingBeauties.meta b/testsuite/systemtap.examples/process/sleepingBeauties.meta index 95e08361..95e08361 100644 --- a/testsuite/systemtap.examples/sleepingBeauties.meta +++ b/testsuite/systemtap.examples/process/sleepingBeauties.meta diff --git a/testsuite/systemtap.examples/sleepingBeauties.stp b/testsuite/systemtap.examples/process/sleepingBeauties.stp index 64c563a3..64c563a3 100644 --- a/testsuite/systemtap.examples/sleepingBeauties.stp +++ b/testsuite/systemtap.examples/process/sleepingBeauties.stp diff --git a/testsuite/systemtap.examples/sleeptime.meta b/testsuite/systemtap.examples/process/sleeptime.meta index d6c59345..d6c59345 100644 --- a/testsuite/systemtap.examples/sleeptime.meta +++ b/testsuite/systemtap.examples/process/sleeptime.meta diff --git a/testsuite/systemtap.examples/sleeptime.stp b/testsuite/systemtap.examples/process/sleeptime.stp index b5729ceb..b5729ceb 100755 --- a/testsuite/systemtap.examples/sleeptime.stp +++ b/testsuite/systemtap.examples/process/sleeptime.stp diff --git a/testsuite/systemtap.examples/syscalls_by_pid.meta b/testsuite/systemtap.examples/process/syscalls_by_pid.meta index 590652b3..590652b3 100644 --- a/testsuite/systemtap.examples/syscalls_by_pid.meta +++ b/testsuite/systemtap.examples/process/syscalls_by_pid.meta diff --git a/testsuite/systemtap.examples/syscalls_by_pid.stp b/testsuite/systemtap.examples/process/syscalls_by_pid.stp index 47aa4955..47aa4955 100755 --- a/testsuite/systemtap.examples/syscalls_by_pid.stp +++ b/testsuite/systemtap.examples/process/syscalls_by_pid.stp diff --git a/testsuite/systemtap.examples/syscalls_by_pid.txt b/testsuite/systemtap.examples/process/syscalls_by_pid.txt index 4943a139..4943a139 100644 --- a/testsuite/systemtap.examples/syscalls_by_pid.txt +++ b/testsuite/systemtap.examples/process/syscalls_by_pid.txt diff --git a/testsuite/systemtap.examples/syscalls_by_proc.meta b/testsuite/systemtap.examples/process/syscalls_by_proc.meta index 79aa3e87..79aa3e87 100644 --- a/testsuite/systemtap.examples/syscalls_by_proc.meta +++ b/testsuite/systemtap.examples/process/syscalls_by_proc.meta diff --git a/testsuite/systemtap.examples/syscalls_by_proc.stp b/testsuite/systemtap.examples/process/syscalls_by_proc.stp index af7d6932..af7d6932 100755 --- a/testsuite/systemtap.examples/syscalls_by_proc.stp +++ b/testsuite/systemtap.examples/process/syscalls_by_proc.stp diff --git a/testsuite/systemtap.examples/syscalls_by_proc.txt b/testsuite/systemtap.examples/process/syscalls_by_proc.txt index dd554083..dd554083 100644 --- a/testsuite/systemtap.examples/syscalls_by_proc.txt +++ b/testsuite/systemtap.examples/process/syscalls_by_proc.txt diff --git a/testsuite/systemtap.examples/syscalltimes b/testsuite/systemtap.examples/process/syscalltimes index 84ca77a9..84ca77a9 100755 --- a/testsuite/systemtap.examples/syscalltimes +++ b/testsuite/systemtap.examples/process/syscalltimes diff --git a/testsuite/systemtap.examples/syscalltimes.txt b/testsuite/systemtap.examples/process/syscalltimes.txt index d50f73ad..d50f73ad 100644 --- a/testsuite/systemtap.examples/syscalltimes.txt +++ b/testsuite/systemtap.examples/process/syscalltimes.txt diff --git a/testsuite/systemtap.examples/wait4time.meta b/testsuite/systemtap.examples/process/wait4time.meta index a939d466..a939d466 100644 --- a/testsuite/systemtap.examples/wait4time.meta +++ b/testsuite/systemtap.examples/process/wait4time.meta diff --git a/testsuite/systemtap.examples/wait4time.stp b/testsuite/systemtap.examples/process/wait4time.stp index ba300ea7..ba300ea7 100755 --- a/testsuite/systemtap.examples/wait4time.stp +++ b/testsuite/systemtap.examples/process/wait4time.stp diff --git a/testsuite/systemtap.examples/functioncallcount.meta b/testsuite/systemtap.examples/profiling/functioncallcount.meta index 4d419528..4d419528 100644 --- a/testsuite/systemtap.examples/functioncallcount.meta +++ b/testsuite/systemtap.examples/profiling/functioncallcount.meta diff --git a/testsuite/systemtap.examples/functioncallcount.stp b/testsuite/systemtap.examples/profiling/functioncallcount.stp index e393b612..e393b612 100644 --- a/testsuite/systemtap.examples/functioncallcount.stp +++ b/testsuite/systemtap.examples/profiling/functioncallcount.stp diff --git a/testsuite/systemtap.examples/thread-times.meta b/testsuite/systemtap.examples/profiling/thread-times.meta index fcbf062e..fcbf062e 100644 --- a/testsuite/systemtap.examples/thread-times.meta +++ b/testsuite/systemtap.examples/profiling/thread-times.meta diff --git a/testsuite/systemtap.examples/thread-times.stp b/testsuite/systemtap.examples/profiling/thread-times.stp index 1aeb2037..1aeb2037 100644 --- a/testsuite/systemtap.examples/thread-times.stp +++ b/testsuite/systemtap.examples/profiling/thread-times.stp diff --git a/testsuite/systemtap.examples/small_demos/close.stp b/testsuite/systemtap.examples/small_demos/close.stp deleted file mode 100755 index 7ba2a036..00000000 --- a/testsuite/systemtap.examples/small_demos/close.stp +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env stap - -probe syscall.close { - printf("%s: %s(%s) = ", execname(), name, argstr) -} - -probe syscall.close.return { - printf("%s\n", returnstr(returnp)) -} - -probe end { - printf("DONE\n") -} - diff --git a/testsuite/systemtap.examples/small_demos/demo_script.txt b/testsuite/systemtap.examples/small_demos/demo_script.txt deleted file mode 100644 index f3166a49..00000000 --- a/testsuite/systemtap.examples/small_demos/demo_script.txt +++ /dev/null @@ -1,102 +0,0 @@ -> cd /root/systemtap - -A systemtap script can be as simple as a single line. For example, -the following script places a probepoint on the kernel sys_read() -function and prints all callers with the function's arguments. - ->stap -e 'probe syscall.open {printf("%s: %s\n", execname(), argstr)}' - -Most scripts are a bit longer. (show top.stp) -This script sets a probepoint on all kernel functions beginning with "sys_". -When the probepoint is hit, it increments an entry in the map -(or associative array) "syscalls" with the key "probefunc()" which returns -the name of the function that was triggered. For example, "sys_read". - -There is a timer that is triggered every 5000ms or 5 seconds. That timer -calls the function print_top(). print_top() sorts the syscalls map -and prints the top 20 entries. Then it clears the map. - -> ./top.stp - -(after stopping "top" go ahead and enter "./sys.stp". It takes a minute -to load this script. Diplay the source in another window and talk -while it is loading.) - -The "top" script looked only at the functions called. If we want more -detail about the functions, we can use systemtap to examine their local -arguments and variables. However that would be difficult because each -system call has different parameters. The Syscall Tapset solves -this problem. To use it, we set probe points using the syntax "syscall.name" -instead of kernel.function("sys_name"). The Syscall Tapset provides three -defined variables we can use: -name - the name of the function -argstr - on function entry, a formatted string containing the arguments -retstr - on function exit, the return value and possibly error code - -In this example, we filter out programs named "staprun" because this is -part of the systemtap infrastructure. (It may be filtered out -automatically in the future.) - -The next example shows how you can use systemtap to focus on -specific programs or pids. (show prof.stp) - -Like the "top" example, this script places probes on all kernel -functions starting with "sys_". Only the probepoint also checks to see -if the tid/pid matches the one returned by "target()". We'll show how -the target pid is set later. - -Unlike the previous examples, this script sets a probe point on all the -system call returns. When triggered, this probepoint computes the elapsed -time since the function entry. - -To run this script, we must give it a pid to use for the target, or a -program to run, in which case target will be its pid. - -> ./prof.stp -c "top -n5" - --------------------------------- - -Systemtap can also run in an unsafe mode where you can give -it arbitrary C code to run at probepoints, or modify kernel variables -and structures. This is very dangerous so only experts with root access will -ever be permitted to do this. - -(show keyhack.stp) - -The next example will modify the local variable "keycode" in the "kdb_keycode" -function in the kernel driver. We indicate it is a local variable by putting -a dollar sign before the name. - -./keyhack.stp - -(prints error message) - -To tell systemtap we really want to run this script, we must use the "-g" flag. - -./keyhack.stp -g - -(type some keys. "m" should display as "b" in every window) - -This example is not something you would normally want to do. There are -far better ways to remap a keyboard. What it demonstartes is that Systemtap -can modify variables in a running kernel. - -(show kmalloc.stp) -This next script shows the kind of statistics systemtap can collect. -It collects information about kernel allocations. - -> ./kmalloc.stp - -Now we can refine this further -(show kmalloc2.stp) - -Remember in some previous examples, we used maps or associative arrays. Maps can contain -statistics too. So we have enhanced the previous script to collect statistics per -program name. The output might be large so we'll redirect it to a file. - -> ./kmalloc2.stp > out - -(runs for 10 seconds) - -> more out - diff --git a/testsuite/systemtap.examples/small_demos/fileopen.stp b/testsuite/systemtap.examples/small_demos/fileopen.stp deleted file mode 100755 index c1298f9c..00000000 --- a/testsuite/systemtap.examples/small_demos/fileopen.stp +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env stap - -# -# fileopen.stp -# -# This is based on dtrace script from -# http://www.gnome.org/~gman/blog/2006/Jan -# -# stap fileopen.stp -c "zenity --about" -# or -# ./fileopen.stp -c "program or script" - -global opens - -probe syscall.open { - if (target() == pid()) opens[filename] ++ -} - -probe end { - foreach([name] in opens+) { - printf("%-70s%5d\n", name, opens[name]) - } -} - diff --git a/testsuite/systemtap.examples/small_demos/kmalloc.stp b/testsuite/systemtap.examples/small_demos/kmalloc.stp deleted file mode 100755 index 9157928d..00000000 --- a/testsuite/systemtap.examples/small_demos/kmalloc.stp +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env stap - -# Using statistics to examine kernel memory allocations - -global kmalloc - -probe kernel.function("__kmalloc") { - kmalloc <<< $size -} - -# Exit after 10 seconds -probe timer.ms(10000) { exit () } - -probe end { - printf("Count: %d allocations\n", @count(kmalloc)) - printf("Sum: %d Kbytes\n", @sum(kmalloc)/1000) - printf("Average: %d bytes\n", @avg(kmalloc)) - printf("Min: %d bytes\n", @min(kmalloc)) - printf("Max: %d bytes\n", @max(kmalloc)) - print("\nAllocations by size in bytes\n") - print(@hist_log(kmalloc)) -} diff --git a/testsuite/systemtap.examples/small_demos/kmalloc2.stp b/testsuite/systemtap.examples/small_demos/kmalloc2.stp deleted file mode 100755 index 2622dd2f..00000000 --- a/testsuite/systemtap.examples/small_demos/kmalloc2.stp +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/env stap - -# Using statistics and maps to examine kernel memory allocations - -global kmalloc - -probe kernel.function("__kmalloc") { - kmalloc[execname()] <<< $size -} - -# Exit after 10 seconds -probe timer.ms(10000) { exit () } - -probe end { - foreach ([name] in kmalloc) { - printf("Allocations for %s\n", name) - printf("Count: %d allocations\n", @count(kmalloc[name])) - printf("Sum: %d Kbytes\n", @sum(kmalloc[name])/1000) - printf("Average: %d bytes\n", @avg(kmalloc[name])) - printf("Min: %d bytes\n", @min(kmalloc[name])) - printf("Max: %d bytes\n", @max(kmalloc[name])) - print("\nAllocations by size in bytes\n") - print(@hist_log(kmalloc[name])) - printf("-------------------------------------------------------\n\n"); - } -} diff --git a/testsuite/systemtap.examples/small_demos/prof.stp b/testsuite/systemtap.examples/small_demos/prof.stp deleted file mode 100755 index 389f743a..00000000 --- a/testsuite/systemtap.examples/small_demos/prof.stp +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env stap - -# This is an example of profiling a specific command or pid. -# It works by recording the time when a system call is entered -# exited. - -# Usage: prof.stp -c "top -n5" -# Will start up "top" and after 5 iterations, will exit. -# -# Usage: prof.stp -x 3323 -# Will profile pid 3323 until it ^c is hit. -# - -probe kernel.function("sys_*").call { - if (target() == tid()) - calltime[tid()] = gettimeofday_us() -} - -probe kernel.function("sys_*").return { - if (target() != tid()) next - now = gettimeofday_us() - c = calltime[tid()] - if (!c) next - ttime[probefunc()] <<< now - c - delete calltime[tid()] -} - -probe end { - printf("\n") - foreach (x in ttime) - printf("%-20s\tcalls:%6d\tavg time (us):%5d\ttotal(us):%7d\n", - x, @count(ttime[x]), @avg(ttime[x]), @sum(ttime[x])) -} - -global calltime, ttime diff --git a/testsuite/systemtap.examples/small_demos/rwtiming.stp b/testsuite/systemtap.examples/small_demos/rwtiming.stp deleted file mode 100755 index d570c581..00000000 --- a/testsuite/systemtap.examples/small_demos/rwtiming.stp +++ /dev/null @@ -1,74 +0,0 @@ -#! /usr/bin/env stap -# rwtiming.stp -# -# This is a simple example to track the amount of time -# spent doing reads and writes for the various programs running on the -# system. - -probe begin { log("starting probe") } - -global names, opens, reads, writes -global entry_opens, entry_reads, entry_writes -global time_opens, time_reads, time_writes - -probe kernel.function("sys_open") { - t=gettimeofday_us(); p=pid(); e=execname(); - names[e]=1 - opens[e] ++ # plain integer - entry_opens[p] = t; -} - -probe kernel.function("sys_open").return { - t=gettimeofday_us(); p=pid(); e=execname(); - time_opens[e] <<< t - entry_opens[p]; -} - -probe kernel.function("sys_read") { - t= gettimeofday_us(); p =pid(); e=execname(); - names[e]=1 - reads[e] <<< $count # statistics - entry_reads[p] = t; -} - -probe kernel.function("sys_read").return { - t=gettimeofday_us(); p=pid(); e=execname(); - time_reads[e] <<< t - entry_reads[p]; -} - -probe kernel.function("sys_write") { - t=gettimeofday_us(); p=pid(); e=execname(); - names[e]=1 - writes[e] <<< $count # statistics - entry_writes[p] = t; -} - -probe kernel.function("sys_write").return { - t = gettimeofday_us(); p = pid(); e=execname(); - time_writes[e] <<< t - entry_writes[p]; -} - -probe end { - foreach(name+ in names) { # sort by names - printf ("process: %s\n", name) - if (opens[name]) { - printf ("opens n=%d\n", opens[name]) - print (@hist_log(time_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])) - print ("read timing distribution\n") - print (@hist_log(time_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])) - print ("write timing distribution\n") - print (@hist_log(time_writes[name])) - } - } -} diff --git a/testsuite/systemtap.examples/small_demos/sched_snoop.stp b/testsuite/systemtap.examples/small_demos/sched_snoop.stp deleted file mode 100755 index 623643dd..00000000 --- a/testsuite/systemtap.examples/small_demos/sched_snoop.stp +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env stap - -global start_ts - -probe begin { - start_ts = gettimeofday_us() - printf("%12s %3s %5s %5s %-16s ACTION\n", - "TIMESTAMP", "CPU", "PID", "TID", "EXECNAME") -} - -function report(action:string) { - printf("%3d %12d %5d %5d %-16s %s\n", - gettimeofday_us() - start_ts, cpu(), - pid(), tid(), execname(), action) -} - -probe scheduler.cpu_off { - report(sprintf("cpu_off%s", idle? " [idle]" : "")) -} - -probe scheduler.cpu_on { - report(sprintf("cpu_on%s", idle? " [idle]" : "")) -} - -probe scheduler.tick { - report(sprintf("tick%s", idle? " [idle]" : "")) -} - -probe scheduler.migrate ? { - report("migrate") -} - -probe scheduler.balance ? { - report("balance") -} diff --git a/testsuite/systemtap.examples/small_demos/sys.stp b/testsuite/systemtap.examples/small_demos/sys.stp deleted file mode 100755 index 2df20bc3..00000000 --- a/testsuite/systemtap.examples/small_demos/sys.stp +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env stap - -# print all system calls on the system - -probe syscall.* { - if (execname() != "staprun") - printf("%s: %s (%s) = ", execname(), name, argstr) -} - -probe syscall.*.return { - if (execname() != "staprun") - printf("%s\n", retstr) -} - -probe end { - printf("\n") -} diff --git a/testsuite/systemtap.examples/small_demos/top.stp b/testsuite/systemtap.examples/small_demos/top.stp deleted file mode 100755 index b46b9940..00000000 --- a/testsuite/systemtap.examples/small_demos/top.stp +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env stap -# -# This script continuously lists the top 20 systemcalls on the system -# - -global syscalls - -function print_top () { - printf ("SYSCALL\t\t\t\tCOUNT\n") - foreach ([name] in syscalls- limit 20) - printf("%-20s\t\t%5d\n",name, syscalls[name]) - printf("--------------------------------------\n") - delete syscalls -} - -probe syscall.* { - syscalls[probefunc()]++ -} - -# print top syscalls every 5 seconds -probe timer.ms(5000) { - print_top () -} - diff --git a/testsuite/systemtap.examples/subsystem-index.html b/testsuite/systemtap.examples/subsystem-index.html new file mode 100644 index 00000000..9bdec0c8 --- /dev/null +++ b/testsuite/systemtap.examples/subsystem-index.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<html> +<head> + <title>SystemTap Examples</title> + <link rel="stylesheet" href="html/systemtap.css" type="text/css"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta http-equiv="Content-Style-Type" content="text/css"> +</head> + +<body> + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td valign="bottom" height="80"><img src="html/systemtaplogo.png" + alt="SystemTap logo" width="165" height="25"></td> + <td valign="bottom" class="topnavright" align="right"> + <a href="http://sourceware.org/systemtap/">SystemTap</a> | + </td> + </tr> + </table> + + <div class="mainbackground"> + <div class="maintextregion"> + <img src="html/systemtapcorner.gif"> + <table cellspacing="2" cellpadding="4" border="0" width="99%" + style="margin-top:17;"> + <tr> + <td width="200"> </td> + <td valign="bottom"><h1>Examples</h1></td> + </tr> + <tr> + <td> </td> + <td valign="top"> + + <h2>Example Indexes</h2> + <ul> + <li><a href="index.html">All Examples</a></li> + <li><a href="subsystem-index.html">By Subsystem</a></li> + <li><a href="keyword-index.html">By Keyword</a></li> + </ul> + +<h2>Examples by Subsystem</h2> +<p><tt><a href="#CPU">CPU</a> <a href="#DISK">DISK</a> <a href="#IO">IO</a> <a href="#KERNEL">KERNEL</a> <a href="#LOCKING">LOCKING</a> <a href="#NETWORK">NETWORK</a> <a href="#NONE">NONE</a> <a href="#SCHEDULER">SCHEDULER</a> <a href="#SIGNALS">SIGNALS</a> <a href="#SYSCALL">SYSCALL</a> </tt></p> +<h3><a name="CPU">CPU</a></h3> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +</ul> +<h3><a name="DISK">DISK</a></h3> +<ul> +<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br> +subsystems: disk cpu, keywords: disk cpu use graph<br> +<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li> +<li><a href="io/disktop.stp">io/disktop.stp</a> - Summarize Disk Read/Write Traffic<br> +subsystems: disk, keywords: disk<br> +<p>Get the status of reading/writing disk every 5 seconds, output top ten entries during that period.</p></li> +</ul> +<h3><a name="IO">IO</a></h3> +<ul> +<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br> +subsystems: io, keywords: io backtrace<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/iotop.stp">io/iotop.stp</a> - Periodically Print I/O Activity by Process Name<br> +subsystems: io, keywords: io<br> +<p>Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.</p></li> +<li><a href="io/traceio.stp">io/traceio.stp</a> - Track Cumulative I/O Activity by Process Name<br> +subsystems: io, keywords: io<br> +<p>Every second print out the top ten executables sorted in descending order based on cumulative I/O traffic observed.</p></li> +<li><a href="io/traceio2.stp">io/traceio2.stp</a> - Watch I/O Activity on a Particular Device<br> +subsystems: io, keywords: io<br> +<p>Print out the executable name and process number as reads and writes to the specified device occur.</p></li> +</ul> +<h3><a name="KERNEL">KERNEL</a></h3> +<ul> +<li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Tracing Calls for Sections of Code<br> +subsystems: kernel, keywords: trace callgraph<br> +<p>The script takes two arguments: the first argument is the function to starts/stops the per thread call graph traces and the second argument is the list of functions to generate trace information on. The script prints out a timestap for the thread, the function name and pid, followed by entry or exit symboly and function name.</p></li> +<li><a href="process/pf2.stp">process/pf2.stp</a> - Profile kernel functions<br> +subsystems: kernel, keywords: profiling<br> +<p>The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.</p></li> +<li><a href="profiling/functioncallcount.stp">profiling/functioncallcount.stp</a> - Count Times Functions Called<br> +subsystems: kernel, keywords: profiling functions<br> +<p>The functioncallcount.stp script takes one argument, a list of functions to probe. The script will run and count the number of times that each of the functions on the list is called. On exit the script will print a sorted list from most frequently to least frequently called function.</p></li> +<li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br> +subsystems: kernel, keywords: profiling<br> +<p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li> +</ul> +<h3><a name="LOCKING">LOCKING</a></h3> +<ul> +<li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> +subsystems: locking, keywords: syscall locking futex<br> +<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li> +</ul> +<h3><a name="NETWORK">NETWORK</a></h3> +<ul> +<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> +subsystems: network, keywords: network traffic per-process<br> +<p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> +<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> +subsystems: network, keywords: network socket<br> +<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li> +</ul> +<h3><a name="NONE">NONE</a></h3> +<ul> +<li><a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br> +subsystems: none, keywords: simple<br> +<p>A basic "Hello World" program implemented in SystemTap script. It prints out "hello world" message and then immediately exits.</p></li> +</ul> +<h3><a name="SCHEDULER">SCHEDULER</a></h3> +<ul> +<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> +subsystems: scheduler, keywords: io scheduler<br> +<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li> +</ul> +<h3><a name="SIGNALS">SIGNALS</a></h3> +<ul> +<li><a href="process/sig_by_pid.stp">process/sig_by_pid.stp</a> - Signal Counts by Process ID<br> +subsystems: signals, keywords: signals<br> +<p>Print signal counts by process ID in descending order.</p></li> +<li><a href="process/sig_by_proc.stp">process/sig_by_proc.stp</a> - Signal Counts by Process Name<br> +subsystems: signals, keywords: signals<br> +<p>Print signal counts by process name in descending order.</p></li> +<li><a href="process/sigkill.stp">process/sigkill.stp</a> - Track SIGKILL Signals<br> +subsystems: signals, keywords: signals<br> +<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.</p></li> +<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br> +subsystems: signals, keywords: signals<br> +<p>The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.</p></li> +</ul> +<h3><a name="SYSCALL">SYSCALL</a></h3> +<ul> +<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> +subsystems: syscall, keywords: syscall read write time io<br> +<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li> +<li><a href="process/sleeptime.stp">process/sleeptime.stp</a> - Trace Time Spent in nanosleep Syscalls<br> +subsystems: syscall, keywords: syscall sleep<br> +<p>The script watches each nanosleep syscall on the system. At the end of each nanosleep syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "nanosleep:" key, and the duration of the sleep in microseconds.</p></li> +<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br> +subsystems: syscall, keywords: syscall<br> +<p>The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each PID ordered from greatest to least number of syscalls.</p></li> +<li><a href="process/syscalls_by_proc.stp">process/syscalls_by_proc.stp</a> - System-Wide Count of Syscalls by Executable<br> +subsystems: syscall, keywords: syscall<br> +<p>The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each executable ordered from greates to least number of syscalls.</p></li> +<li><a href="process/wait4time.stp">process/wait4time.stp</a> - Trace Time Spent in wait4 Syscalls<br> +subsystems: syscall, keywords: syscall wait4<br> +<p>The script watches each wait4 syscall on the system. At the end of each wait4 syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "wait4:" key, the duration of the wait and the PID that the wait4 was waiting for. If the waited for PID is not specified , it is "-1".</p></li> +</ul> + </td> + </tr> + </table> + </div> + </div> + + <table cellspacing="2" cellpadding="2" border="0" width="100%"> + <tr> + <td align="center" class="footer"><a href= + "http://sourceware.org/systemtap">SystemTap</a></td> + </tr> + </table> +</body> +</html> diff --git a/testsuite/systemtap.examples/subsystem-index.txt b/testsuite/systemtap.examples/subsystem-index.txt new file mode 100644 index 00000000..98e75e98 --- /dev/null +++ b/testsuite/systemtap.examples/subsystem-index.txt @@ -0,0 +1,242 @@ +SYSTEMTAP EXAMPLES INDEX BY SUBSYSTEM +(see also index.txt, keyword-index.txt) + += CPU = + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + += DISK = + +general/graphs.stp - Graphing Disk and CPU Utilization +subsystems: disk cpu, keywords: disk cpu use graph + + The script tracks the disk and CPU utilization. The resulting output + of the script can be piped into gnuplot to generate a graph of disk + and CPU USE. + + +io/disktop.stp - Summarize Disk Read/Write Traffic +subsystems: disk, keywords: disk + + Get the status of reading/writing disk every 5 seconds, output top + ten entries during that period. + + += IO = + +io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call +subsystems: io, keywords: io backtrace + + 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. + + +io/iotop.stp - Periodically Print I/O Activity by Process Name +subsystems: io, keywords: io + + Every five seconds print out the top ten executables generating I/O + traffic during that interval sorted in descending order. + + +io/traceio.stp - Track Cumulative I/O Activity by Process Name +subsystems: io, keywords: io + + Every second print out the top ten executables sorted in descending + order based on cumulative I/O traffic observed. + + +io/traceio2.stp - Watch I/O Activity on a Particular Device +subsystems: io, keywords: io + + Print out the executable name and process number as reads and writes + to the specified device occur. + + += KERNEL = + +general/para-callgraph.stp - Tracing Calls for Sections of Code +subsystems: kernel, keywords: trace callgraph + + The script takes two arguments: the first argument is the function to + starts/stops the per thread call graph traces and the second argument + is the list of functions to generate trace information on. The script + prints out a timestap for the thread, the function name and pid, + followed by entry or exit symboly and function name. + + +process/pf2.stp - Profile kernel functions +subsystems: kernel, keywords: profiling + + The pf2.stp script sets up time-based sampling. Every five seconds it + prints out a sorted list with the top ten kernel functions with + samples. + + +profiling/functioncallcount.stp - Count Times Functions Called +subsystems: kernel, keywords: profiling functions + + The functioncallcount.stp script takes one argument, a list of + functions to probe. The script will run and count the number of times + that each of the functions on the list is called. On exit the script + will print a sorted list from most frequently to least frequently + called function. + + +profiling/thread-times.stp - Profile kernel functions +subsystems: kernel, keywords: profiling + + The thread-times.stp script sets up time-based sampling. Every five + seconds it prints out a sorted list with the top twenty processes + with samples broken down into percentage total time spent in + user-space and kernel-space. + + += LOCKING = + +process/futexes.stp - System-Wide Futex Contention +subsystems: locking, keywords: syscall locking futex + + The script watches the futex syscall on the system. On exit the + futexes address, the number of contentions, and the average time for + each contention on the futex are printed from lowest pid number to + highest. + + += NETWORK = + +network/nettop.stp - Periodic Listing of Processes Using Network Interfaces +subsystems: network, keywords: network traffic per-process + + Every five seconds the nettop.stp script prints out a list of + processed (PID and command) with the number of packets sent/received + and the amount of data sent/received by the process during that + interval. + + +network/socket-trace.stp - Trace Functions called in Network Socket Code +subsystems: network, keywords: network socket + + The script instrument each of the functions inn the Linux kernel's + net/socket.c file. The script prints out trace. The first element of + a line is time delta in microseconds from the previous entry. This + is followed by the command name and the PID. The "->" and "<-" + indicates function entry and function exit, respectively. The last + element of the line is the function name. + + += NONE = + +general/helloworld.stp - SystemTap "Hello World" Program +subsystems: none, keywords: simple + + A basic "Hello World" program implemented in SystemTap script. It + prints out "hello world" message and then immediately exits. + + += SCHEDULER = + +process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations +subsystems: scheduler, keywords: io scheduler + + The script monitor time threads spend waiting for IO operations (in + "D" state) in the wait_for_completion function. If a thread spends + over 10ms wall-clock time waiting, information is printed out + describing the thread number and executable name. When slow the + wait_for_completion function complete, backtraces for the long + duration calls are printed out. + + += SIGNALS = + +process/sig_by_pid.stp - Signal Counts by Process ID +subsystems: signals, keywords: signals + + Print signal counts by process ID in descending order. + + +process/sig_by_proc.stp - Signal Counts by Process Name +subsystems: signals, keywords: signals + + Print signal counts by process name in descending order. + + +process/sigkill.stp - Track SIGKILL Signals +subsystems: signals, keywords: signals + + The script traces any SIGKILL signals. When that SIGKILL signal is + sent to a process, the script prints out the signal name, the + desination executable and process ID, the executable name user ID + that sent the signal. + + +process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +subsystems: signals, keywords: signals + + The script watches for a particular signal sent to a specific + process. When that signal is sent to the specified process, the + script prints out the PID and executable of the process sending the + signal, the PID and executable name of the process receiving the + signal, and the signal number and name. + + += SYSCALL = + +io/iotime.stp - Trace Time Spent in Read and Write for Files +subsystems: syscall, keywords: syscall read write time io + + The script watches each open, close, read, and write syscalls on the + system. For each file the scripts observes opened it accumulates the + amount of wall clock time spend in read and write operations and the + number of bytes read and written. When a file is closed the script + prints out a pair of lines for the file. Both lines begin with a + timestamp in microseconds, the PID number, and the executable name in + parenthesese. The first line with the "access" keyword lists the file + name, the attempted number of bytes for the read and write + operations. The second line with the "iotime" keyword list the file + name and the number of microseconds accumulated in the read and write + syscalls. + + +process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls +subsystems: syscall, keywords: syscall sleep + + The script watches each nanosleep syscall on the system. At the end + of each nanosleep syscall the script prints out a line with a + timestamp in microseconds, the pid, the executable name in + paretheses, the "nanosleep:" key, and the duration of the sleep in + microseconds. + + +process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +subsystems: syscall, keywords: syscall + + The script watches all syscall on the system. On exit the script + prints a list showing the number of systemcalls executed by each PID + ordered from greatest to least number of syscalls. + + +process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable +subsystems: syscall, keywords: syscall + + The script watches all syscall on the system. On exit the script + prints a list showing the number of systemcalls executed by each + executable ordered from greates to least number of syscalls. + + +process/wait4time.stp - Trace Time Spent in wait4 Syscalls +subsystems: syscall, keywords: syscall wait4 + + The script watches each wait4 syscall on the system. At the end of + each wait4 syscall the script prints out a line with a timestamp in + microseconds, the pid, the executable name in paretheses, the + "wait4:" key, the duration of the wait and the PID that the wait4 was + waiting for. If the waited for PID is not specified , it is "-1". + + |