diff options
-rw-r--r-- | ChangeLog | 152 | ||||
-rw-r--r-- | Makefile.am | 93 | ||||
-rw-r--r-- | Makefile.in | 118 | ||||
-rw-r--r-- | aclocal.m4 | 38 | ||||
-rw-r--r-- | doc/Makefile.in | 4 | ||||
-rw-r--r-- | runtime/ChangeLog | 14 | ||||
-rw-r--r-- | runtime/task_finder.c | 108 | ||||
-rw-r--r-- | runtime/task_finder_vma.c | 132 | ||||
-rwxr-xr-x | stap-client | 153 | ||||
-rwxr-xr-x | stap-find-or-start-server | 16 | ||||
-rwxr-xr-x | stap-find-servers | 4 | ||||
-rwxr-xr-x | stap-server | 63 | ||||
-rwxr-xr-x | stap-serverd | 34 | ||||
-rwxr-xr-x | stap-start-server | 12 | ||||
-rw-r--r-- | stapprobes.5.in | 24 | ||||
-rw-r--r-- | staprun.8.in | 6 | ||||
-rw-r--r-- | systemtap.spec | 20 | ||||
-rw-r--r-- | tapsets.cxx | 18 | ||||
-rw-r--r-- | testsuite/ChangeLog | 24 | ||||
-rw-r--r-- | testsuite/Makefile.am | 13 | ||||
-rw-r--r-- | testsuite/Makefile.in | 4 | ||||
-rw-r--r-- | testsuite/lib/stap_compile.exp | 1 | ||||
-rw-r--r-- | testsuite/lib/systemtap.exp | 50 | ||||
-rwxr-xr-x | testsuite/semko/fortyseven.stp | 5 | ||||
-rw-r--r-- | testsuite/systemtap.base/cache.exp | 1 | ||||
-rw-r--r-- | testsuite/systemtap.base/itrace.exp (renamed from systemtap.base/itrace.exp) | 8 | ||||
-rw-r--r-- | testsuite/systemtap.base/stmt_rel.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.base/utrace_p4.exp | 41 | ||||
-rw-r--r-- | testsuite/systemtap.examples/ChangeLog | 75 | ||||
-rw-r--r-- | testsuite/systemtap.examples/README | 52 | ||||
-rw-r--r-- | testsuite/systemtap.examples/check.exp | 5 | ||||
-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 | ||||
-rwxr-xr-x[-rw-r--r--] | testsuite/systemtap.examples/general/graphs.stp (renamed from testsuite/systemtap.examples/graphs.stp) | 2 | ||||
-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 | ||||
-rwxr-xr-x[-rw-r--r--] | testsuite/systemtap.examples/general/para-callgraph.stp (renamed from testsuite/systemtap.examples/para-callgraph.stp) | 2 | ||||
-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 | ||||
-rwxr-xr-x[-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 | ||||
-rwxr-xr-x[-rw-r--r--] | testsuite/systemtap.examples/io/io_submit.stp (renamed from testsuite/systemtap.examples/io_submit.stp) | 142 | ||||
-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 | ||||
-rwxr-xr-x[-rw-r--r--] | testsuite/systemtap.examples/io/iotop.stp (renamed from testsuite/systemtap.examples/iotop.stp) | 2 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio.meta (renamed from testsuite/systemtap.examples/traceio.meta) | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | testsuite/systemtap.examples/io/traceio.stp (renamed from testsuite/systemtap.examples/traceio.stp) | 2 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio2.meta (renamed from testsuite/systemtap.examples/traceio2.meta) | 0 | ||||
-rwxr-xr-x[-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) | 2 | ||||
-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 | ||||
-rwxr-xr-x[-rw-r--r--] | testsuite/systemtap.examples/process/sigkill.stp (renamed from testsuite/systemtap.examples/sigkill.stp) | 2 | ||||
-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 | ||||
-rwxr-xr-x[-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 | ||||
-rwxr-xr-x[-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 | ||||
-rwxr-xr-x[-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 | ||||
-rw-r--r-- | testsuite/systemtap.samples/iotask.stp | 1 | ||||
-rw-r--r-- | testsuite/systemtap.samples/pfaults.stp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.samples/profile.stp | 2 |
123 files changed, 2991 insertions, 836 deletions
@@ -2,26 +2,160 @@ PR5049 * tapsets.cxx (cu_name_matches, collect_srcfiles_matching): + Implicitly but optionally prefix probe source filenames with "*/". + * stapprobes.5.in: Document this. + +2008-08-11 Dave Brolley <brolley@redhat.com> + + * stap-client (disconnect_from_server): Call after receive_response. + * stap-server (stap_rc): Renamed from 'rc'. Don't use it as an exit + code. + * stap-serverd (listen): Set pipefail so that we get the rc of nc + if it fails. Make multiple attempts to establish a server. + (fatal): Call 'terminate'. + +2008-08-11 Frank Ch. Eigler <fche@elastic.org> + + PR5049 + * tapsets.cxx (cu_name_matches, collect_srcfiles_matching): Implicitly prefix probe source filenames with "*". -2008-08-09 Frank Ch. Eigler <fche@elastic.org> +2008-08-11 David Smith <dsmith@redhat.com> - * main.cxx (main): Don't override $PATH etc. - * tapsets.cxx (base_query ctor, dwarf_builder::build, - itrace_builder, utrace_derived_probe): Use find_executable() - to resolve FOO path in process("FOO"). - * util.cxx (find_executable): Duplicate execvp logic. + * tapsets.cxx (utrace_builder::build): Fixed indentation. + +2008-08-11 Mark Wielaard <mwielaard@redhat.com> + + * Makefile.am (install-data-local): Use INSTALL_PROGRAM for executable + stp scripts. + * Makefile.in: Regenerated. + +2008-08-09 Frank Ch. Eigler <fche@elastic.org> + + * main.cxx (main): Don't override $PATH etc. + * tapsets.cxx (base_query ctor, dwarf_builder::build, + itrace_builder, utrace_derived_probe): Use find_executable() + to resolve FOO path in process("FOO"). + * util.cxx (find_executable): Duplicate execvp logic. 2008-08-09 Frank Ch. Eigler <fche@elastic.org> * util.cxx (find_executable): Reorganize, simplify, canonicalize. * util.h, hash.cxx: Corresponding changes. + +2008-08-09 Frank Ch. Eigler <fche@elastic.org> + + * Makefile.am (example index): Only warn and instruct on index + regeneration. Do not actually perform it as the source tree + should be considered (and can really be) read-only. + * Makefile.in: Regenerated. + +2008-08-08 Dave Brolley <brolley@redhat.com> + + * stap-client: Use quotes when echoing. Exit with $rc. + (initialization): Initialize 'rc'. + (parse_options): Manage the command line in three pieces: + pre-script name, script name, post-script name. + (process_*): Likewise. + (send_request): Redirect stdout of 'nc' to /dev/null. + (receive_response): Handle "failed:" response. Redirect stdin of 'nc' + from /dev/zero. + (maybe_call_staprun): Check $rc. Check the requested phase limit + before looking for the module. + * stap-server: Use quotes when echoing. Exit with $rc. + (initialization): Initialize 'rc'. + (receive_request): Start 'nc' in the background before sending the + "ready:" message. Redirect stdin of 'nc' from /dev/zero. + (read_data_file): Allow for multiple lines of data. + (call_stap): Quoet $cmdline. Set 'rc'. + (send_response): Send "failed:" if stap is unsuccessful. Start 'nc' + in the background before sending the response. + (cleanup): Kill any running 'nc' job. + (terminate): Exit with $rc. + * stap-serverd: Start the server before advertising our presence. + * stap-find-or-start-server: Echo 0 if a server is already running. + Echo -1 if no server is running and one can't be started. + * stap-start-server: Wait until the server starts before exiting. Exit + with 1 if the server does not start. + * systemtap.spec: Move client side script to the runtime sub package. + The main package and the runtime sub package both depend on avahi-tools + and nc. + * Makefile.am: Revert previous changes. Now done in + testsuite/lib/systemtap.exp. + * Makefile.in: Regenerated. + +2008-08-08 David Smith <dsmith@redhat.com> + + * tapsets.cxx (utrace_derived_probe_group::emit_module_decls): + Calls stap_utrace_detach() to perform detach. + +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * Makefile.am (EXAMPLE_BUILD_DIR): Removed. Examples indexes are + always in srcdir. + (dist-hook): Always install examples from srcdir. + * Makefile.in: Regenerated. + +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * Makefile.am (rpm): Refer to srcdir spec file so make rpm works in + builddir. + * Makefile.in: Regenerated. + +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * systemtap.spec: Disable chmodding of samples/kmalloc-top. + It is currently not installed. + +2008-08-08 Mark Wielaard <mwielaard@redhat.com> + + * Makefile.am (all-local): Depend on example_index, which now + doesn't generate anything in $srcdir anymore, only $builddir. + (EXAMPLE_SOURCE_DIR): New var. + (EXAMPLE_BUILD_DIR): New var. + (EXAMPLE_META_FILES): New var. + (EXAMPLE_INDEX_GEN): New var. + (example_index): New target. + ($EXAMPLE_BUILD_DIR/index.html): Likewise. + (install-data-local): Install examples from $buildir. + * Makefile.in: Regenerated. + * aclocal.m4: Likewise. 2008-08-07 Frank Ch. Eigler <fche@elastic.org> - * tapsetes.cxx - (utrace_var_expanding_copy_visitor::visit_target_symbol): - Defer to new tapset function instead of synthesized embedded-c. + * Makefile.am (all-local): Don't run indexing code, since $srcdir + may be read-only. + (install-data): Simplify sample script installation; limit sources + to systemtap.examples directory only. + * Makefile.in: Regenerated. + +2008-08-07 Mark Wielaard <mwielaard@redhat.com> + + * Makefile.am (all-local): Add example_index. + (dist-hook): Likewise. + (EXAMPLE_SRC): Add index and support files. + (EXAMPLE_INDEXES): New file list. + (example_index): New target. + (clean-local): Remove generated indexes. + * Makefile.in: Regenerated. + +2008-08-07 Mark Wielaard <mwielaard@redhat.com> + + * systemtap.spec: Add comment about versioned vs unversioned docs. + +2008-08-06 Frank Ch. Eigler <fche@elastic.org> + + * stap-find-servers (match_server, client_sysinfo): + Use "sysinfo=...." keyword in mdns TXT record. + * stap-serverd (advertise_presence): Ditto. + (initialization): Locate random usable server port if needed. + (listen): Complain if port turns out to be unusable after all. + +2008-08-06 Josh Stone <joshua.i.stone@intel.com> + + PR 6820 + From Eugeniy Meshcheryakov eugen@debian.org: + * staprun.8.in: fix minor formatting problems 2008-08-05 Stan Cox <scox@redhat.com> diff --git a/Makefile.am b/Makefile.am index eaddfd59..e6a5654c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -140,10 +140,12 @@ STAPLOG=staplog.so $(STAPLOG): staplog.c $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \ $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $< -all-local: $(STAPLOG) +all-local: $(STAPLOG) example_index install-exec-local: $(STAPLOG) $(MKDIR_P) $(DESTDIR)$(pkglibdir) $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir) +else +all-local: example_index endif # Get extra libs as needed @@ -159,30 +161,15 @@ EXTRA_DIST = auto_free.h buildrun.h elaborate.h loc2c.h session.h \ systemtap.spec EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples -EXAMPLE_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples -DEMO_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples/small_demos -DEMO_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples/small_demos -SAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.samples -SAMPLE_INSTALL_DIR = $(EXAMPLE_INSTALL_DIR)/samples - -EXAMPLE_SRC = $(EXAMPLE_SOURCE_DIR)/ChangeLog \ - $(EXAMPLE_SOURCE_DIR)/README \ - $(EXAMPLE_SOURCE_DIR)/*.stp \ - $(EXAMPLE_SOURCE_DIR)/*.txt \ - $(EXAMPLE_SOURCE_DIR)/*.meta - -DEMO_SRC = \ - $(EXAMPLE_SOURCE_DIR)/small_demos/*.stp \ - $(EXAMPLE_SOURCE_DIR)/small_demos/*.txt \ - $(EXAMPLE_SOURCE_DIR)/small_demos/*.wav - -SAMPLE_SRC = $(SAMPLE_SOURCE_DIR)/iotask.stp \ - $(SAMPLE_SOURCE_DIR)/kmalloc-stacks.stp \ - $(SAMPLE_SOURCE_DIR)/kmalloc-top \ - $(SAMPLE_SOURCE_DIR)/pfaults.stp \ - $(SAMPLE_SOURCE_DIR)/profile.stp \ - $(SAMPLE_SOURCE_DIR)/tcp_connections.stp \ - $(SAMPLE_SOURCE_DIR)/topsys.stp +EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta + +example_index: $(EXAMPLE_SOURCE_DIR)/index.html + +$(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN) + @echo "The script example index is outdated, run" + @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ " + @echo " perl examples-index-gen.pl" + @echo "to regenerate it." dist-hook: dist-gitversion find $(distdir) -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf @@ -199,12 +186,12 @@ install-data-local: do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done) (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \ | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done) - $(MKDIR_P) $(EXAMPLE_INSTALL_DIR) - $(INSTALL_DATA) $(EXAMPLE_SRC) $(EXAMPLE_INSTALL_DIR) - $(MKDIR_P) $(DEMO_INSTALL_DIR) - $(INSTALL_DATA) $(DEMO_SRC) $(DEMO_INSTALL_DIR) - $(MKDIR_P) $(SAMPLE_INSTALL_DIR) - $(INSTALL_DATA) $(SAMPLE_SRC) $(SAMPLE_INSTALL_DIR) + (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \ + | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl' \ + | while read f; do if test -x $$f; then \ + i_cmd="$(INSTALL_PROGRAM)"; else \ + i_cmd="$(INSTALL_DATA)"; fi; \ + $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done) TEST_COV_DIR = coverage @@ -250,28 +237,9 @@ SUBDIRS = testsuite doc check: SRCDIR=`cd $(srcdir); pwd`; \ - BUILDDIR=`cd $(builddir); pwd`; \ - need_server=0; \ - (echo "X$(EXTRA_TOOL_OPTS)" | grep -q server) && need_server=1; \ - if test $$need_server = 1; then \ - echo "Testing using a systemtap server"; \ - need_server=0; \ - server_pid=`stap-find-or-start-server` || need_server=1; \ - if test $$need_server = 1; then \ - echo "Cannot find or start a systemtap server"; \ - exit -1; \ - fi; \ - client_path="$$BUILDDIR/testsuite/net"; \ - mkdir -p $$BUILDDIR/testsuite/net; \ - cp -p $$SRCDIR/stap-client $$BUILDDIR/testsuite/net/stap; \ - fi; \ - $(MAKE) -C testsuite check SYSTEMTAP_RUNTIME=$$SRCDIR/runtime SYSTEMTAP_TAPSET=$$SRCDIR/tapset LD_LIBRARY_PATH=$(PWD)/lib-elfutils:$(PWD)/lib-elfutils/systemtap SYSTEMTAP_PATH="$$client_path:$(PWD)" RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ - if test "X$$server_pid" != "X"; then \ - stap-stop-server $$server_pid; \ - fi + $(MAKE) -C testsuite check SYSTEMTAP_RUNTIME=$$SRCDIR/runtime SYSTEMTAP_TAPSET=$$SRCDIR/tapset LD_LIBRARY_PATH=$(PWD)/lib-elfutils:$(PWD)/lib-elfutils/systemtap SYSTEMTAP_PATH="$(PWD)" RUNTESTFLAGS="$(RUNTESTFLAGS)"; installcheck: - BUILDDIR=`cd $(builddir); pwd`; \ if test \! -e $(DESTDIR)$(bindir)/stap; then \ echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \ exit -1; \ @@ -279,25 +247,8 @@ installcheck: if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \ echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \ exit -1; \ - fi; \ - need_server=0; \ - (echo "X$(EXTRA_TOOL_OPTS)" | grep -q server) && need_server=1; \ - if test $$need_server = 1; then \ - echo "Testing using a systemtap server"; \ - need_server=0; \ - server_pid=`stap-find-or-start-server` || need_server=1; \ - if test $$need_server = 1; then \ - echo "Cannot find or start a systemtap server"; \ - exit -1; \ - fi; \ - client_path=":$$BUILDDIR/testsuite/net"; \ - mkdir -p $$BUILDDIR/testsuite/net; \ - cp -p $(DESTDIR)$(bindir)/stap-client $$BUILDDIR/testsuite/net/stap; \ - fi; \ - $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" EXTRA_SYSTEMTAP_PATH="$(EXTRA_SYSTEMTAP_PATH)$$client_path"; \ - if test "X$$server_pid" != "X"; then \ - stap-stop-server $$server_pid; \ - fi + fi; + $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" EXTRA_SYSTEMTAP_PATH="$(EXTRA_SYSTEMTAP_PATH)" rpm: systemtap.spec dist - rpmbuild --define "_sourcedir $(PWD)/" -ba systemtap.spec + rpmbuild --define "_sourcedir $(PWD)/" -ba $(srcdir)/systemtap.spec diff --git a/Makefile.in b/Makefile.in index e3b6f146..4ed771e8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -338,30 +338,7 @@ EXTRA_DIST = auto_free.h buildrun.h elaborate.h loc2c.h session.h \ systemtap.spec EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples -EXAMPLE_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples -DEMO_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples/small_demos -DEMO_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples/small_demos -SAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.samples -SAMPLE_INSTALL_DIR = $(EXAMPLE_INSTALL_DIR)/samples -EXAMPLE_SRC = $(EXAMPLE_SOURCE_DIR)/ChangeLog \ - $(EXAMPLE_SOURCE_DIR)/README \ - $(EXAMPLE_SOURCE_DIR)/*.stp \ - $(EXAMPLE_SOURCE_DIR)/*.txt \ - $(EXAMPLE_SOURCE_DIR)/*.meta - -DEMO_SRC = \ - $(EXAMPLE_SOURCE_DIR)/small_demos/*.stp \ - $(EXAMPLE_SOURCE_DIR)/small_demos/*.txt \ - $(EXAMPLE_SOURCE_DIR)/small_demos/*.wav - -SAMPLE_SRC = $(SAMPLE_SOURCE_DIR)/iotask.stp \ - $(SAMPLE_SOURCE_DIR)/kmalloc-stacks.stp \ - $(SAMPLE_SOURCE_DIR)/kmalloc-top \ - $(SAMPLE_SOURCE_DIR)/pfaults.stp \ - $(SAMPLE_SOURCE_DIR)/profile.stp \ - $(SAMPLE_SOURCE_DIR)/tcp_connections.stp \ - $(SAMPLE_SOURCE_DIR)/topsys.stp - +EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta TEST_COV_DIR = coverage # XXX: leaves behind man pages SUBDIRS = testsuite doc @@ -1187,8 +1164,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -1213,8 +1190,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -1224,13 +1201,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -1303,6 +1279,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -1330,6 +1310,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -1391,7 +1373,6 @@ distcleancheck: distclean check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive -@BUILD_CRASHMOD_FALSE@all-local: all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h all-local installdirs: installdirs-recursive installdirs-am: @@ -1499,7 +1480,7 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 clean-binPROGRAMS clean-generic clean-local \ clean-noinstPROGRAMS clean-pkglibexecPROGRAMS ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-shar dist-tarZ dist-zip distcheck distclean \ + dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ @@ -1570,10 +1551,19 @@ install-exec-hook: @BUILD_CRASHMOD_TRUE@$(STAPLOG): staplog.c @BUILD_CRASHMOD_TRUE@ $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \ @BUILD_CRASHMOD_TRUE@ $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $< -@BUILD_CRASHMOD_TRUE@all-local: $(STAPLOG) +@BUILD_CRASHMOD_TRUE@all-local: $(STAPLOG) example_index @BUILD_CRASHMOD_TRUE@install-exec-local: $(STAPLOG) @BUILD_CRASHMOD_TRUE@ $(MKDIR_P) $(DESTDIR)$(pkglibdir) @BUILD_CRASHMOD_TRUE@ $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir) +@BUILD_CRASHMOD_FALSE@all-local: example_index + +example_index: $(EXAMPLE_SOURCE_DIR)/index.html + +$(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN) + @echo "The script example index is outdated, run" + @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ " + @echo " perl examples-index-gen.pl" + @echo "to regenerate it." dist-hook: dist-gitversion find $(distdir) -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf @@ -1590,12 +1580,12 @@ install-data-local: do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done) (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \ | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done) - $(MKDIR_P) $(EXAMPLE_INSTALL_DIR) - $(INSTALL_DATA) $(EXAMPLE_SRC) $(EXAMPLE_INSTALL_DIR) - $(MKDIR_P) $(DEMO_INSTALL_DIR) - $(INSTALL_DATA) $(DEMO_SRC) $(DEMO_INSTALL_DIR) - $(MKDIR_P) $(SAMPLE_INSTALL_DIR) - $(INSTALL_DATA) $(SAMPLE_SRC) $(SAMPLE_INSTALL_DIR) + (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \ + | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl' \ + | while read f; do if test -x $$f; then \ + i_cmd="$(INSTALL_PROGRAM)"; else \ + i_cmd="$(INSTALL_DATA)"; fi; \ + $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done) gcov: @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check @@ -1636,28 +1626,9 @@ uninstall-local: check: SRCDIR=`cd $(srcdir); pwd`; \ - BUILDDIR=`cd $(builddir); pwd`; \ - need_server=0; \ - (echo "X$(EXTRA_TOOL_OPTS)" | grep -q server) && need_server=1; \ - if test $$need_server = 1; then \ - echo "Testing using a systemtap server"; \ - need_server=0; \ - server_pid=`stap-find-or-start-server` || need_server=1; \ - if test $$need_server = 1; then \ - echo "Cannot find or start a systemtap server"; \ - exit -1; \ - fi; \ - client_path="$$BUILDDIR/testsuite/net"; \ - mkdir -p $$BUILDDIR/testsuite/net; \ - cp -p $$SRCDIR/stap-client $$BUILDDIR/testsuite/net/stap; \ - fi; \ - $(MAKE) -C testsuite check SYSTEMTAP_RUNTIME=$$SRCDIR/runtime SYSTEMTAP_TAPSET=$$SRCDIR/tapset LD_LIBRARY_PATH=$(PWD)/lib-elfutils:$(PWD)/lib-elfutils/systemtap SYSTEMTAP_PATH="$$client_path:$(PWD)" RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ - if test "X$$server_pid" != "X"; then \ - stap-stop-server $$server_pid; \ - fi + $(MAKE) -C testsuite check SYSTEMTAP_RUNTIME=$$SRCDIR/runtime SYSTEMTAP_TAPSET=$$SRCDIR/tapset LD_LIBRARY_PATH=$(PWD)/lib-elfutils:$(PWD)/lib-elfutils/systemtap SYSTEMTAP_PATH="$(PWD)" RUNTESTFLAGS="$(RUNTESTFLAGS)"; installcheck: - BUILDDIR=`cd $(builddir); pwd`; \ if test \! -e $(DESTDIR)$(bindir)/stap; then \ echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \ exit -1; \ @@ -1665,28 +1636,11 @@ installcheck: if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \ echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \ exit -1; \ - fi; \ - need_server=0; \ - (echo "X$(EXTRA_TOOL_OPTS)" | grep -q server) && need_server=1; \ - if test $$need_server = 1; then \ - echo "Testing using a systemtap server"; \ - need_server=0; \ - server_pid=`stap-find-or-start-server` || need_server=1; \ - if test $$need_server = 1; then \ - echo "Cannot find or start a systemtap server"; \ - exit -1; \ - fi; \ - client_path=":$$BUILDDIR/testsuite/net"; \ - mkdir -p $$BUILDDIR/testsuite/net; \ - cp -p $(DESTDIR)$(bindir)/stap-client $$BUILDDIR/testsuite/net/stap; \ - fi; \ - $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" EXTRA_SYSTEMTAP_PATH="$(EXTRA_SYSTEMTAP_PATH)$$client_path"; \ - if test "X$$server_pid" != "X"; then \ - stap-stop-server $$server_pid; \ - fi + fi; + $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" EXTRA_SYSTEMTAP_PATH="$(EXTRA_SYSTEMTAP_PATH)" rpm: systemtap.spec dist - rpmbuild --define "_sourcedir $(PWD)/" -ba systemtap.spec + rpmbuild --define "_sourcedir $(PWD)/" -ba $(srcdir)/systemtap.spec # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,12 +11,15 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -31,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -47,8 +50,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -343,7 +348,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -391,13 +396,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -502,16 +507,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -872,7 +878,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) diff --git a/doc/Makefile.in b/doc/Makefile.in index 6464afc3..e01c5ebf 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/runtime/ChangeLog b/runtime/ChangeLog index a8d73ffd..7dfade1c 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,17 @@ +2008-08-08 David Smith <dsmith@redhat.com> + + * task_finder.c (stap_utrace_detach): New function. + (stap_utrace_detach_ops): Calls stap_utrace_detach(). + (__stp_utrace_attach_match_filename): Ditto. + + * task_finder.c (__stp_tf_vm_cb): Added calls to save/delete vma + information. + * task_finder_vma.c (__stp_tf_vma_map_hash): New function. + (__stp_tf_get_vma_map_entry_internal): Ditto. + (stap_add_vma_map_info): Ditto. + (stap_remove_vma_map_info): Ditto. + (stap_find_vma_map_info): Ditto. + 2008-07-24 Josh Stone <joshua.i.stone@intel.com> * runtime/autoconf-module-nsections.c: removed diff --git a/runtime/task_finder.c b/runtime/task_finder.c index a4e18578..541e5a04 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -57,6 +57,15 @@ int __stp_tf_vm_cb(struct task_struct *tsk, _stp_dbug(__FUNCTION__, __LINE__, "vm_cb: tsk %d:%d path %s, start 0x%08lx, end 0x%08lx, offset 0x%lx\n", tsk->pid, map_p, vm_path, vm_start, vm_end, vm_pgoff); + if (map_p) { + // FIXME: What should we do with vm_path? We can't save + // the vm_path pointer itself, but we don't have any + // storage space allocated to save it in... + stap_add_vma_map_info(tsk, vm_start, vm_end, vm_pgoff); + } + else { + stap_remove_vma_map_info(tsk, vm_start, vm_end, vm_pgoff); + } return 0; } #endif @@ -151,12 +160,72 @@ stap_register_task_finder_target(struct stap_task_finder_target *new_tgt) return 0; } +static int +stap_utrace_detach(struct task_struct *tsk, + const struct utrace_engine_ops *ops) +{ + struct utrace_attached_engine *engine; + struct mm_struct *mm; + int rc = 0; + + // Ignore init + if (tsk == NULL || tsk->pid <= 1) + return 0; + + // Notice we're not calling get_task_mm() here. Normally we + // avoid tasks with no mm, because those are kernel threads. + // So, why is this function different? When a thread is in + // the process of dying, its mm gets freed. Then, later the + // thread gets in the dying state and the thread's DEATH event + // handler gets called (if any). + // + // If a thread is in this "mortally wounded" state - no mm + // but not dead - and at that moment this function is called, + // we'd miss detaching from it if we were checking to see if + // it had an mm. + + engine = utrace_attach(tsk, UTRACE_ATTACH_MATCH_OPS, ops, 0); + if (IS_ERR(engine)) { + rc = -PTR_ERR(engine); + if (rc != ENOENT) { + _stp_error("utrace_attach returned error %d on pid %d", + rc, tsk->pid); + } + else { + rc = 0; + } + } + else if (unlikely(engine == NULL)) { + _stp_error("utrace_attach returned NULL on pid %d", + (int)tsk->pid); + rc = EFAULT; + } + else { + rc = utrace_detach(tsk, engine); + switch (rc) { + case 0: /* success */ + debug_task_finder_detach(); + break; + case -ESRCH: /* REAP callback already begun */ + case -EALREADY: /* DEATH callback already begun */ + rc = 0; /* ignore these errors*/ + break; + default: + rc = -rc; + _stp_error("utrace_detach returned error %d on pid %d", + rc, tsk->pid); + break; + } + } + return rc; +} + static void stap_utrace_detach_ops(struct utrace_engine_ops *ops) { struct task_struct *grp, *tsk; struct utrace_attached_engine *engine; - long error = 0; + int rc = 0; pid_t pid = 0; // Notice we're not calling get_task_mm() in this loop. In @@ -174,31 +243,12 @@ stap_utrace_detach_ops(struct utrace_engine_ops *ops) rcu_read_lock(); do_each_thread(grp, tsk) { - if (tsk == NULL || tsk->pid <= 1) - continue; - - engine = utrace_attach(tsk, UTRACE_ATTACH_MATCH_OPS, - ops, 0); - if (IS_ERR(engine)) { - error = -PTR_ERR(engine); - if (error != ENOENT) { - pid = tsk->pid; - goto udo_err; - } - error = 0; - } - else if (engine != NULL) { - utrace_detach(tsk, engine); - debug_task_finder_detach(); - } + rc = stap_utrace_detach(tsk, ops); + if (rc != 0) + goto udo_err; } while_each_thread(grp, tsk); udo_err: rcu_read_unlock(); - - if (error != 0) { - _stp_error("utrace_attach returned error %d on pid %d", - error, pid); - } debug_task_finder_report(); } @@ -382,14 +432,10 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk, cb_tgt->engine_attached = 1; } else { - struct utrace_attached_engine *engine; - engine = utrace_attach(tsk, - UTRACE_ATTACH_MATCH_OPS, - &cb_tgt->ops, 0); - if (! IS_ERR(engine) && engine != NULL) { - utrace_detach(tsk, engine); - debug_task_finder_detach(); - } + rc = stap_utrace_detach(tsk, &cb_tgt->ops); + if (rc != 0) + break; + cb_tgt->engine_attached = 0; } } } diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c index c0a018ab..9d43e36c 100644 --- a/runtime/task_finder_vma.c +++ b/runtime/task_finder_vma.c @@ -34,6 +34,8 @@ static struct hlist_head __stp_tf_vma_free_list[1]; static struct hlist_head __stp_tf_vma_table[__STP_TF_TABLE_SIZE]; +static struct hlist_head __stp_tf_vma_map[__STP_TF_TABLE_SIZE]; + // __stp_tf_vma_initialize(): Initialize the free list. Grabs the // mutex. static void @@ -171,3 +173,133 @@ __stp_tf_remove_vma_entry(struct __stp_tf_vma_entry *entry) } return 0; } + + + +// __stp_tf_vma_map_hash(): Compute the vma map hash. +static inline u32 +__stp_tf_vma_map_hash(struct task_struct *tsk) +{ + return (jhash_1word(tsk->pid, 0) & (__STP_TF_TABLE_SIZE - 1)); +} + +// Get vma_entry if the vma is present in the vma map hash table. +// Returns NULL if not present. The __stp_tf_vma_mutex must be locked +// before calling this function. +static struct __stp_tf_vma_entry * +__stp_tf_get_vma_map_entry_internal(struct task_struct *tsk, + unsigned long vm_start) +{ + struct hlist_head *head; + struct hlist_node *node; + struct __stp_tf_vma_entry *entry; + + head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)]; + hlist_for_each_entry(entry, node, head, hlist) { + if (tsk->pid == entry->pid + && vm_start == entry->addr) { + mutex_unlock(&__stp_tf_vma_mutex); + return entry; + } + } + return NULL; +} + + +// Add the vma info to the vma map hash table. +static int +stap_add_vma_map_info(struct task_struct *tsk, unsigned long vm_start, + unsigned long vm_end, unsigned long vm_pgoff) +{ + struct hlist_head *head; + struct hlist_node *node; + struct __stp_tf_vma_entry *entry; + + mutex_lock(&__stp_tf_vma_mutex); + entry = __stp_tf_get_vma_map_entry_internal(tsk, vm_start); + if (entry != NULL) { +#if 0 + printk(KERN_NOTICE + "vma (pid: %d, vm_start: 0x%lx) present?\n", + tsk->pid, entry->vm_start); +#endif + mutex_unlock(&__stp_tf_vma_mutex); + return -EBUSY; /* Already there */ + } + + // Get an element from the free list. + entry = __stp_tf_vma_get_free_entry(); + if (!entry) { + mutex_unlock(&__stp_tf_vma_mutex); + return -ENOMEM; + } + + // Fill in the info + entry->pid = tsk->pid; + //entry->addr = addr; ??? + entry->vm_start = vm_start; + entry->vm_end = vm_end; + entry->vm_pgoff = vm_pgoff; + + head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)]; + hlist_add_head(&entry->hlist, head); + mutex_unlock(&__stp_tf_vma_mutex); + return 0; +} + + +// Remove the vma entry from the vma hash table. +static int +stap_remove_vma_map_info(struct task_struct *tsk, unsigned long vm_start, + unsigned long vm_end, unsigned long vm_pgoff) +{ + struct hlist_head *head; + struct hlist_node *node; + struct __stp_tf_vma_entry *entry; + + mutex_lock(&__stp_tf_vma_mutex); + entry = __stp_tf_get_vma_map_entry_internal(tsk, vm_start); + if (entry != NULL) { + hlist_del(&entry->hlist); + __stp_tf_vma_put_free_entry(entry); + } + mutex_unlock(&__stp_tf_vma_mutex); + return 0; +} + +// Finds vma info if the vma is present in the vma map hash table. +// Returns ESRCH if not present. The __stp_tf_vma_mutex must *not* be +// locked before calling this function. +static int +stap_find_vma_map_info(struct task_struct *tsk, unsigned long vm_addr, + unsigned long *vm_start, unsigned long *vm_end, + unsigned long *vm_pgoff) +{ + struct hlist_head *head; + struct hlist_node *node; + struct __stp_tf_vma_entry *entry; + struct __stp_tf_vma_entry *found_entry = NULL; + int rc = ESRCH; + + mutex_lock(&__stp_tf_vma_mutex); + head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)]; + hlist_for_each_entry(entry, node, head, hlist) { + if (tsk->pid == entry->pid + && vm_addr >= entry->vm_start + && vm_addr < entry->vm_end) { + found_entry = entry; + break; + } + } + if (found_entry != NULL) { + if (vm_start != NULL) + *vm_start = found_entry->vm_start; + if (vm_end != NULL) + *vm_end = found_entry->vm_end; + if (vm_pgoff != NULL) + *vm_pgoff = found_entry->vm_pgoff; + rc = 0; + } + mutex_unlock(&__stp_tf_vma_mutex); + return rc; +} diff --git a/stap-client b/stap-client index d6bb8442..405692f1 100755 --- a/stap-client +++ b/stap-client @@ -28,6 +28,7 @@ function configuration { # function: initialization function initialization { + rc=0 wd=`pwd` umask 0 @@ -53,6 +54,8 @@ function initialization { # function parse_options { cmdline= + cmdline1= + cmdline2= while test $# != 0 do advance_p=0 @@ -64,26 +67,38 @@ function parse_options { do # Identify the next option first_char=`expr "$first_token" : '\(.\).*'` + second_char= if test $dash_seen = 0; then if test "$first_char" = "-"; then if test "$first_token" != "-"; then - # It's not a lone dash, so it's an option. Remove the dash. - first_token=`expr "$first_token" : '-\(.*\)'` - dash_seen=1 - first_char=`expr "$first_token" : '\(.\).*'` - cmdline="$cmdline -" + # It's not a lone dash, so it's an option. + # Is it a long option (i.e. --option)? + second_char=`expr "$first_token" : '.\(.\).*'` + if test "$second_char" != "-"; then + # It's not a lone dash, or a long option, so it's a short option string. + # Remove the dash. + first_token=`expr "$first_token" : '-\(.*\)'` + dash_seen=1 + first_char=`expr "$first_token" : '\(.\).*'` + cmdline2="$cmdline2 -" + fi fi fi if test $dash_seen = 0; then # The dash has not been seen. This is either the script file - # name or an arument to be passed to the probe module. + # name, a long argument or an argument to be passed to the probe module. # If this is the first time, and -e has not been specified, # then it could be the name of the script file. - if test "X$e_script" = "X" -a "X$script_file" = "X"; then + if test "X$second_char" = "X-"; then + cmdline2="$cmdline2 $first_token" + elif test "X$e_script" = "X" -a "X$script_file" = "X"; then script_file=$first_token + cmdline1="$cmdline2" + cmdline2= + else + cmdline2="$cmdline2 '$first_token'" fi advance_p=$(($advance_p + 1)) - cmdline="$cmdline $first_token" break fi fi @@ -96,7 +111,7 @@ function parse_options { ;; D) get_arg $first_token $2 - cmdline="${cmdline}D '$stap_arg'" + cmdline2="${cmdline2}D '$stap_arg'" ;; e) get_arg $first_token "$2" @@ -111,11 +126,11 @@ function parse_options { ;; l) get_arg $first_token $2 - cmdline="${cmdline}l '$stap_arg'" + cmdline2="${cmdline2}l '$stap_arg'" ;; m) get_arg $first_token $2 - cmdline="${cmdline}m $stap_arg" + cmdline2="${cmdline2}m $stap_arg" ;; o) get_arg $first_token $2 @@ -127,7 +142,7 @@ function parse_options { ;; r) get_arg $first_token $2 - cmdline="${cmdline}r $stap_arg" + cmdline2="${cmdline2}r $stap_arg" ;; R) get_arg $first_token $2 @@ -135,14 +150,14 @@ function parse_options { ;; s) get_arg $first_token $2 - cmdline="${cmdline}s $stap_arg" + cmdline2="${cmdline2}s $stap_arg" ;; v) v_level=$(($v_level + 1)) ;; x) get_arg $first_token $2 - cmdline="${cmdline}x $stap_arg" + cmdline2="${cmdline2}x $stap_arg" ;; *) # An unknown or unimportant flag. Ignore it, but pass it on to the server. @@ -151,7 +166,7 @@ function parse_options { if test $advance_p = 0; then # Just another flag character. Consume it. - cmdline="$cmdline$first_char" + cmdline2="$cmdline2$first_char" first_token=`expr "$first_token" : '.\(.*\)'` if test "X$first_token" = "X"; then advance_p=$(($advance_p + 1)) @@ -176,7 +191,9 @@ function parse_options { else local_name=$script_file fi - cmdline=`echo $cmdline | sed s,$script_file,script/$local_name,` + cmdline="$cmdline1 script/$local_name $cmdline2" + else + cmdline="$cmdline1 $cmdline2" fi } @@ -207,7 +224,7 @@ function get_arg { # Process the -c flag. function process_c { c_cmd="$1" - cmdline="${cmdline}c '$1'" + cmdline2="${cmdline2}c '$1'" } # function: process_e ARGUMENT @@ -218,9 +235,13 @@ function process_e { # which may have already been identified. if test "X$e_script" = "X"; then e_script="$1" - script_file= + if test "X$script_file" != "X"; then + cmdline1="$cmdline1 $script_file $cmdline2" + cmdline2= + script_file= + fi fi - cmdline="${cmdline}e '$1'" + cmdline2="${cmdline2}e '$1'" } # function: process_I ARGUMENT @@ -229,7 +250,7 @@ function process_e { function process_I { local local_name=`include_file_or_directory tapsets $1` test "X$local_name" != "X" || return - cmdline="${cmdline}I $local_name" + cmdline2="${cmdline2}I 'tapsets/$local_name'" } # function: process_o ARGUMENT @@ -237,7 +258,7 @@ function process_I { # Process the -o flag. function process_o { stdout_redirection="> $1" - cmdline="${cmdline}o $1" + cmdline2="${cmdline2}o '$1'" } # function: process_p ARGUMENT @@ -245,7 +266,7 @@ function process_o { # Process the -p flag. function process_p { p_phase=$1 - cmdline="${cmdline}p '$1'" + cmdline2="${cmdline2}p '$1'" } # function: process_R ARGUMENT @@ -254,7 +275,7 @@ function process_p { function process_R { local local_name=`include_file_or_directory runtime $1` test "X$local_name" != "X" || return - cmdline="${cmdline}R $local_name" + cmdline2="${cmdline2}R 'runtime/$local_name'" } # function: include_file_or_directory PREFIX NAME @@ -268,7 +289,7 @@ function include_file_or_directory { fatal "ERROR: could not create $tmpdir_client/$1/`dirname $local_name`" ln -s /$local_name $tmpdir_client/$1/$local_name || \ fatal "ERROR: could not link $tmpdir_client/$1/$local_name to /$local_name" - echo $local_name + echo "$local_name" } # function: generate_client_temp_name NAME @@ -277,12 +298,12 @@ function include_file_or_directory { # client's temporary directory. function generate_client_temp_name { # Transform the name into a fully qualified path name - local full_name=`echo $1 | sed "s,^\\\([^/]\\\),$wd/\\\\1,"` + local full_name=`echo "$1" | sed "s,^\\\([^/]\\\),$wd/\\\\1,"` # The same name without the initial / or trailing / - local local_name=`echo $full_name | sed 's,^/\(.*\),\1,'` - local_name=`echo $local_name | sed 's,\(.*\)/$,\1,'` - echo $local_name + local local_name=`echo "$full_name" | sed 's,^/\(.*\),\1,'` + local_name=`echo "$local_name" | sed 's,\(.*\)/$,\1,'` + echo "$local_name" } # function: create_request @@ -316,7 +337,7 @@ function client_sysinfo { # Add some info from uname sysinfo_client="`uname -rvm`" fi - echo $sysinfo_client + echo "$sysinfo_client" } # function: package_request @@ -353,8 +374,10 @@ function send_request { test "$line" = "ready:" || \ fatal "ERROR: server response, '$line', is incorrect" - # Send the request file. - until nc $server $(($port + 1)) < $tar_client + # Send the request file. We need to redirect to /dev/null + # in order to workaround a nc bug. It closes the connection + # early if stdin from the other side is not provided. + until nc $server $(($port + 1)) < $tar_client > /dev/null do sleep 1 done @@ -364,7 +387,7 @@ function send_request { # # Wait for a response from the server indicating the results of our request. # protocol is: -# server -> "done:" +# server -> "{done,failed}:" # server -> $tar_server function receive_response { # Get the server's response. @@ -373,15 +396,21 @@ function receive_response { check_server_error $line # Check for the proper response. - test "$line" = "done:" || \ - fatal "ERROR: server response, '$line', is incorrect" + if test "$line" != "done:"; then + if test "$line" != "failed:"; then + fatal "ERROR: server response, '$line', is incorrect" + fi + rc=1 + fi # Make a place to receive the response file. tar_server=`mktemp -t $tmpdir_prefix_client.server.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary file " $tar_server - # Retrieve the file - until nc $server $(($port + 1)) > $tar_server + # Retrieve the file. We need to redirect stdin from /dev/zero to work + # around a bug in nc. It closes the connection early is stdin is not + # provided. + until nc $server $(($port + 1)) < /dev/zero > $tar_server do sleep 1 done @@ -530,21 +559,37 @@ function stream_output { # # Call staprun using the module returned from the server, if requested. function maybe_call_staprun { - if test $p_phase = 5; then - # Can't call staprun without a module. - test "X$tmpdir_stap" = "X" && return + if test $rc != 0; then + # stap run on the server failed, so don't bother + return + fi + if test $p_phase -ge 4; then + # There should be a systemtap temporary directory. + if test "X$tmpdir_stap" = "X"; then + # OK if no script specified + if test "X$script_file" != "X"; then + fatal "ERROR: systemtap temporary directory is missing in server response" + fi + return + fi + + # There should be a module. local mod_name=`ls $tmpdir_stap | grep '.ko$'` - test "X$mod_name" != "X" || \ - fatal "ERROR: no module to run in $tmpdir_stap" + if test "X$mod_name" = "X"; then + fatal "ERROR: no module was found in $tmpdir_stap" + fi - # We have a module. Try to run it - for ((--v_level; $v_level > 0; --v_level)) - do - staprun_opts="$staprun_opts -v" - done - PATH=`staprun_PATH` staprun $staprun_opts \ - $tmpdir_stap/`ls $tmpdir_stap | grep '.ko$'` + if test $p_phase = 5; then + # We have a module. Try to run it + for ((--v_level; $v_level > 0; --v_level)) + do + staprun_opts="$staprun_opts -v" + done + PATH=`staprun_PATH` staprun $staprun_opts \ + $tmpdir_stap/`ls $tmpdir_stap | grep '.ko$'` + rc=$? + fi fi } @@ -562,14 +607,14 @@ function staprun_PATH { # Otherwise, remove the PATH component where we live from the PATH local PATH_component=`dirname $first_stap` - echo $PATH | sed "s,$PATH_component,,g" + echo "$PATH" | sed "s,$PATH_component,,g" } # function: check_server_error SERVER_RESPONSE # # Check the given server response for an error message. function check_server_error { - echo $1 | grep -q "^ERROR:" && \ + echo "$1" | grep -q "^ERROR:" && \ server_fatal "Server:" "$@" } @@ -578,7 +623,7 @@ function check_server_error { # Fatal error # Prints its arguments to stderr and exits function fatal { - echo $0: "$@" >&2 + echo "$0:" "$@" >&2 disconnect_from_server cleanup exit 1 @@ -589,7 +634,7 @@ function fatal { # Fatal error # Prints its arguments to stderr and exits function server_fatal { - echo $0: "$@" >&2 + echo "$0:" "$@" >&2 cat <&3 >&2 disconnect_from_server cleanup @@ -621,10 +666,10 @@ package_request find_and_connect_to_server send_request receive_response -unpack_response disconnect_from_server +unpack_response stream_output maybe_call_staprun cleanup -exit 0 +exit $rc diff --git a/stap-find-or-start-server b/stap-find-or-start-server index 0ea0ef43..32a45052 100755 --- a/stap-find-or-start-server +++ b/stap-find-or-start-server @@ -10,27 +10,23 @@ # later version. # This script attempts to find a systemtap server. If one is found, it -# simply exits with 0. +# echoes 0 and exits with 0. # # Otherwise, it attempts to start a server. If succesful, it echoes the # process id and exits with 0. # -# Otherwise, it exits with 1 +# Otherwise, it echoes -1 and exits with 1 # Is there a server available? -stap-find-servers >/dev/null 2>&1 && exit 0 +stap-find-servers >/dev/null 2>&1 && echo 0 && exit 0 # No server available, try to start one. pid=`stap-start-server` if test $? = 0; then - echo $pid - # Make sure the server is started - for ((attempt=0; $attempt < 5; ++attempt)) - do - stap-find-servers >/dev/null 2>&1 && exit 0 - sleep 1 - done + echo $pid + exit 0 fi # Could not find or start a server +echo -1 exit 1 diff --git a/stap-find-servers b/stap-find-servers index 9e7b633d..fea645bd 100755 --- a/stap-find-servers +++ b/stap-find-servers @@ -87,7 +87,7 @@ function match_server { server_port=`expr "$service_data" : '\[\([^]]*\)\]'` ;; txt ) - server_sysinfo=`expr "$service_data" : '\[\"\([^]]*\)\"\]'` + server_sysinfo=`expr "$service_data" : '\[.*\"\(sysinfo=[^]]*\)\"\]'` ;; * ) break ;; @@ -115,7 +115,7 @@ function client_sysinfo { # Add some info from uname sysinfo_client="`uname -rvm`" fi - echo $sysinfo_client + echo sysinfo=$sysinfo_client } #----------------------------------------------------------------------------- diff --git a/stap-server b/stap-server index e825c49a..15a2fb48 100755 --- a/stap-server +++ b/stap-server @@ -31,6 +31,7 @@ function configuration { # function: initialization function initialization { # Initialization + stap_rc=0 wd=`pwd` # Default options settings @@ -58,11 +59,14 @@ function receive_request { tar_client=`mktemp -t $tmpdir_prefix_server.client.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary tar file " $tar_client + # Receive the file. We need to redirect stdin from /dev/zero to work + # around a bug in nc. It closes the connection early is stdin is not + # provided. + nc -l $port < /dev/zero > $tar_client & + # Request that the file be sent. echo "ready:" - - # Receive the file. - nc -l $port < /dev/null > $tar_client + wait %nc } # function: unpack_request @@ -125,7 +129,7 @@ function server_sysinfo { # Add some info from uname sysinfo_server="`uname -rvm`" fi - echo $sysinfo_server + echo "$sysinfo_server" } # function check_compaibility SYSINFO1 SYSINFO2 @@ -152,14 +156,30 @@ function read_data_file { test -f $1 || \ fatal "ERROR: Data file $1 not found" - read < $1 + # Open the file + exec 3< $1 + + # Verify the first line of the file. + read <&3 line=$REPLY data=`expr "$line" : "$1: \\\(.*\\\)"` - if test "X$data" != "X"; then - echo $data + if test "X$data" = "X"; then + fatal "ERROR: Data in file $1 is incorrect" return fi - fatal "ERROR: Data in file $1 is incorrect" + + # Add any additional lines of data + while read <&3 + do + data="$data +$REPLY" + done + + # Close the file + exec 3<&- + + # Echo the result + echo "$data" } # function: parse_options [ STAP-OPTIONS ] @@ -316,9 +336,11 @@ function call_stap { server_p_phase=$p_phase fi - eval stap $cmdline -k -p $server_p_phase \ + eval stap "$cmdline" -k -p $server_p_phase \ >> $tmpdir_server/stdout \ 2>> $tmpdir_server/stderr + + stap_rc=$? } # function: create_response @@ -371,12 +393,20 @@ function package_response { # Notify the client that $tar_server is ready and wait for the client to take # it. # The protocol is: -# server -> "done:" +# server -> "{done,failed}:" # server -> $tar_server function send_response { - echo "done:" - # Now send it - nc -l $port < $tar_server > /dev/null + # Now send it. We need to redirect to /dev/null + # in order to workaround a nc bug. It closes the connection + # early if stdin from the other side is not provided. + nc -l $port < $tar_server > /dev/null & + + if test $stap_rc = 0; then + echo "done:" + else + echo "failed:" + fi + wait %nc } # function: fatal [ MESSAGE ] @@ -408,6 +438,9 @@ function cleanup { rm -fr $tmpdir_server rm -fr $tmpdir_stap fi + + # Kill any nc job that may be running + kill -s SIGTERM %nc 2> /dev/null } # function: terminate @@ -416,7 +449,7 @@ function cleanup { function terminate { # Clean up cleanup - exit + exit 1 } #----------------------------------------------------------------------------- @@ -427,7 +460,7 @@ initialization receive_request unpack_request check_request -eval parse_options $cmdline +eval parse_options "$cmdline" call_stap create_response package_response diff --git a/stap-serverd b/stap-serverd index af4b2717..32888ecc 100755 --- a/stap-serverd +++ b/stap-serverd @@ -26,6 +26,11 @@ function initialization { avahi_type=_stap._tcp port=$1 test "X$port" = "X" && port=65000 + port2=$(($port + 1)) + if netstat -atn | awk '{print $4}' | cut -f2 -d: | egrep -q "^($port|$port2)\$"; then + # Whoops, the port is busy; try another one. + initialization $((1024+($port + $RANDOM)%64000)) + fi } # function: advertise_presence @@ -35,7 +40,7 @@ function advertise_presence { # Build up a string representing our server's properties. # TODO: this needs fleshing out. local sysinfo=`uname -rvm` - local txt="$sysinfo" + local txt="sysinfo=$sysinfo" # Call avahi-publish-service to advertise our presence. avahi-publish-service "Systemtap Compile Server on `uname -n`" \ @@ -59,13 +64,32 @@ function listen { fatal "ERROR: cannot create temporary fifo " $tmpdir/$fifo_name # Loop forever accepting requests + first=1 + set -o pipefail # We want the status of 'nc' not 'stap-server'. while true do # Run this in the background and wait for it. This way any signals - # received (i.e. SIGTERM) will be processed. - nc -l $port < $fifo_name | stap-server $((port + 1)) > $fifo_name 2>&1 & - wait %nc + # received (i.e. SIGTERM) will be processed. Make sure we don't + # advertise our presence until we're actually listening. + for ((attempt=0; $attempt < 5; ++attempt)) + do + nc -l $port < $fifo_name | stap-server $((port + 1)) > $fifo_name 2>&1 & + if test $first = 1; then + advertise_presence + first=0 + fi + wait %nc + rc=$? + if test $rc = 127 -o $rc = 0; then + break; # success + fi + sleep 1 + done + if test $attempt = 10; then + fatal "ERROR: cannot listen on port $port. rc==$rc" + fi done + set +o pipefail # restore } # function: fatal [ MESSAGE ] @@ -74,6 +98,7 @@ function listen { # Prints its arguments to stderr and exits function fatal { echo "$@" >&2 + terminate exit 1 } @@ -102,5 +127,4 @@ function terminate { # Beginning of main line execution. #----------------------------------------------------------------------------- initialization "$@" -advertise_presence listen diff --git a/stap-start-server b/stap-start-server index d143e269..eea86526 100755 --- a/stap-start-server +++ b/stap-start-server @@ -16,9 +16,11 @@ stap-serverd </dev/null >/dev/null 2>&1 & server_pid=$! -# Exit if the server did not start ok -(ps | grep -q $server_pid) || exit 1 +# Make sure the server is started +for ((attempt=0; $attempt < 5; ++attempt)) +do + stap-find-servers >/dev/null 2>&1 && echo $server_pid && exit 0 + sleep 1 +done -# The server started ok. Echo its process id. -echo $server_pid -exit 0 +exit 1 # server did not start diff --git a/stapprobes.5.in b/stapprobes.5.in index 24075248..d20ea006 100644 --- a/stapprobes.5.in +++ b/stapprobes.5.in @@ -292,9 +292,10 @@ operators to match multiple names. The second part is optional and begins with the "@" character. It is followed by the path to the source file containing the function, which may include a wildcard pattern, such as mm/slab*. -In most cases, the path should be relative to the top of the -linux source directory, although an absolute path may be necessary for some kernels. -If a relative pathname doesn't work, try absolute. +If it does not match as is, an implicit "*/" is optionally added +.I before +the pattern, so that a script need only name the last few components +of a possibly long source directory path. .IP \(bu 4 Finally, the third part is optional if the file name part was given, and identifies the line number in the source file preceded by a ":" @@ -305,9 +306,16 @@ All the lines in the function can be matched with ":*". A range of lines x through y can be matched with ":x-y". .PP As an alternative, PATTERN may be a numeric constant, indicating an -(module-relative or kernel-_stext-relative) address. In guru mode -only, absolute kernel addresses may be specified with the ".absolute" -suffix. +address. Such an address may be found from symbol tables of the +appropriate kernel / module object file. It is verified against +known statement code boundaries, and will be relocated for use at +run time. +.PP +In guru mode only, absolute kernel-space addresses may be specified with +the ".absolute" suffix. Such an address is considered already relocated, +as if it came from +.BR /proc/kallsyms , +so it cannot be checked against statement/instruction boundaries. .PP Some of the source-level context variables, such as function parameters, locals, globals visible in the compilation unit, may be visible to @@ -412,7 +420,9 @@ probe gets called for every single step of the process described by PID or PATH. .PP Note that .I PATH -pathnames must be absolute. +names refer to executables that are searched the same way shells do: relative +to the working directory if they contain a "/" character, otherwise in +.BR $PATH . .SS PROCFS diff --git a/staprun.8.in b/staprun.8.in index ca976a4a..c7e77dc4 100644 --- a/staprun.8.in +++ b/staprun.8.in @@ -99,8 +99,7 @@ to compile a script. The .I stap program will report the pathname to the resulting module. .PP -.Vb 1 -\& $ stap \-p4 \-e 'probe begin { printf("Hello World!\\n"); exit() }' +\& $ stap \-p4 \-e \[aq]probe begin { printf("Hello World!\\n"); exit() }\[aq] .br \& /home/user/.systemtap/cache/85/stap_8553d83f78c_265.ko .PP @@ -108,7 +107,6 @@ Run .I staprun with the pathname to the module as an argument. .PP -.Vb 1 \& $ staprun /home/user/.systemtap/cache/85/stap_8553d83f78c_265.ko .br \& Hello World! @@ -161,6 +159,6 @@ user and not be world writable. .SH BUGS Use the Bugzilla link off of the project web page or our mailing list. .nh -.BR http://sources.redhat.com/systemtap/ , <systemtap@sources.redhat.com> . +.BR http://sources.redhat.com/systemtap/ ", " <systemtap@sources.redhat.com> . .hy diff --git a/systemtap.spec b/systemtap.spec index 503022d1..da2a6fb2 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -46,6 +46,7 @@ Requires: crash %if %{with_docs} BuildRequires: /usr/bin/latex /usr/bin/dvips /usr/bin/ps2pdf latex2html %endif +Requires: avahi-tools nc %description SystemTap is an instrumentation system for systems running Linux 2.6. @@ -59,6 +60,7 @@ License: GPLv2+ URL: http://sourceware.org/systemtap/ Requires: kernel >= 2.6.9-11 Requires(pre): shadow-utils +Requires: avahi-tools nc %description runtime SystemTap runtime is the runtime component of an instrumentation @@ -135,14 +137,17 @@ make %{?_smp_mflags} rm -rf ${RPM_BUILD_ROOT} make DESTDIR=$RPM_BUILD_ROOT install -# We want the examples in the special doc dir, not the generoc doc install dir. +# We want the examples in the special doc dir, not the build install dir. +# We build it in place and then move it away so it doesn't get installed +# twice. rpm can specify itself where the (versioned) docs go with the +# %doc directive. mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/examples examples # Fix paths in the example & testsuite scripts find examples testsuite -type f -name '*.stp' -print0 | xargs -0 sed -i -r -e '1s@^#!.+stap@#!%{_bindir}/stap@' # To avoid perl dependency, make perl sample script non-executable -chmod -x examples/samples/kmalloc-top +#chmod -x examples/samples/kmalloc-top # Because "make install" may install staprun with mode 04111, the # post-processing programs rpmbuild runs won't be able to read it. @@ -155,6 +160,9 @@ cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap #%if %{with_docs} # We want the manuals in the special doc dir, not the generic doc install dir. +# We build it in place and then move it away so it doesn't get installed +# twice. rpm can specify itself where the (versioned) docs go with the +# %doc directive. mkdir docs.installed mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/*.pdf docs.installed/ #%endif @@ -178,10 +186,6 @@ exit 0 %{_bindir}/stap %{_bindir}/stap-server %{_bindir}/stap-serverd -%{_bindir}/stap-find-servers -%{_bindir}/stap-start-server -%{_bindir}/stap-find-or-start-server -%{_bindir}/stap-stop-server %{_mandir}/man1/* %{_mandir}/man5/* @@ -203,6 +207,10 @@ exit 0 %defattr(-,root,root) %attr(4111,root,root) %{_bindir}/staprun %{_bindir}/stap-client +%{_bindir}/stap-find-servers +%{_bindir}/stap-start-server +%{_bindir}/stap-find-or-start-server +%{_bindir}/stap-stop-server %{_libexecdir}/%{name} %{_mandir}/man8/* diff --git a/tapsets.cxx b/tapsets.cxx index 48947a60..a321b4e8 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -853,9 +853,10 @@ struct dwflpp // PR 5049: implicit * in front of given path pattern. // NB: fnmatch() is used without FNM_PATHNAME. - string prefixed_pattern = string("*") + pattern; + string prefixed_pattern = string("*/") + pattern; - bool t = (fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); + bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0 || + fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); if (t && sess.verbose>3) clog << "pattern '" << prefixed_pattern << "' " << "matches " @@ -1299,7 +1300,7 @@ struct dwflpp // PR 5049: implicit * in front of given path pattern. // NB: fnmatch() is used without FNM_PATHNAME. - string prefixed_pattern = string("*") + pattern; + string prefixed_pattern = string("*/") + pattern; dwarf_assert ("dwarf_getsrcfiles", dwarf_getsrcfiles (cu, &srcfiles, &nfiles)); @@ -1307,7 +1308,8 @@ struct dwflpp for (size_t i = 0; i < nfiles; ++i) { char const * fname = dwarf_filesrc (srcfiles, i, NULL, NULL); - if (fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) + if (fnmatch (pattern.c_str(), fname, 0) == 0 || + fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) { filtered_srcfiles.insert (fname); if (sess.verbose>2) @@ -6310,13 +6312,7 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "case UDPF_SYSCALL:"; s.op->newline() << "case UDPF_SYSCALL_RETURN:"; s.op->indent(1); - s.op->newline() << "engine = utrace_attach(tsk, UTRACE_ATTACH_MATCH_OPS, &p->ops, 0);"; - s.op->newline() << "if (! IS_ERR(engine) && engine != NULL) {"; - s.op->indent(1); - s.op->newline() << "utrace_detach(tsk, engine);"; - s.op->newline() << "debug_task_finder_detach();"; - - s.op->newline(-1) << "}"; + s.op->newline() << "stap_utrace_detach(tsk, &p->ops);"; s.op->newline() << "break;"; s.op->indent(-1); } diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 9ee9037e..83bc8b1d 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -3,6 +3,30 @@ PR5049 * semok/thirtyone.stp: New test. +2008-08-08 Dave Brolley <brolley@redhat.com> + + * lib/systemtap.exp (setup_systemtap_environment): If use_server_p, + start or find a systemtap server. + (systemtap_exit): If we started a server, stop it. + * Makefile.am (EXTRA_SYSTEMTAP_PATH): Removed. + (EXTRA_TOOL_OPTS): Removed. + * Makefile.in: Regenerated. + +2008-08-08 Stan Cox <scox@redhat.com> + + * systemtap.base/stmt_rel.stp: Lower wildcard matching count. + +2008-08-07 David Smith <dsmith@redhat.com> + + * systemtap.base/utrace_p4.exp: Uses lib/stap_compile.exp instead + of its own stap_compile procedure. + * systemtap.base/cache.exp (stap_compile): Ignores warnings. + * lib/stap_compile.exp: Ignores warnings. + +2008-08-05 Mark Wielaard <mwielaard@redhat.com> + + * systemtap.examples/README: Add meta file tag descriptions. + 2008-08-05 Stan Cox <scox@redhat.com> * systemtap.base/warnings.stp: Use relative instead of absolute line. diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 03c70cb6..b92286b0 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -13,7 +13,7 @@ clean-local: DEJAZILLA=@dejazilla@ -TOOL_OPTS=$(EXTRA_TOOL_OPTS) +TOOL_OPTS= # automake's dejagnu library already runs check-DEJAGNU before check-local # That's why we need to add "execrc" to $(RUNTEST) - to ensure that this @@ -32,7 +32,14 @@ EXTRA_DIST = execrc config lib systemtap \ parseok parseko semok semko transok transko buildok buildok \ systemtap.syscall systemtap.stress systemtap.string \ systemtap.pass1-4 systemtap.samples systemtap.printf \ - systemtap.maps systemtap.base + systemtap.maps systemtap.base \ + systemtap.examples/examples-index-gen.pl \ + systemtap.examples/systemtap.css \ + systemtap.examples/systemtapcorner.gif \ + systemtap.examples/systemtaplogo.png \ + systemtap.examples/html_footer.tmpl \ + systemtap.examples/html_header.tmpl + # $(srcdir)/These values point the test suite to the install tree, and # are overridden by "make check" from full source/build tree @@ -40,7 +47,7 @@ SYSTEMTAP_RUNTIME=$(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET=$(DESTDIR)$(pkgdatadir)/tapset LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap CRASH_LIBDIR=$(DESTDIR)$(libdir)/systemtap -SYSTEMTAP_PATH=$(EXTRA_SYSTEMTAP_PATH):$(DESTDIR)$(bindir) +SYSTEMTAP_PATH=$(DESTDIR)$(bindir) RUNTESTDEFAULTFLAGS = --tool $$tool --tool_opts \'$(TOOL_OPTS)\' --srcdir $$srcdir EXPECT = expect diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index cc23aed4..9c708bc9 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -134,7 +134,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = dejagnu DEJAZILLA = @dejazilla@ -TOOL_OPTS = $(EXTRA_TOOL_OPTS) +TOOL_OPTS = SRCDIR = $(shell cd $(srcdir); pwd) EXTRA_DIST = execrc config lib systemtap \ parseok parseko semok semko transok transko buildok buildok \ @@ -149,7 +149,7 @@ SYSTEMTAP_RUNTIME = $(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET = $(DESTDIR)$(pkgdatadir)/tapset LD_LIBRARY_PATH = $(DESTDIR)$(libdir)/systemtap CRASH_LIBDIR = $(DESTDIR)$(libdir)/systemtap -SYSTEMTAP_PATH = $(EXTRA_SYSTEMTAP_PATH):$(DESTDIR)$(bindir) +SYSTEMTAP_PATH = $(DESTDIR)$(bindir) RUNTESTDEFAULTFLAGS = --tool $$tool --tool_opts \'$(TOOL_OPTS)\' --srcdir $$srcdir EXPECT = expect RUNTEST = "env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH $(srcdir)/execrc runtest" diff --git a/testsuite/lib/stap_compile.exp b/testsuite/lib/stap_compile.exp index 35124a44..a206b7b1 100644 --- a/testsuite/lib/stap_compile.exp +++ b/testsuite/lib/stap_compile.exp @@ -12,6 +12,7 @@ proc stap_compile { TEST_NAME compile script args } { expect { -re {^Pass\ [1234]:[^\r]*\ in\ .*\ ms.\r\n} {exp_continue} -re {^Pass\ [34]: using cached [^\r\n]+\r\n} {exp_continue} + -re "^WARNING" {exp_continue} # pass-4 output -re {^/[^\r\n]+.ko\r\n} {exp_continue} -re "parse error" { incr compile_errors 1; exp_continue} diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp index db5c1587..8b533303 100644 --- a/testsuite/lib/systemtap.exp +++ b/testsuite/lib/systemtap.exp @@ -37,7 +37,7 @@ proc print_systemtap_version {} { proc setup_systemtap_environment {} { - global srcdir prefix env + global srcdir prefix env server_pid # need an absolute SRCDIR for the top-level src/ tree # XXX: or, we could change nearby uses of ${SRCDIR}/testsuite to ${SRCDIR} @@ -51,6 +51,41 @@ proc setup_systemtap_environment {} { # make check and sudo make check don't clobber each other. set env(SYSTEMTAP_DIR) [exec pwd]/.systemtap-[exec whoami] + # Find or start a systemtap server, if requested. + if {[use_server_p]} then { + print "Testing using a systemtap server" + + # Server management scripts are installed if this is an install test, otherwise + # in the source directory. Make sure they are on the $PATH. + if {! [installtest_p]} then { + set env(PATH) "$srcdir/..:$env(PATH)" + } + + # Try to find or start the server. + set server_pid [exec stap-find-or-start-server] + if { $server_pid == -1 } then { + print "Cannot find or start a systemtap server" + set server_pid 0 + # TODO: How do we abort here? + } elseif { $server_pid == 0 } then { + print "A compatible systemtap server is already available" + } else { + print "Started a systemtap server as PID==$server_pid" + } + + # Make a copy of 'stap-client' as 'stap' and make sure it's at the + # beginning of the $PATH. Do this after starting the server so that + # The server does not call this instance of 'stap' + set client_path [exec pwd]/net + exec /bin/mkdir -p $client_path + if {[installtest_p]} then { + exec /bin/cp -p [exec which stap-client] $client_path/stap + } else { + exec /bin/cp -p $srcdir/../stap-client $client_path/stap + } + set env(PATH) "$client_path:$env(PATH)" + } + # PATH, SYSTEMTAP_TAPSET, SYSTEMTAP_RUNTIME, LD_LIBRARY_PATH are already set. foreach var {PATH STAP SRCDIR SYSTEMTAP_TAPSET SYSTEMTAP_RUNTIME SYSTEMTAP_DIR LD_LIBRARY_PATH} { if [info exists env($var)] { @@ -84,7 +119,18 @@ get_system_info proc systemtap_init {args} {} proc systemtap_version {} {} -proc systemtap_exit {} {} + +proc systemtap_exit {} { + global server_pid + + # Stop the stap server, if we started it. + if {[use_server_p]} then { + if { $server_pid != 0 } then { + print "Stopping the systemtap server with PID==$server_pid" + exec stap-stop-server $server_pid + } + } +} proc stap_run_batch {args} { diff --git a/testsuite/semko/fortyseven.stp b/testsuite/semko/fortyseven.stp new file mode 100755 index 00000000..5b8cba38 --- /dev/null +++ b/testsuite/semko/fortyseven.stp @@ -0,0 +1,5 @@ +#! stap -p2 + +# PR5049 + +probe kernel.function("*@ket.c") {} # must not match "....packet.c" diff --git a/testsuite/systemtap.base/cache.exp b/testsuite/systemtap.base/cache.exp index f7ed2786..390af054 100644 --- a/testsuite/systemtap.base/cache.exp +++ b/testsuite/systemtap.base/cache.exp @@ -30,6 +30,7 @@ proc stap_compile { TEST_NAME flags script args } { -timeout 180 -re {^Pass\ [1234]:[^\r]*\ in\ [^\r]*\ ms\.\r\n} {exp_continue} -re {^Pass\ [34]: using cached [^\r\n]+\r\n} {incr cached 1; exp_continue} + -re "^WARNING" {exp_continue} # pass-4 output -re {^/[^\r\n]+\.ko\r\n} {exp_continue} -re "compilation failed" {incr compile_errors 1; exp_continue} diff --git a/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index 4b73ac1c..f19af977 100644 --- a/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -1,5 +1,9 @@ # itrace test +# temporarily disabled +return + + # Initialize variables set utrace_support_found 0 set exepath "[pwd]/ls_[pid]" @@ -81,7 +85,7 @@ set TEST_NAME "itrace1" if {$utrace_support_found == 0} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { - untested "$TEST_NAME : not installtest_p" + untested $TEST_NAME } else { set script [format $itrace1_script $exepath] stap_run $TEST_NAME run_ls_5_sec $itrace1_script_output -e $script @@ -92,7 +96,7 @@ set TEST_NAME "itrace2" if {$utrace_support_found == 0} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { - untested "$TEST_NAME : not installtest_p" + untested $TEST_NAME } else { set script [format $itrace2_script $exepath] stap_run $TEST_NAME run_ls_5_sec $itrace2_script_output -e $script diff --git a/testsuite/systemtap.base/stmt_rel.stp b/testsuite/systemtap.base/stmt_rel.stp index 13066161..cfe77317 100644 --- a/testsuite/systemtap.base/stmt_rel.stp +++ b/testsuite/systemtap.base/stmt_rel.stp @@ -55,11 +55,11 @@ probe kernel.statement("bio_put@fs/bio.c:*") { # printf ("FAIL address %s %s\n", stack2, stack3) # } - # Did wildcard probe hit at least 5 different statements? + # Did wildcard probe hit at least 4 different statements? foreach ([i] in wildcardpp) { statement_count += 1 } - if (statement_count >= 5) { + if (statement_count >= 4) { printf ("PASS wildcard\n") } else diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp index 333cff21..3083b97f 100644 --- a/testsuite/systemtap.base/utrace_p4.exp +++ b/testsuite/systemtap.base/utrace_p4.exp @@ -6,47 +6,6 @@ # If utrace exists in the kernel, it tries some compile tests. If # utrace doesn't exist in the kernel, marks the tests as 'untested'. -# stap_compile TEST_NAME flags script args -# - TEST_NAME is the name of the current test -# - compile indicates whether the script is supposed to compile -# - script is the script to compile -# Additional arguments are passed to stap as-is. -proc stap_compile { TEST_NAME compile script args } { - set cmd [concat {stap -v -p4 -e} $script $args] - - verbose -log "running $cmd" - eval spawn $cmd - set compile_errors 0 - expect { - -re {^Pass\ [1234]:[^\r]*\ in\ .*\ ms.\r\n} {exp_continue} - -re {^Pass\ [34]: using cached [^\r\n]+\r\n} {exp_continue} - # pass-4 output - -re {^/[^\r\n]+.ko\r\n} {exp_continue} - -re "parse error" { incr compile_errors 1; exp_continue} - -re "compilation failed" {incr compile_errors 1; exp_continue} - -re "semantic error:" {incr compile_errors 1; exp_continue} - -re "terminate called" {incr compile_errors 1; exp_continue} - } - catch close - wait - - # If we've got compile errors and the script was supposed to - # compile, fail. - if {$compile_errors > 0} { - if {$compile == 1} { - fail "$TEST_NAME compilation failed" - } else { - pass "$TEST_NAME compilation failed correctly" - } - } else { - if {$compile == 1} { - pass "$TEST_NAME compilation succeeded" - } else { - fail "$TEST_NAME compilation succeeded unexpectedly" - } - } -} - # Initialize variables set utrace_support_found 0 diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog index 7cb39fb9..682e44e5 100644 --- a/testsuite/systemtap.examples/ChangeLog +++ b/testsuite/systemtap.examples/ChangeLog @@ -1,3 +1,78 @@ +2008-08-11 Mark Wielaard <mwielaard@redhat.com> + + * check.exp: Make sure that stderr gets redircted so warnings don't + make example script run fail. + +2008-08-11 Mark Wielaard <mwielaard@redhat.com> + + PR6835. Reported by Eugeniy Meshcheryakov <eugen@debian.org> + * io/io_submit.stp: Fix #! start. Convert to normal line-ending. + +2008-08-11 Mark Wielaard <mwielaard@redhat.com> + + PR2895. Reported by Eugeniy Meshcheryakov <eugen@debian.org> + * general/graphs.stp: Add proper #! /usr/bin/env stap line. + * general/para-callgraph.stp: Likewise. + * io/io_submit.stp: Likewise. + * io/iotop.stp: Likewise. + * io/traceio.stp: Likewise. + * process/proc_snoop.stp: Likewise. + * process/sigkill.stp: Likewise. + * iotask.stp: Likewise. + * pfaults.stp: Likewise. + * profile.stp: Likewise. + +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/check.exp b/testsuite/systemtap.examples/check.exp index 14d9a57e..482738cc 100644 --- a/testsuite/systemtap.examples/check.exp +++ b/testsuite/systemtap.examples/check.exp @@ -36,7 +36,10 @@ proc run_command { test command } { #FIXME tcl says that single quotes not dealt with if { $command != "" } then { verbose -log "attempting command $command" - set res [catch {eval exec $command} value] + # Pipe both stdout and stderr to cat, otherwise any stderr + # output results in res being set to 1 (TCL_ERROR). This breaks + # scripts that have WARNINGS about for example skipped probes. + set res [catch {eval exec "$command |& cat"} value] verbose -log "OUT $value" verbose -log "RC $res" if {$res != 0 } { 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..f55d6cee 100644..100755 --- a/testsuite/systemtap.examples/graphs.stp +++ b/testsuite/systemtap.examples/general/graphs.stp @@ -1,4 +1,4 @@ -#! stap +#! /usr/bin/stap # ------------------------------------------------------------------------ # data collection 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..e28f5d6b 100644..100755 --- a/testsuite/systemtap.examples/para-callgraph.stp +++ b/testsuite/systemtap.examples/general/para-callgraph.stp @@ -1,3 +1,5 @@ +#! /usr/bin/env stap + function trace(entry_p) { if(tid() in trace) printf("%s%s%s\n",thread_indent(entry_p), 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..100755 --- 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..13dcc5a3 100644..100755 --- a/testsuite/systemtap.examples/io_submit.stp +++ b/testsuite/systemtap.examples/io/io_submit.stp @@ -1,71 +1,71 @@ -#!/bin/env stap
-#
-# Copyright (C) 2007 Oracle Corp. Chris Mason <chris.mason@oracle.com>
-#
-# This was implemented to find the most common causes of schedule during
-# the AIO io_submit call. It does this by recording which pids are inside
-# AIO, and recording the current stack trace if one of those pids is
-# inside schedule.
-# When the probe exits, it prints out the 30 most common call stacks for
-# schedule().
-#
-# This file 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.
-
-global in_iosubmit
-global traces
-
-/*
- * add a probe to sys_io_submit, on entry, record in the in_iosubmit
- * hash table that this proc is in io_submit
- */
-probe syscall.io_submit {
- in_iosubmit[tid()] = 1
-}
-
-/*
- * when we return from sys_io_submit, record that we're no longer there
- */
-probe syscall.io_submit.return {
- /* this assumes a given proc will do lots of io_submit calls, and
- * so doesn't do the more expensive "delete in_iosubmit[p]". If
- * there are lots of procs doing small number of io_submit calls,
- * the hash may grow pretty big, so using delete may be better
- */
- in_iosubmit[tid()] = 0
-}
-
-/*
- * every time we call schedule, check to see if we started off in
- * io_submit. If so, record our backtrace into the traces histogram
- */
-probe kernel.function("schedule") {
- if (tid() in in_iosubmit) {
- traces[backtrace()]++
-
- /*
- * change this to if (1) if you want a backtrace every time
- * you go into schedule from io_submit. Unfortunately, the traces
- * saved into the traces histogram above are truncated to just a
- * few lines. so the only way to see the full trace is via the
- * more verbose print_backtrace() right here.
- */
- if (0) {
- printf("schedule in io_submit!\n")
- print_backtrace()
- }
- }
-}
-
-/*
- * when stap is done (via ctrl-c) go through the record of all the
- * trace paths and print the 30 most common.
- */
-probe end {
- foreach (stack in traces- limit 30) {
- printf("%d:", traces[stack])
- print_stack(stack);
- }
-}
-
+#! /usr/bin/env stap +# +# Copyright (C) 2007 Oracle Corp. Chris Mason <chris.mason@oracle.com> +# +# This was implemented to find the most common causes of schedule during +# the AIO io_submit call. It does this by recording which pids are inside +# AIO, and recording the current stack trace if one of those pids is +# inside schedule. +# When the probe exits, it prints out the 30 most common call stacks for +# schedule(). +# +# This file 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. + +global in_iosubmit +global traces + +/* + * add a probe to sys_io_submit, on entry, record in the in_iosubmit + * hash table that this proc is in io_submit + */ +probe syscall.io_submit { + in_iosubmit[tid()] = 1 +} + +/* + * when we return from sys_io_submit, record that we're no longer there + */ +probe syscall.io_submit.return { + /* this assumes a given proc will do lots of io_submit calls, and + * so doesn't do the more expensive "delete in_iosubmit[p]". If + * there are lots of procs doing small number of io_submit calls, + * the hash may grow pretty big, so using delete may be better + */ + in_iosubmit[tid()] = 0 +} + +/* + * every time we call schedule, check to see if we started off in + * io_submit. If so, record our backtrace into the traces histogram + */ +probe kernel.function("schedule") { + if (tid() in in_iosubmit) { + traces[backtrace()]++ + + /* + * change this to if (1) if you want a backtrace every time + * you go into schedule from io_submit. Unfortunately, the traces + * saved into the traces histogram above are truncated to just a + * few lines. so the only way to see the full trace is via the + * more verbose print_backtrace() right here. + */ + if (0) { + printf("schedule in io_submit!\n") + print_backtrace() + } + } +} + +/* + * when stap is done (via ctrl-c) go through the record of all the + * trace paths and print the 30 most common. + */ +probe end { + foreach (stack in traces- limit 30) { + printf("%d:", traces[stack]) + print_stack(stack); + } +} + 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..2fa3e3ae 100644..100755 --- a/testsuite/systemtap.examples/iotop.stp +++ b/testsuite/systemtap.examples/io/iotop.stp @@ -1,3 +1,5 @@ +#! /usr/bin/env stap + global reads, writes, total_io probe kernel.function("vfs_read") { 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..cb667be5 100644..100755 --- a/testsuite/systemtap.examples/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -1,4 +1,4 @@ -#!/usr/bin/env stap +#! /usr/bin/env stap # traceio.stp # Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com> # 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..100755 --- 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..5203c93f 100755 --- a/testsuite/systemtap.examples/small_demos/proc_snoop.stp +++ b/testsuite/systemtap.examples/process/proc_snoop.stp @@ -1,4 +1,4 @@ -#!/usr/bin/env stap +#! /usr/bin/env stap global start_ts 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..6cb6ed1e 100644..100755 --- a/testsuite/systemtap.examples/sigkill.stp +++ b/testsuite/systemtap.examples/process/sigkill.stp @@ -1,4 +1,4 @@ -#!/usr/bin/env stap +#! /usr/bin/env stap # sigkill.stp # Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com> # 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..100755 --- 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..100755 --- 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..100755 --- 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". + + diff --git a/testsuite/systemtap.samples/iotask.stp b/testsuite/systemtap.samples/iotask.stp index ee0ae4b4..1b4c7243 100644 --- a/testsuite/systemtap.samples/iotask.stp +++ b/testsuite/systemtap.samples/iotask.stp @@ -1,3 +1,4 @@ +#! /usr/bin/env stap # iotask.stp # A reimplementation of user script: iotask.stp given at OLS 2005 # in the current language. diff --git a/testsuite/systemtap.samples/pfaults.stp b/testsuite/systemtap.samples/pfaults.stp index 525aa511..577e93cd 100644 --- a/testsuite/systemtap.samples/pfaults.stp +++ b/testsuite/systemtap.samples/pfaults.stp @@ -1,4 +1,4 @@ -#! stap +#! /usr/bin/env stap global pidnames, faults, fault_types diff --git a/testsuite/systemtap.samples/profile.stp b/testsuite/systemtap.samples/profile.stp index d052f091..62af76ae 100644 --- a/testsuite/systemtap.samples/profile.stp +++ b/testsuite/systemtap.samples/profile.stp @@ -1,4 +1,4 @@ -#! stap +#! /usr/bin/env stap global command, syscall_count, syscall_times, this_syscall_time, this_syscall |