diff options
author | Dave Brolley <brolley@redhat.com> | 2009-11-23 19:08:51 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-11-23 19:08:51 -0500 |
commit | 5d1c958ce2dcc0f28c1bd13b8e005c0c2ad1cdba (patch) | |
tree | e44ad8807e0b5b2e1bb85682f677d492f1195dbf | |
parent | 562d60b004e3d7ae73c1c7508be529006bd6430f (diff) | |
parent | 90bba7158de040705a101ba1fdf6062866b4b4e9 (diff) | |
download | systemtap-steved-5d1c958ce2dcc0f28c1bd13b8e005c0c2ad1cdba.tar.gz systemtap-steved-5d1c958ce2dcc0f28c1bd13b8e005c0c2ad1cdba.tar.xz systemtap-steved-5d1c958ce2dcc0f28c1bd13b8e005c0c2ad1cdba.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Conflicts:
configure
73 files changed, 1316 insertions, 399 deletions
@@ -37,3 +37,4 @@ build-elfutils include-elfutils lib-elfutils stamp-elfutils +dtrace diff --git a/Makefile.am b/Makefile.am index dce9850d..7d084324 100644 --- a/Makefile.am +++ b/Makefile.am @@ -151,9 +151,9 @@ staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\ runtime/staprun/ctl.c runtime/staprun/common.c staprun_CPPFLAGS = $(AM_CPPFLAGS) -staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) @PIECFLAGS@ -DSINGLE_THREADED -fno-strict-aliasing -fno-builtin-strftime +staprun_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -DSINGLE_THREADED -fno-strict-aliasing -fno-builtin-strftime staprun_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ -staprun_LDADD = @PROCFLAGS@ +staprun_LDADD = if HAVE_NSS staprun_SOURCES += runtime/staprun/modverify.c nsscommon.c @@ -165,9 +165,9 @@ stapio_SOURCES = runtime/staprun/stapio.c \ runtime/staprun/mainloop.c runtime/staprun/common.c \ runtime/staprun/ctl.c \ runtime/staprun/relay.c runtime/staprun/relay_old.c -stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) @PIECFLAGS@ -fno-strict-aliasing -fno-builtin-strftime +stapio_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -fno-strict-aliasing -fno-builtin-strftime stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ -stapio_LDADD = @PROCFLAGS@ -lpthread +stapio_LDADD = -lpthread install-exec-hook: diff --git a/Makefile.in b/Makefile.in index 4cd5c10d..5b0fbaf1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -280,7 +280,6 @@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ PKG_CONFIG = @PKG_CONFIG@ -PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ RPM_CFLAGS = @RPM_CFLAGS@ RPM_LIBS = @RPM_LIBS@ @@ -403,19 +402,18 @@ staprun_SOURCES = runtime/staprun/staprun.c \ runtime/staprun/staprun_funcs.c runtime/staprun/ctl.c \ runtime/staprun/common.c $(am__append_16) staprun_CPPFLAGS = $(AM_CPPFLAGS) -staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) @PIECFLAGS@ \ - -DSINGLE_THREADED -fno-strict-aliasing -fno-builtin-strftime \ - $(am__append_17) +staprun_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -DSINGLE_THREADED \ + -fno-strict-aliasing -fno-builtin-strftime $(am__append_17) staprun_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ -staprun_LDADD = @PROCFLAGS@ $(am__append_18) +staprun_LDADD = $(am__append_18) stapio_SOURCES = runtime/staprun/stapio.c \ runtime/staprun/mainloop.c runtime/staprun/common.c \ runtime/staprun/ctl.c \ runtime/staprun/relay.c runtime/staprun/relay_old.c -stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) @PIECFLAGS@ -fno-strict-aliasing -fno-builtin-strftime +stapio_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -fno-strict-aliasing -fno-builtin-strftime stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ -stapio_LDADD = @PROCFLAGS@ -lpthread +stapio_LDADD = -lpthread @BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_sign_module_SOURCES = modsign.cxx nsscommon.c @BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_sign_module_CPPFLAGS = -Wall -Werror $(AM_CPPFLAGS) $(nss_CFLAGS) $(nspr_CFLAGS) @BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_sign_module_LDADD = -lnss3 -lnspr4 @@ -751,7 +751,6 @@ BUILD_ELFUTILS_FALSE elfutils_abs_srcdir stap_LIBS DATE -PROCFLAGS subdirs LIBOBJS LTLIBOBJS' @@ -8439,19 +8438,9 @@ _ACEOF DATE="$date" - -# This procflags business is for staprun/stapio, which need to -# be compiled with the same bitness as the kernel. On e.g. PPC, -# userspace might be 32-bit default, but staprun needs to be -# 64-bit. See also bug #4037. - -processor=`uname -p` -case "$processor" in -ppc64) PROCFLAGS=-m64 ;; -x86_64) PROCFLAGS=-m64 ;; -*) PROCFLAGS="" -esac - +# Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun +# being compiled on 32-bit userspace but running against 64-bit kernels. +# This is no longer necessary. # Use tr1/unordered_map if available ac_ext=cpp @@ -10232,13 +10221,12 @@ BUILD_ELFUTILS_FALSE!$BUILD_ELFUTILS_FALSE$ac_delim elfutils_abs_srcdir!$elfutils_abs_srcdir$ac_delim stap_LIBS!$stap_LIBS$ac_delim DATE!$DATE$ac_delim -PROCFLAGS!$PROCFLAGS$ac_delim subdirs!$subdirs$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 44; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 43; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index e92adf5f..cf9379c2 100644 --- a/configure.ac +++ b/configure.ac @@ -578,19 +578,9 @@ date=`date +%Y-%m-%d` AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date]) AC_SUBST(DATE, "$date") - -# This procflags business is for staprun/stapio, which need to -# be compiled with the same bitness as the kernel. On e.g. PPC, -# userspace might be 32-bit default, but staprun needs to be -# 64-bit. See also bug #4037. - -processor=`uname -p` -case "$processor" in -ppc64) PROCFLAGS=-m64 ;; -x86_64) PROCFLAGS=-m64 ;; -*) PROCFLAGS="" -esac -AC_SUBST([PROCFLAGS]) +# Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun +# being compiled on 32-bit userspace but running against 64-bit kernels. +# This is no longer necessary. # Use tr1/unordered_map if available AC_LANG_PUSH(C++) diff --git a/doc/Makefile.in b/doc/Makefile.in index 06312399..8b1d0a51 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -105,7 +105,6 @@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ PKG_CONFIG = @PKG_CONFIG@ -PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ RPM_CFLAGS = @RPM_CFLAGS@ RPM_LIBS = @RPM_LIBS@ diff --git a/doc/SystemTap_Tapset_Reference/Makefile.am b/doc/SystemTap_Tapset_Reference/Makefile.am index 454b3331..109aaa9e 100644 --- a/doc/SystemTap_Tapset_Reference/Makefile.am +++ b/doc/SystemTap_Tapset_Reference/Makefile.am @@ -30,7 +30,7 @@ if BUILD_REFDOCS all: $(PDFDOCS) stamp-htmldocs stamp-mandocs tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp') SRCTREE=$(SRCTREE) $(DOCPROC) doc $(abs_srcdir)/tapsets.tmpl > tapsets.xml.new - if cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ + if test -s tapsets.xml && cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ echo tapsets.xml unchanged; \ rm tapsets.xml.new; \ else \ diff --git a/doc/SystemTap_Tapset_Reference/Makefile.in b/doc/SystemTap_Tapset_Reference/Makefile.in index a606b868..01cf116c 100644 --- a/doc/SystemTap_Tapset_Reference/Makefile.in +++ b/doc/SystemTap_Tapset_Reference/Makefile.in @@ -108,7 +108,6 @@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ PKG_CONFIG = @PKG_CONFIG@ -PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ RPM_CFLAGS = @RPM_CFLAGS@ RPM_LIBS = @RPM_LIBS@ @@ -430,7 +429,7 @@ uninstall-am: @BUILD_REFDOCS_TRUE@all: $(PDFDOCS) stamp-htmldocs stamp-mandocs @BUILD_REFDOCS_TRUE@tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp') @BUILD_REFDOCS_TRUE@ SRCTREE=$(SRCTREE) $(DOCPROC) doc $(abs_srcdir)/tapsets.tmpl > tapsets.xml.new -@BUILD_REFDOCS_TRUE@ if cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ +@BUILD_REFDOCS_TRUE@ if test -s tapsets.xml && cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ @BUILD_REFDOCS_TRUE@ echo tapsets.xml unchanged; \ @BUILD_REFDOCS_TRUE@ rm tapsets.xml.new; \ @BUILD_REFDOCS_TRUE@ else \ diff --git a/doc/SystemTap_Tapset_Reference/tapsets.tmpl b/doc/SystemTap_Tapset_Reference/tapsets.tmpl index c73defef..bb855d29 100644 --- a/doc/SystemTap_Tapset_Reference/tapsets.tmpl +++ b/doc/SystemTap_Tapset_Reference/tapsets.tmpl @@ -135,6 +135,16 @@ !Itapset/timestamp.stp </chapter> + <chapter id="ctime.stp"> + <title>Time string utility function</title> + <para> + Utility function to turn seconds since the epoch (as returned by + the timestamp function gettimeofday_s()) into a human readable + date/time string. + </para> +!Itapset/ctime.stp + </chapter> + <chapter id="memory_stp"> <title>Memory Tapset</title> <para> @@ -157,12 +167,13 @@ </chapter> <chapter id="iosched.stp"> - <title>IO Scheduler Tapset</title> + <title>IO Scheduler and block IO Tapset</title> <para> - This family of probe points is used to probe IO scheduler activities. + This family of probe points is used to probe block IO layer and IO scheduler activities. It contains the following probe points: </para> !Itapset/ioscheduler.stp +!Itapset/ioblock.stp </chapter> <chapter id="scsi.stp"> @@ -251,4 +262,13 @@ </para> !Itapset/conversions.stp </chapter> + <chapter id="ansi.stp"> + <title>Utility functions for using ansi control chars in logs</title> + <para> + Utility functions for logging using ansi control characters. This + lets you manipulate the cursor position and character color output + and attributes of log messages. + </para> +!Itapset/ansi.stp + </chapter> </book> diff --git a/doc/test b/doc/test deleted file mode 100644 index eefc69f7..00000000 --- a/doc/test +++ /dev/null @@ -1 +0,0 @@ -Thu Aug 28 23:10:00 EST 2008 @@ -721,6 +721,37 @@ dwflpp::global_alias_caching_callback(Dwarf_Die *die, void *arg) return DWARF_CB_OK; } +int +dwflpp::global_alias_caching_callback_cus(Dwarf_Die *die, void *arg) +{ + mod_cu_type_cache_t *global_alias_cache; + global_alias_cache = &static_cast<dwflpp *>(arg)->global_alias_cache; + + cu_type_cache_t *v = (*global_alias_cache)[die->addr]; + if (v != 0) + return DWARF_CB_OK; + + v = new cu_type_cache_t; + (*global_alias_cache)[die->addr] = v; + iterate_over_globals(die, global_alias_caching_callback, v); + + return DWARF_CB_OK; +} + +Dwarf_Die * +dwflpp::declaration_resolve_other_cus(const char *name) +{ + iterate_over_cus(global_alias_caching_callback_cus, this); + for (mod_cu_type_cache_t::iterator i = global_alias_cache.begin(); + i != global_alias_cache.end(); ++i) + { + cu_type_cache_t *v = (*i).second; + if (v->find(name) != v->end()) + return & ((*v)[name]); + } + + return NULL; +} Dwarf_Die * dwflpp::declaration_resolve(const char *name) @@ -733,7 +764,7 @@ dwflpp::declaration_resolve(const char *name) { v = new cu_type_cache_t; global_alias_cache[cu->addr] = v; - iterate_over_globals(global_alias_caching_callback, v); + iterate_over_globals(cu, global_alias_caching_callback, v); if (sess.verbose > 4) clog << "global alias cache " << module_name << ":" << cu_name() << " size " << v->size() << endl; @@ -744,11 +775,8 @@ dwflpp::declaration_resolve(const char *name) // forward-declared pointer type only, where the actual definition // may only be in vmlinux or the application. - // XXX: it is probably desirable to search other CU's declarations - // in the same module. - if (v->find(name) == v->end()) - return NULL; + return declaration_resolve_other_cus(name); return & ((*v)[name]); } @@ -839,17 +867,17 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query * /* This basically only goes one level down from the compile unit so it * only picks up top level stuff (i.e. nothing in a lower scope) */ int -dwflpp::iterate_over_globals (int (* callback)(Dwarf_Die *, void *), +dwflpp::iterate_over_globals (Dwarf_Die *cu_die, + int (* callback)(Dwarf_Die *, void *), void * data) { int rc = DWARF_CB_OK; Dwarf_Die die; - assert (module); - assert (cu); - assert (dwarf_tag(cu) == DW_TAG_compile_unit); + assert (cu_die); + assert (dwarf_tag(cu_die) == DW_TAG_compile_unit); - if (dwarf_child(cu, &die) != 0) + if (dwarf_child(cu_die, &die) != 0) return rc; do @@ -1484,8 +1512,8 @@ dwflpp::emit_address (struct obstack *pool, Dwarf_Addr address) { // This gives us the module name, and section name within the // module, for a kernel module (or other ET_REL module object). - obstack_printf (pool, "({ static unsigned long addr = 0; "); - obstack_printf (pool, "if (addr==0) addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ", + obstack_printf (pool, "({ unsigned long addr = 0; "); + obstack_printf (pool, "addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ", modname, secname, reloc_address); obstack_printf (pool, "addr; })"); } @@ -1495,6 +1523,9 @@ dwflpp::emit_address (struct obstack *pool, Dwarf_Addr address) // need to treat the same way here as dwarf_query::add_probe_point does: _stext. address -= sess.sym_stext; secname = "_stext"; + // Note we "cache" the result here through a static because the + // kernel will never move after being loaded (unlike modules and + // user-space dynamic share libraries). obstack_printf (pool, "({ static unsigned long addr = 0; "); obstack_printf (pool, "if (addr==0) addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ", modname, secname, address); // PR10000 NB: not reloc_address @@ -1502,12 +1533,11 @@ dwflpp::emit_address (struct obstack *pool, Dwarf_Addr address) } else { - throw semantic_error ("cannot relocate user-space dso (?) address"); -#if 0 - // This would happen for a Dwfl_Module that's a user-level DSO. - obstack_printf (pool, " /* %s+%#" PRIx64 " */", - modname, address); -#endif + enable_task_finder (sess); + obstack_printf (pool, "({ unsigned long addr = 0; "); + obstack_printf (pool, "addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ", + modname, ".dynamic", reloc_address); + obstack_printf (pool, "addr; })"); } } else @@ -2210,6 +2240,41 @@ dwflpp::express_as_string (string prelude, return result; } +Dwarf_Addr +dwflpp::vardie_from_symtable (Dwarf_Die *vardie, Dwarf_Addr *addr) +{ + const char *name; + Dwarf_Attribute attr_mem; + name = dwarf_formstring (dwarf_attr_integrate (vardie, + DW_AT_MIPS_linkage_name, + &attr_mem)); + if (!name) + name = dwarf_diename (vardie); + + if (sess.verbose > 2) + clog << "finding symtable address for " << name << "\n"; + + *addr = 0; + int syms = dwfl_module_getsymtab (module); + dwfl_assert ("Getting symbols", syms >= 0); + + for (int i = 0; *addr == 0 && i < syms; i++) + { + GElf_Sym sym; + GElf_Word shndxp; + const char *symname = dwfl_module_getsym(module, i, &sym, &shndxp); + if (symname + && ! strcmp (name, symname) + && sym.st_shndx != SHN_UNDEF + && GELF_ST_TYPE (sym.st_info) == STT_OBJECT) + *addr = sym.st_value; + } + + if (sess.verbose > 2) + clog << "found " << name << "@0x" << hex << *addr << "\n"; + + return *addr; +} string dwflpp::literal_stmt_for_local (vector<Dwarf_Die>& scopes, @@ -2231,30 +2296,42 @@ dwflpp::literal_stmt_for_local (vector<Dwarf_Die>& scopes, << ", module bias 0x" << module_bias << dec << "\n"; +#define obstack_chunk_alloc malloc +#define obstack_chunk_free free + + struct obstack pool; + obstack_init (&pool); + struct location *tail = NULL; + + /* Given $foo->bar->baz[NN], translate the location of foo. */ + + struct location *head; + Dwarf_Attribute attr_mem; if (dwarf_attr_integrate (&vardie, DW_AT_const_value, &attr_mem) == NULL && dwarf_attr_integrate (&vardie, DW_AT_location, &attr_mem) == NULL) { - throw semantic_error("failed to retrieve location " + Dwarf_Op addr_loc; + addr_loc.atom = DW_OP_addr; + // If it is an external variable try the symbol table. PR10622. + if (dwarf_attr_integrate (&vardie, DW_AT_external, &attr_mem) != NULL + && vardie_from_symtable (&vardie, &addr_loc.number) != 0) + { + head = c_translate_location (&pool, &loc2c_error, this, + &loc2c_emit_address, + 1, 0, pc, + NULL, &addr_loc, 1, &tail, NULL, NULL); + } + else + throw semantic_error("failed to retrieve location " "attribute for local '" + local + "' (dieoffset: " + lex_cast_hex(dwarf_dieoffset (&vardie)) + ")", e->tok); } - -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free - - struct obstack pool; - obstack_init (&pool); - struct location *tail = NULL; - - /* Given $foo->bar->baz[NN], translate the location of foo. */ - - struct location *head = translate_location (&pool, - &attr_mem, pc, fb_attr, &tail, - e); + else + head = translate_location (&pool, &attr_mem, pc, fb_attr, &tail, e); if (dwarf_attr_integrate (&vardie, DW_AT_type, &attr_mem) == NULL) throw semantic_error("failed to retrieve type " @@ -213,6 +213,7 @@ struct dwflpp std::vector<Dwarf_Die> getscopes(Dwarf_Addr pc); Dwarf_Die *declaration_resolve(const char *name); + Dwarf_Die *declaration_resolve_other_cus(const char *name); mod_cu_function_cache_t cu_function_cache; @@ -319,8 +320,10 @@ private: */ mod_cu_type_cache_t global_alias_cache; static int global_alias_caching_callback(Dwarf_Die *die, void *arg); - int iterate_over_globals (int (* callback)(Dwarf_Die *, void *), - void * data); + static int global_alias_caching_callback_cus(Dwarf_Die *die, void *arg); + static int iterate_over_globals (Dwarf_Die *, + int (* callback)(Dwarf_Die *, void *), + void * data); static int cu_function_caching_callback (Dwarf_Die* func, void *arg); @@ -394,6 +397,7 @@ private: // Returns the call frame address operations for the given program counter. Dwarf_Op *get_cfa_ops (Dwarf_Addr pc); + Dwarf_Addr vardie_from_symtable(Dwarf_Die *vardie, Dwarf_Addr *addr); }; #endif // DWFLPP_H diff --git a/grapher/Makefile.in b/grapher/Makefile.in index aa0f3869..8b4d3b1d 100644 --- a/grapher/Makefile.in +++ b/grapher/Makefile.in @@ -134,7 +134,6 @@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ PKG_CONFIG = @PKG_CONFIG@ -PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ RPM_CFLAGS = @RPM_CFLAGS@ RPM_LIBS = @RPM_LIBS@ diff --git a/initscript/.gitignore b/initscript/.gitignore index ec0530ab..37416cbb 100644 --- a/initscript/.gitignore +++ b/initscript/.gitignore @@ -1 +1,2 @@ systemtap +stap-server @@ -676,11 +676,19 @@ main (int argc, char * const argv []) break; case 'd': - s.unwindsym_modules.insert (string (optarg)); - // PR10228: trigger task-finder logic early if -d /USER-MODULE/ given. - if (optarg[0] == '/') - enable_task_finder (s); - break; + { + // At runtime user module names are resolved through their + // canonical (absolute) path. + const char *mpath = canonicalize_file_name (optarg); + if (mpath == NULL) // Must be a kernel module name + mpath = optarg; + s.unwindsym_modules.insert (string (mpath)); + // PR10228: trigger task-finder logic early if -d /USER-MODULE/ + // given. + if (mpath[0] == '/') + enable_task_finder (s); + break; + } case 'e': if (have_script) diff --git a/runtime/map.c b/runtime/map.c index 74467f30..20d8a48c 100644 --- a/runtime/map.c +++ b/runtime/map.c @@ -412,7 +412,7 @@ static void _stp_pmap_del(PMAP pmap) } /* sort keynum values */ -#define SORT_COUNT -5 +#define SORT_COUNT -5 /* see also translate.cxx:visit_foreach_loop */ #define SORT_SUM -4 #define SORT_MIN -3 #define SORT_MAX -2 diff --git a/runtime/sym.c b/runtime/sym.c index 0baa1a5e..fd9863dd 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -45,6 +45,22 @@ static int _stp_tf_mmap_cb(struct stap_task_finder_target *tgt, path); #endif module = _stp_modules[i]; + // cheat... + // We are abusing the "first" section address + // here to indicate where the module (actually + // first segment) is loaded (which is why we + // are ignoring the offset). It would be good + // to redesign the stp_module/stp_section + // data structures to better align with the + // actual memory mappings we are interested + // in (especially the "section" naming is + // slightly confusing since what we really + // seem to mean are elf segments (which can + // contain multiple elf sections). + if ((strcmp(".dynamic", + module->sections[0].name) == 0) + && module->sections[0].addr == 0) + module->sections[0].addr = addr; break; } } @@ -138,8 +154,6 @@ static struct _stp_module *_stp_mod_sec_lookup(unsigned long addr, *sec = &m->sections[0]; // XXX check actual section and relocate dbug_sym(1, "found section %s in module %s at 0x%lx\n", m->sections[0].name, m->name, vm_start); - if (strcmp(".dynamic", m->sections[0].name) == 0) - m->sections[0].addr = vm_start; // cheat... return m; } } diff --git a/runtime/sym.h b/runtime/sym.h index ca69345f..9f2bdfd0 100644 --- a/runtime/sym.h +++ b/runtime/sym.h @@ -66,6 +66,10 @@ static unsigned _stp_num_modules; /* load address, fixup by transport symbols _stp_do_relocation */ static unsigned long _stp_kretprobe_trampoline; +/* Indicates some modules requested the task finder to notify sym.c + _stp_sym_init () should track vma maps. */ +static char _stp_need_vma_tracker; + static unsigned long _stp_module_relocate (const char *module, const char *section, unsigned long offset); static struct _stp_module *_stp_get_unwind_info (unsigned long addr); diff --git a/systemtap.spec b/systemtap.spec index a306c88a..508f03ba 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -241,7 +241,7 @@ cd .. %endif -%configure %{?elfutils_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{grapher_config} %{rpm_config} +%configure %{?elfutils_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{grapher_config} %{rpm_config} --disable-silent-rules make %{?_smp_mflags} %install diff --git a/tapset/ansi.stp b/tapset/ansi.stp index 0152fb37..ea5376ae 100644 --- a/tapset/ansi.stp +++ b/tapset/ansi.stp @@ -9,62 +9,126 @@ # Reference: http://en.wikipedia.org/wiki/ANSI_escape_code # +/** + * sfunction ansi_clear_screen - Move cursor to top left and clear screen. + * + * Description: Sends ansi code for moving cursor to top left and then the + * ansi code for clearing the screen from the cursor position to the end. + **/ function ansi_clear_screen() { print("\033[1;1H\033[J") } -# Foreground colors | Background colors -# Black 30 | Black 40 -# Blue 34 | Red 41 -# Green 32 | Green 42 -# Cyan 36 | Yellow 43 -# Red 31 | Blue 44 -# Purple 35 | Magenta 45 -# Brown 33 | Cyan 46 -# Light Gray 37 | White 47 +/** + * sfunction ansi_set_color - Set the ansi Select Graphic Rendition mode. + * @fg: Foreground color to set. + * + * Description: Sends ansi code for Select Graphic Rendition mode for the + * given forground color. Black (30), Blue (34), Green (32), Cyan (36), + * Red (31), Purple (35), Brown (33), Light Gray (37). + */ function ansi_set_color(fg:long) { printf("\033[%dm", fg) } +/** + * sfunction ansi_set_color2 - Set the ansi Select Graphic Rendition mode. + * @fg: Foreground color to set. + * @bg: Background color to set. + * + * Description: Sends ansi code for Select Graphic Rendition mode for the + * given forground color, Black (30), Blue (34), Green (32), Cyan (36), + * Red (31), Purple (35), Brown (33), Light Gray (37) and the given + * background color, Black (40), Red (41), Green (42), Yellow (43), + * Blue (44), Magenta (45), Cyan (46), White (47). + */ function ansi_set_color2(fg:long, bg:long) { printf("\033[%d;%dm", bg, fg) } -# All attributes off 0 -# Intensity: Bold 1 -# Underline: Single 4 -# Blink: Slow 5 -# Blink: Rapid 6 -# Image: Negative 7 +/** + * sfunction ansi_set_color3 - Set the ansi Select Graphic Rendition mode. + * @fg: Foreground color to set. + * @bg: Background color to set. + * @attr: Color attribute to set. + * + * Description: Sends ansi code for Select Graphic Rendition mode for the + * given forground color, Black (30), Blue (34), Green (32), Cyan (36), + * Red (31), Purple (35), Brown (33), Light Gray (37), the given + * background color, Black (40), Red (41), Green (42), Yellow (43), + * Blue (44), Magenta (45), Cyan (46), White (47) and the color attribute + * All attributes off (0), Intensity Bold (1), Underline Single (4), + * Blink Slow (5), Blink Rapid (6), Image Negative (7). + */ function ansi_set_color3(fg:long, bg:long, attr:long) { attr_str = attr ? sprintf(";%dm", attr) : "m" printf("\033[%d;%d%s", bg, fg, attr_str) } +/** + * sfunction ansi_reset_color - Resets Select Graphic Rendition mode. + * + * Description: Sends ansi code to reset foreground, background and color + * attribute to default values. + */ function ansi_reset_color() { ansi_set_color3(0, 0, 0) } +/** + * sfunction ansi_new_line - Move cursor to new line. + * + * Description: Sends ansi code new line. + */ function ansi_new_line() { printf("\12") } +/** + * sfunction ansi_cursor_move - Move cursor to new coordinates. + * @x: Row to move the cursor to. + * @y: Colomn to move the cursor to. + * + * Description: Sends ansi code for positioning the cursor at row x + * and column y. Coordinates start at one, (1,1) is the top-left corner. + */ function ansi_cursor_move(x:long, y:long) { printf("\033[%d;%dH", y, x) } +/** + * sfunction ansi_cursor_hide - Hides the cursor. + * + * Description: Sends ansi code for hiding the cursor. + */ function ansi_cursor_hide() { print("\033[>5I") } +/** + * sfunction ansi_cursor_saves - Saves the cursor position. + * + * Description: Sends ansi code for saving the current cursor position. + */ function ansi_cursor_save() { print("\033[s") } +/** + * sfunction ansi_cursor_saves - Restores a previously saved cursor position. + * + * Description: Sends ansi code for restoring the current cursor position + * previously saved with ansi_cursor_save(). + */ function ansi_cursor_restore() { print("\033[u") } +/** + * sfunction ansi_cursor_show - Shows the cursor. + * + * Description: Sends ansi code for showing the cursor. + */ function ansi_cursor_show() { print("\033[>5h") } diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 2f19ab16..6e45e8e1 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -1891,3 +1891,49 @@ function _struct_sigaction32_u:string(uaddr:long) } #endif %} + +/* + * Function irqflags_str : + * Returns the symbolic string representation of the IRQ flags. + * + */ + +%{ +#include <linux/interrupt.h> +#ifndef IRQF_ONESHOT +#define IRQF_ONESHOT 0x00002000 +#endif +static const _stp_val_array const _stp_irq_list[] = { +#ifdef IRQF_DISABLED + V(IRQF_DISABLED), +#endif +#ifdef IRQF_SAMPLE_RANDOM + V(IRQF_SAMPLE_RANDOM), +#endif +#ifdef IRQF_SHARED + V(IRQF_SHARED), +#endif +#ifdef IRQF_PROBE_SHARED + V(IRQF_PROBE_SHARED), +#endif +#ifdef IRQF_TIMER + V(IRQF_TIMER), +#endif +#ifdef IRQF_PERCPU + V(IRQF_PERCPU), +#endif +#ifdef IRQF_NOBALANCING + V(IRQF_NOBALANCING), +#endif +#ifdef IRQF_IRQPOLL + V(IRQF_IRQPOLL), +#endif + V(IRQF_ONESHOT), + {0, NULL} +}; +%} + +function irqflags_str:string(f:long) +%{ /* pure */ + _stp_lookup_or_str(_stp_irq_list, THIS->f, THIS->__retvalue, MAXSTRINGLEN); +%} diff --git a/tapset/context.stp b/tapset/context.stp index 14128589..36701e6e 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -210,7 +210,12 @@ function user_mode:long () %{ /* pure */ /* unprivileged */ } %} - +/** + * sfunction is_return - Whether the current probe context is a return probe. + * + * Description: Returns 1 if the current probe context is a return probe, + * returns 0 otherwise. + */ function is_return:long () %{ /* pure */ if (CONTEXT->pi) THIS->__retvalue = 1; @@ -225,24 +230,22 @@ function target:long () %{ /* pure */ /* unprivileged */ THIS->__retvalue = _stp_target; %} -///<formalpara id="module_name"> -/// <title>module_name:string()</title> -/// <indexterm><primary>module_name</primary></indexterm> -/// <para> -/// <remark>FIXME: need description.</remark> -/// </para> -///</formalpara> +/** + * sfunction module_name - The module name of the current script. + * + * Returns the name of the stap module. Either generated randomly + * (stap_[0-9a-f]+_[0-9a-f]+) or set by stap -m <module_name>. + */ function module_name:string () %{ /* pure */ /* unprivileged */ strlcpy(THIS->__retvalue, THIS_MODULE->name, MAXSTRINGLEN); %} -///<formalpara id="stp_pid"> -/// <title>stp_pid:long()</title> -/// <indexterm><primary>stp_pid</primary></indexterm> -/// <para> -/// <remark>FIXME: need description.</remark> -/// </para> -///</formalpara> +/** + * sfunction stp_pid - The process id of the stapio process. + * + * Returns the process id of the stapio process that launched + * this script. + */ function stp_pid:long () %{ /* pure */ THIS->__retvalue = _stp_pid; %} diff --git a/tapset/ctime.stp b/tapset/ctime.stp index d907c2db..3ecd6ddf 100644 --- a/tapset/ctime.stp +++ b/tapset/ctime.stp @@ -1,7 +1,18 @@ -/* - * ctime() +/* ctime.stp - Convert seconds to human readable date string. * - * Takes an argument of seconds since the epoch as returned by + * This code was adapted from the newlib mktm_r() and asctime_r() + * functions. In newlib, mktm_r.c states that it was adapted from + * tzcode maintained by Arthur David Olson. In newlib, asctime_r.c + * doesn't have any author/copyright information. + * + * Changes copyright (C) 2006, 2008 Red Hat Inc. + */ + +/** + * sfunction ctime - Convert seconds since epoch into human readable date/time string. + * @epochsecs: Number of seconds since epoch (as returned by gettimeofday_s()). + * + * Description: Takes an argument of seconds since the epoch as returned by * gettimeofday_s(). Returns a string of the form * * "Wed Jun 30 21:49:08 1993" @@ -19,7 +30,7 @@ * * The earliest full date given by ctime, corresponding to epochsecs * -2147483648 is "Fri Dec 13 20:45:52 1901". The latest full date - * given by ctime, corresponding to epachsecs 2147483647 is + * given by ctime, corresponding to epochsecs 2147483647 is * "Tue Jan 19 03:14:07 2038". * * The abbreviations for the days of the week are ‘Sun’, ‘Mon’, ‘Tue’, @@ -31,15 +42,7 @@ * character at the end of the string that this function does not. * Also note that since the kernel has no concept of timezones, the * returned time is always in GMT. - * - * This code was adapted from the newlib mktm_r() and asctime_r() - * functions. In newlib, mktm_r.c states that it was adapted from - * tzcode maintained by Arthur David Olson. In newlib, asctime_r.c - * doesn't have any author/copyright information. - * - * Changes copyright (C) 2006, 2008 Red Hat Inc. */ - function ctime:string(epochsecs:long) %{ /* pure */ diff --git a/tapset/ioblock.stp b/tapset/ioblock.stp index bc64c425..761e7df7 100644 --- a/tapset/ioblock.stp +++ b/tapset/ioblock.stp @@ -78,18 +78,13 @@ function __bio_devname:string(bio:long) global BIO_READ = 0, BIO_WRITE = 1 -/* probe ioblock.request +/** + * probe ioblock.request - Fires whenever making a generic block I/O request. * - * Fires whenever making a generic block I/O request. - * - * Context: - * The process makes block I/O request - * - * Variables: - * devname - block device name - * ino - i-node number of the mapped file - * sector - beginning sector for the entire bio - * flags - see below + * @devname - block device name + * @ino - i-node number of the mapped file + * @sector - beginning sector for the entire bio + * @flags - see below * BIO_UPTODATE 0 ok after I/O completion * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block * BIO_EOF 2 out-out-bounds error @@ -99,20 +94,18 @@ global BIO_READ = 0, BIO_WRITE = 1 * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported * - * rw - binary trace for read/write request - * vcnt - bio vector count which represents number of array element (page, - * offset, length) which make up this I/O request - * idx - offset into the bio vector array - * phys_segments - number of segments in this bio after physical address - * coalescing is performed. - * hw_segments - number of segments after physical and DMA remapping - * hardware coalescing is performed - * size - total size in bytes - * bdev - target block device - * bdev_contains - points to the device object which contains the - * partition (when bio structure represents a partition) - * p_start_sect - points to the start sector of the partition - * structure of the device + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which make up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed + * @hw_segments - number of segments after physical and DMA remapping hardware coalescing is performed + * @size - total size in bytes + * @bdev - target block device + * @bdev_contains - points to the device object which contains the partition (when bio structure represents a partition) + * @p_start_sect - points to the start sector of the partition structure of the device + * + * Context: + * The process makes block I/O request */ probe ioblock.request = kernel.function ("generic_make_request") { @@ -135,19 +128,14 @@ probe ioblock.request = kernel.function ("generic_make_request") p_start_sect = __bio_start_sect($bio) } -/* probe ioblock.end - * - * Fires whenever a block I/O transfer is complete. - * - * Context: - * The process signals the transfer is done. +/** + * probe ioblock.end - Fires whenever a block I/O transfer is complete. * - * Variables: - * devname - block device name - * ino - i-node number of the mapped file - * byte_done - number of bytes transferred - * sector - beginning sector for the entire bio - * flags - see below + * @devname - block device name + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below * BIO_UPTODATE 0 ok after I/O completion * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block * BIO_EOF 2 out-out-bounds error @@ -156,16 +144,16 @@ probe ioblock.request = kernel.function ("generic_make_request") * BIO_BOUNCED 5 bio is a bounce bio * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported - * error - 0 on success - * rw - binary trace for read/write request - * vcnt - bio vector count which represents number of array element (page, - * offset, length) which makes up this I/O request - * idx - offset into the bio vector array - * phys_segments - number of segments in this bio after physical address - * coalescing is performed. - * hw_segments - number of segments after physical and DMA remapping - * hardware coalescing is performed - * size - total size in bytes + * @error - 0 on success + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @hw_segments - number of segments after physical and DMA remapping hardware coalescing is performed + * @size - total size in bytes + * + * Context: + * The process signals the transfer is done. */ probe ioblock.end = kernel.function("bio_endio") { @@ -186,3 +174,135 @@ probe ioblock.end = kernel.function("bio_endio") %) size = $bio->bi_size } + +/** + * probe ioblock_trace.bounce - Fires whenever a buffer bounce is needed for at least one page of a block IO request. + * + * @devname device for which a buffer bounce was needed. + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below + * BIO_UPTODATE 0 ok after I/O completion + * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block + * BIO_EOF 2 out-out-bounds error + * BIO_SEG_VALID 3 nr_hw_seg valid + * BIO_CLONED 4 doesn't own data + * BIO_BOUNCED 5 bio is a bounce bio + * BIO_USER_MAPPED 6 contains user pages + * BIO_EOPNOTSUPP 7 not supported + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @size - total size in bytes + * + * Context : + * The process creating a block IO request. + */ +probe ioblock_trace.bounce = kernel.trace("block_bio_bounce") +{ + devname = __bio_devname($bio) + ino = __bio_ino($bio) + + bytes_done = $bio->bi_size + sector = $bio->bi_sector + flags = $bio->bi_flags + rw = $bio->bi_rw + vcnt = $bio->bi_vcnt + idx = $bio->bi_idx + phys_segments = $bio->bi_phys_segments + size = $bio->bi_size +} + +/** + * probe ioblock_trace.request - Fires just as a generic block I/O request is created for a bio. + * + * @devname - block device name + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below + * BIO_UPTODATE 0 ok after I/O completion + * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block + * BIO_EOF 2 out-out-bounds error + * BIO_SEG_VALID 3 nr_hw_seg valid + * BIO_CLONED 4 doesn't own data + * BIO_BOUNCED 5 bio is a bounce bio + * BIO_USER_MAPPED 6 contains user pages + * BIO_EOPNOTSUPP 7 not supported + * + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which make up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @size - total size in bytes + * @bdev - target block device + * @bdev_contains - points to the device object which contains the partition (when bio structure represents a partition) + * @p_start_sect - points to the start sector of the partition structure of the device + * + * Context: + * The process makes block I/O request + */ + +probe ioblock_trace.request = kernel.trace("block_bio_queue") +{ + devname = __bio_devname($bio) + ino = __bio_ino($bio) + + bytes_done = $bio->bi_size + sector = $bio->bi_sector + flags = $bio->bi_flags + rw = $bio->bi_rw + vcnt = $bio->bi_vcnt + idx = $bio->bi_idx + phys_segments = $bio->bi_phys_segments + size = $bio->bi_size + bdev_contains = $bio->bi_bdev->bd_contains + bdev = $bio->bi_bdev + p_start_sect = __bio_start_sect($bio) +} + +/** + * probe ioblock_trace.end - Fires whenever a block I/O transfer is complete. + * + * @q - request queue on which this bio was queued. + * @devname - block device name + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below + * BIO_UPTODATE 0 ok after I/O completion + * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block + * BIO_EOF 2 out-out-bounds error + * BIO_SEG_VALID 3 nr_hw_seg valid + * BIO_CLONED 4 doesn't own data + * BIO_BOUNCED 5 bio is a bounce bio + * BIO_USER_MAPPED 6 contains user pages + * BIO_EOPNOTSUPP 7 not supported + * + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @size - total size in bytes + * + * Context: + * The process signals the transfer is done. + */ +probe ioblock_trace.end = kernel.trace("block_bio_complete") +{ + q = $q + devname = __bio_devname($bio) + ino = __bio_ino($bio) + + bytes_done = $bio->bi_size + + sector = $bio->bi_sector + flags = $bio->bi_flags + rw = $bio->bi_rw + vcnt = $bio->bi_vcnt + idx = $bio->bi_idx + phys_segments = $bio->bi_phys_segments + size = $bio->bi_size +} diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp index 637e2783..7f26cf23 100644 --- a/tapset/ioscheduler.stp +++ b/tapset/ioscheduler.stp @@ -68,22 +68,24 @@ probe ioscheduler.elv_next_request.return } /** - * probe ioscheduler.elv_add_request - A request was added to the request queue + * probe ioscheduler.elv_add_request.kp - kprobe based probe to indicate that a request was added to the request queue * @elevator_name: The type of I/O elevator currently enabled + * @q: pointer to request queue * @req: Address of the request * @req_flags: Request flags * @disk_major: Disk major number of the request * @disk_minor: Disk minor number of the request */ // when a request is added to the request queue -probe ioscheduler.elv_add_request - = kernel.function("__elv_add_request") +probe ioscheduler.elv_add_request.kp + = kernel.function("elv_insert") { %( kernel_v >= "2.6.10" %? elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) %: elevator_name = kernel_string($q->elevator->elevator_name) %) + q = $q if($rq == 0) { disk_major = -1 disk_minor = -1 @@ -142,6 +144,189 @@ probe ioscheduler.elv_completed_request %) } +/** + * probe ioscheduler.elv_add_request.tp - tracepoint based probe to indicate a request is added to the request queue. + * @elevator_name : The type of I/O elevator currently enabled. + * @q : Pointer to request queue. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler.elv_add_request.tp + = kernel.trace("block_rq_insert") +{ +q = $q +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +rq = $rq + +if ($rq == 0 || $rq->rq_disk ==0) { + disk_major = -1 + disk_minor = -1 +} else { + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler.elv_add_request - probe to indicate request is added to the request queue. + * @elevator_name : The type of I/O elevator currently enabled. + * @q : Pointer to request queue. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler.elv_add_request = + ioscheduler.elv_add_request.tp !, ioscheduler.elv_add_request.kp +{} + +/** + * probe ioscheduler_trace.elv_completed_request - Fires when a request is + * completed. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_completed_request + = kernel.trace("block_rq_complete") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +rq = $rq + +if ($rq == 0 || $rq->rq_disk ==0) { + disk_major = -1 + disk_minor = -1 +} else { + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.elv_issue_request - Fires when a request is + * scheduled. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_issue_request + = kernel.trace("block_rq_issue") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +rq = $rq + +if ($rq == 0 || $rq->rq_disk ==0) { + disk_major = -1 + disk_minor = -1 +} else { + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.elv_requeue_request - Fires when a request is + * put back on the queue, when the hadware cannot accept more requests. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_requeue_request + = kernel.trace("block_rq_requeue") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +rq = $rq + +if ($rq == 0 || $rq->rq_disk ==0) { + disk_major = -1 + disk_minor = -1 +} else { + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.elv_abort_request - Fires when a request is aborted. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_abort_request + = kernel.trace("block_rq_abort") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +rq = $rq + +if ($rq == 0 || $rq->rq_disk ==0) { + disk_major = -1 + disk_minor = -1 +} else { + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.plug - Fires when a request queue is plugged; + * ie, requests in the queue cannot be serviced by block driver. + * @rq_queue : request queue + * + */ +probe ioscheduler_trace.plug = kernel.trace("block_plug") +{ + rq_queue = $q +} + +/** + * probe ioscheduler_trace.unplug_io - Fires when a request queue is unplugged; + * Either, when number of pending requests in the queue exceeds threshold + * or, upon expiration of timer that was activated when queue was plugged. + * @rq_queue : request queue + * + */ +probe ioscheduler_trace.unplug_io = kernel.trace("block_unplug_io") +{ + rq_queue = $q +} + +/** + * probe ioscheduler_trace.unplug_timer - Fires when unplug timer associated + * with a request queue expires. + * @rq_queue : request queue + * + */ +probe ioscheduler_trace.unplug_timer = kernel.trace("block_unplug_timer") +{ + rq_queue = $q +} + function disk_major_from_request:long(var_q:long) %{ /* pure */ struct request_queue *q = (struct request_queue *)((long)THIS->var_q); diff --git a/tapset/networking.stp b/tapset/networking.stp index e9ea35dc..e1c5ed1f 100644 --- a/tapset/networking.stp +++ b/tapset/networking.stp @@ -154,7 +154,7 @@ probe netdev.rx * @flags: The new flags */ probe netdev.change_rx_flag - = kernel.function("dev_change_rx_flags") + = kernel.function("dev_change_rx_flags") ? { dev_name = get_netdev_name($dev) flags = $flags @@ -217,7 +217,7 @@ probe netdev.unregister * @dev_name: The device that is going to provide the statistics */ probe netdev.get_stats - = kernel.function("dev_get_stats") + = kernel.function("dev_get_stats") ? { dev_name = get_netdev_name($dev) } diff --git a/tapset/nfs.stp b/tapset/nfs.stp index 6b7d5eeb..50bdc087 100644 --- a/tapset/nfs.stp +++ b/tapset/nfs.stp @@ -450,8 +450,8 @@ probe nfs.fop.aio_read.return = kernel.function ("nfs_file_read").return !, if ($return > 0) { size = $return - units = "bytes" } + units = "bytes" } /* probe nfs.fop.aio_write @@ -503,8 +503,8 @@ probe nfs.fop.aio_write.return = kernel.function("nfs_file_write").return !, if ($return > 0) { size = $return - units = "bytes" } + units = "bytes" } /* probe nfs.fop.mmap @@ -669,7 +669,9 @@ probe nfs.fop.release.return = kernel.function("nfs_file_release").return !, * ino : inode number * ndirty : number of dirty pages */ -probe nfs.fop.fsync = kernel.function("nfs_fsync") !, +probe nfs.fop.fsync = kernel.function("nfs_file_fsync") !, + module("nfs").function("nfs_file_fsync") !, + kernel.function("nfs_fsync") !, module("nfs").function("nfs_fsync") { dev = __file_dev($file) @@ -683,7 +685,9 @@ probe nfs.fop.fsync = kernel.function("nfs_fsync") !, argstr = sprintf("%d", ino) } -probe nfs.fop.fsync.return = kernel.function("nfs_fsync").return !, +probe nfs.fop.fsync.return = kernel.function("nfs_file_fsync").return !, + module("nfs").function("nfs_file_fsync").return !, + kernel.function("nfs_fsync").return !, module("nfs").function("nfs_fsync").return { name = "nfs.fop.fsync.return" @@ -782,8 +786,8 @@ probe nfs.fop.sendfile.return = kernel.function("nfs_file_sendfile").return !, if ($return > 0) { size = $return - units = "bytes" } + units = "bytes" } %) @@ -816,8 +820,8 @@ probe nfs.aop.entries = nfs.aop.readpage, nfs.aop.writepage, nfs.aop.writepages, nfs.aop.release_page ?, - nfs.aop.prepare_write, - nfs.aop.commit_write + nfs.aop.write_begin, + nfs.aop.write_end { } @@ -826,8 +830,8 @@ probe nfs.aop.return = nfs.aop.readpage.return, nfs.aop.writepage.return, nfs.aop.writepages.return, nfs.aop.release_page.return ?, - nfs.aop.prepare_write.return, - nfs.aop.commit_write.return + nfs.aop.write_begin.return, + nfs.aop.write_end.return { } @@ -922,9 +926,8 @@ probe nfs.aop.readpages.return = kernel.function ("nfs_readpages").return !, name = "nfs.aop.readpages.return" retstr = sprintf("%d", $return) - if ($return > 0 ) - { - size = retstr + if ($return > 0 ) { + size = $return } units = "pages" } @@ -1064,6 +1067,79 @@ probe nfs.aop.writepages.return = kernel.function ("nfs_writepages").return !, retstr = sprintf("%d", $return) } +# kernel commit 4899f9c852564ce7b6d0ca932ac6674bf471fd28 removed +# nfs_prepare_write()/nfs_commit_write() and created +# nfs_write_begin()/nfs_write_end(). So, we try to find whatever the +# current kernel has. + +probe nfs.aop.write_begin = __nfs.aop.write_begin !, + __nfs.aop.prepare_write +{ +} +probe nfs.aop.write_begin.return + = __nfs.aop.write_begin.return !, + __nfs.aop.prepare_write.return +{ +} + +probe nfs.aop.write_end = __nfs.aop.write_end !, + __nfs.aop.commit_write +{ +} +probe nfs.aop.write_end.return + = __nfs.aop.write_end.return !, + __nfs.aop.commit_write.return +{ +} + +probe __nfs.aop.write_begin = kernel.function ("nfs_write_begin") !, + module("nfs").function("nfs_write_begin") +{ + dev = __file_dev($file) + ino = __file_ino($file) + s_id = __file_id($file) + devname = kernel_string(s_id) + + pos = $pos + count = $len + + name = "nfs.aop.write_begin" + argstr = sprintf("%d", ino) + + units = "bytes" +} +probe __nfs.aop.write_begin.return + = kernel.function ("nfs_write_begin").return !, + module("nfs").function ("nfs_write_begin").return +{ + name = "nfs.aop.write_begin.return" + retstr = sprintf("%d", $return) +} + +probe __nfs.aop.write_end = kernel.function ("nfs_write_end") !, + module("nfs").function("nfs_write_end") +{ + dev = __file_dev($file) + ino = __file_ino($file) + s_id = __file_id($file) + devname = kernel_string(s_id) + + pos = $pos + count = $len + + name = "nfs.aop.write_end" + argstr = sprintf("%d", ino) + + units = "bytes" +} +probe __nfs.aop.write_end.return + = kernel.function ("nfs_write_end").return !, + module("nfs").function("nfs_write_end").return +{ + name = "nfs.aop.write_end.return" + retstr = sprintf("%d", $return) +} + /* probe nfs.aop.prepare_write * Fires when do write operation on nfs. * Prepare a page for writing @@ -1084,8 +1160,8 @@ probe nfs.aop.writepages.return = kernel.function ("nfs_writepages").return !, * in the page frame * size : write bytes */ -probe nfs.aop.prepare_write = kernel.function ("nfs_prepare_write") !, - module("nfs").function ("nfs_prepare_write") +probe __nfs.aop.prepare_write = kernel.function ("nfs_prepare_write") !, + module("nfs").function ("nfs_prepare_write") { __page = $page dev = __page_dev(__page) @@ -1104,7 +1180,7 @@ probe nfs.aop.prepare_write = kernel.function ("nfs_prepare_write") !, units = "bytes" } -probe nfs.aop.prepare_write.return = +probe __nfs.aop.prepare_write.return = kernel.function ("nfs_prepare_write").return !, module("nfs").function ("nfs_prepare_write").return { @@ -1132,16 +1208,15 @@ probe nfs.aop.prepare_write.return = * in the page frame * size : write bytes */ -probe nfs.aop.commit_write = kernel.function ("nfs_commit_write") !, - module("nfs").function ("nfs_commit_write") +probe __nfs.aop.commit_write = kernel.function ("nfs_commit_write") !, + module("nfs").function ("nfs_commit_write") { - __page = $page + __page = $page dev = __page_dev(__page) ino = __page_ino(__page) offset = $offset to = $to - i_flag = __p2i_flag($page) i_size = __p2i_size($page) @@ -1157,7 +1232,7 @@ probe nfs.aop.commit_write = kernel.function ("nfs_commit_write") !, units = "bytes" } -probe nfs.aop.commit_write.return = +probe __nfs.aop.commit_write.return = kernel.function ("nfs_commit_write").return !, module("nfs").function ("nfs_commit_write").return { diff --git a/tapset/nfs_proc.stp b/tapset/nfs_proc.stp index 502091b4..afd5328b 100644 --- a/tapset/nfs_proc.stp +++ b/tapset/nfs_proc.stp @@ -207,9 +207,9 @@ function __getfh_inode :long(dir:long) %{ /* pure */ THIS->__retvalue =(long) fh; %} probe nfs.proc.entries = nfs.proc.lookup, - nfs.proc.read, - nfs.proc.write, - nfs.proc.commit, + nfs.proc.read ?, + nfs.proc.write ?, + nfs.proc.commit ?, nfs.proc.read_setup, nfs.proc.write_setup, nfs.proc.commit_setup, @@ -226,9 +226,9 @@ probe nfs.proc.entries = nfs.proc.lookup, probe nfs.proc.return = nfs.proc.lookup.return, - nfs.proc.read.return, - nfs.proc.write.return, - nfs.proc.commit.return, + nfs.proc.read.return ?, + nfs.proc.write.return ?, + nfs.proc.commit.return ?, nfs.proc.read_setup.return, nfs.proc.write_setup.return, nfs.proc.commit_setup.return, @@ -355,16 +355,18 @@ probe nfs.proc4.lookup.return = kernel.function("nfs4_proc_lookup").return!, * count : read bytes in this execution * offset : the file offset * +* All the nfs.proc.read kernel functions were removed in kernel commit +* 8e0969, so these probes are optional. */ -probe nfs.proc.read = nfs.proc2.read , - nfs.proc3.read , - nfs.proc4.read +probe nfs.proc.read = nfs.proc2.read ?, + nfs.proc3.read ?, + nfs.proc4.read ? {} -probe nfs.proc.read.return = nfs.proc2.read.return , - nfs.proc3.read.return , - nfs.proc4.read.return +probe nfs.proc.read.return = nfs.proc2.read.return ?, + nfs.proc3.read.return ?, + nfs.proc4.read.return ? { } @@ -464,17 +466,20 @@ probe nfs.proc4.read.return = kernel.function("nfs4_proc_read").return !, * bitmask0: * bitmask1 :V4 bitmask representing the set of attributes * supported on this filesystem (only in probe nfs.proc4.write) +* +* All the nfs.proc.write kernel functions were removed in kernel commit +* 200baa, so these probes are optional. */ -probe nfs.proc.write = nfs.proc2.write , - nfs.proc3.write , - nfs.proc4.write +probe nfs.proc.write = nfs.proc2.write ?, + nfs.proc3.write ?, + nfs.proc4.write ? {} -probe nfs.proc.write.return = nfs.proc2.write.return , - nfs.proc3.write.return , - nfs.proc4.write.return +probe nfs.proc.write.return = nfs.proc2.write.return ?, + nfs.proc3.write.return ?, + nfs.proc4.write.return ? {} probe nfs.proc2.write = kernel.function("nfs_proc_write")!, @@ -598,13 +603,16 @@ probe nfs.proc4.write.return = kernel.function("nfs4_proc_write").return !, * bitmask0: * bitmask1 :V4 bitmask representing the set of attributes * supported on this filesystem (only in probe nfs.proc4.commit) +* +* All the nfs.proc.commit kernel functions were removed in kernel +* commit 200baa, so these probes are optional. */ -probe nfs.proc.commit = nfs.proc3.commit, - nfs.proc4.commit +probe nfs.proc.commit = nfs.proc3.commit ?, + nfs.proc4.commit ? {} -probe nfs.proc.commit.return = nfs.proc3.commit.return, - nfs.proc4.commit.return +probe nfs.proc.commit.return = nfs.proc3.commit.return ?, + nfs.proc4.commit.return ? {} // XXX: on kernels > 2.6.18 (?), module("nfs") -> module("nfsd") and diff --git a/tapsets.cxx b/tapsets.cxx index c972de5f..7bae4615 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -6313,10 +6313,10 @@ tracepoint_builder::init_dw(systemtap_session& s) glob_t trace_glob; string globs[] = { - "/include/trace/*.h", "/include/trace/events/*.h", - "/source/include/trace/*.h", "/source/include/trace/events/*.h", + "/include/trace/*.h", + "/source/include/trace/*.h", }; for (unsigned z = 0; z < sizeof(globs) / sizeof(globs[0]); z++) { diff --git a/testsuite/buildok/ioblock_test.stp b/testsuite/buildok/ioblock_test.stp index 4d3dadfa..21595021 100755 --- a/testsuite/buildok/ioblock_test.stp +++ b/testsuite/buildok/ioblock_test.stp @@ -25,3 +25,10 @@ probe ioblock.end { devname, sector, flags, rw, bio_rw_str(rw), vcnt, idx, phys_segments, size, bytes_done, error, ino) %) } + +probe ioblock_trace.* +{ + log(pp()) + printf("%s\t%d\t%d\t%d\t%d\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%p\t%p\t%d\n", + devname, q, sector, flags, rw, bio_rw_str(rw), vcnt, idx, phys_segments, size, bytes_done, ino, p_start_sect, bdev_contains, bdev) +} diff --git a/testsuite/buildok/ioscheduler.stp b/testsuite/buildok/ioscheduler.stp index 2d88d2d5..8b377619 100755 --- a/testsuite/buildok/ioscheduler.stp +++ b/testsuite/buildok/ioscheduler.stp @@ -7,3 +7,15 @@ probe ioscheduler.* printf("ppname: %s, elv_name: %s, %d, %d", probefunc(), elevator_name, disk_major, disk_minor) } + +probe ioscheduler_trace.elv* +{ + printf("ppname: %s, request %p, elv_name: %s, %d, %d", probefunc(), + rq, elevator_name, disk_major, disk_minor) +} + +probe ioscheduler_trace.plug, ioscheduler_trace.unplug_io, ioscheduler_trace.unplug_timer +{ + printf("ppname: %s, request %p", probefunc(), rq_queue) +} + diff --git a/testsuite/buildok/netdev.stp b/testsuite/buildok/netdev.stp index 49a1eb5c..7e4be82c 100755 --- a/testsuite/buildok/netdev.stp +++ b/testsuite/buildok/netdev.stp @@ -1,6 +1,6 @@ #! stap -wp4 -probe netdev.get_stats{ +probe netdev.get_stats ? { printf("%s", dev_name) } @@ -21,7 +21,7 @@ probe netdev.set_promiscuity { disable, inc) } -probe netdev.change_rx_flag { +probe netdev.change_rx_flag ? { printf("%s %d", dev_name, flags) } diff --git a/testsuite/buildok/xtime.stp b/testsuite/buildok/xtime.stp new file mode 100755 index 00000000..e41f9b16 --- /dev/null +++ b/testsuite/buildok/xtime.stp @@ -0,0 +1,7 @@ +#! stap -p4 + +# Test for getting at an external global variable PR10622 +probe kernel.function("do_gettimeofday") +{ + printf("xtime.tv_sec:%d\n", $xtime->tv_sec); exit(); +} diff --git a/testsuite/lib/stap_compile.exp b/testsuite/lib/stap_compile.exp index c8d44203..8780930e 100644 --- a/testsuite/lib/stap_compile.exp +++ b/testsuite/lib/stap_compile.exp @@ -19,8 +19,8 @@ proc stap_compile { TEST_NAME compile script args } { -re "compilation failed" {incr compile_errors 1; exp_continue} -re "semantic error:" {incr compile_errors 1; exp_continue} } - catch close set res [wait -i $spawn_id] + catch close set res [lindex $res 3] if {($res == 0 && $compile_errors == 0) diff --git a/testsuite/systemtap.base/cu-decl-1.c b/testsuite/systemtap.base/cu-decl-1.c new file mode 100644 index 00000000..9743d298 --- /dev/null +++ b/testsuite/systemtap.base/cu-decl-1.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +struct foo; +struct foo* get_foo(void); + +void +print(struct foo* f) +{ + printf("%p\n", f); +} + +int +main() +{ + print(get_foo()); + return 0; +} diff --git a/testsuite/systemtap.base/cu-decl-2.c b/testsuite/systemtap.base/cu-decl-2.c new file mode 100644 index 00000000..46503251 --- /dev/null +++ b/testsuite/systemtap.base/cu-decl-2.c @@ -0,0 +1,10 @@ +struct foo { + int x, y; +}; + +struct foo* +get_foo() +{ + static struct foo f = { 6, 7 }; + return &f; +} diff --git a/testsuite/systemtap.base/cu-decl.exp b/testsuite/systemtap.base/cu-decl.exp new file mode 100644 index 00000000..ae06ad85 --- /dev/null +++ b/testsuite/systemtap.base/cu-decl.exp @@ -0,0 +1,25 @@ +# Check that we can dereference a type declaration that is +# defined in a separate CU from the function. +set test "cu-decl" + +set script { + probe process("cu-decl").function("print") { + println($f->x * $f->y) + } +} + +set sources "$srcdir/$subdir/$test-1.c $srcdir/$subdir/$test-2.c" +set res [target_compile $sources $test executable "additional_flags=-g"] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "$test target compilation" + untested "$test" +} else { + pass "$test target compilation" +} +if {![utrace_p]} { + untested "$test : no kernel utrace support found" +} else { + stap_compile $test 1 "{$script}" +} +catch {exec rm $test} diff --git a/testsuite/systemtap.base/externalvar.c b/testsuite/systemtap.base/externalvar.c new file mode 100644 index 00000000..a7716029 --- /dev/null +++ b/testsuite/systemtap.base/externalvar.c @@ -0,0 +1,52 @@ +/* externalvar test case + * Copyright (C) 2009, 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. + * + * Tests that an external exported variable can be accessed. + */ + +#include <stdlib.h> + +// function from our library +int lib_main (void); + +struct exestruct +{ + char c; + int i; + long l; + struct exestruct *s1; + struct exestruct *s2; +}; + +char exevar_c; +int exevar_i; +long exevar_l; +struct exestruct *exe_s; + +static void +main_call () +{ + asm (""); // dummy method, just to probe and extract and jump into lib. + lib_main (); +} + +int +main () +{ + exevar_c = 42; + exevar_i = 2; + exevar_l = 21; + exe_s = (struct exestruct *) malloc(sizeof(struct exestruct)); + exe_s->i =1; + exe_s->l =2; + exe_s->c =3; + exe_s->s1 = NULL; + exe_s->s2 = exe_s; + main_call (); + return 0; +} diff --git a/testsuite/systemtap.base/externalvar.exp b/testsuite/systemtap.base/externalvar.exp new file mode 100644 index 00000000..668dec55 --- /dev/null +++ b/testsuite/systemtap.base/externalvar.exp @@ -0,0 +1,70 @@ +set test "externalvar" +set testpath "$srcdir/$subdir" +set testsrc "$testpath/$test.c" +set testsrclib "$testpath/${test}_lib.c" +set testexe "[pwd]/$test" +set testlibname "$test" +set testlibdir "[pwd]" +set testso "$testlibdir/lib${testlibname}.so" +set testflags "additional_flags=-g additional_flags=-O0" +set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared" +set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir" + +# Only run on make installcheck and utrace present. +if {! [installtest_p]} { untested "$test"; return } +if {! [utrace_p]} { untested "$test"; return } + +# Compile our test program and library. +set res [target_compile $testsrclib $testso executable $testlibflags] +if { $res != "" } { + verbose "target_compile for $testso failed: $res" 2 + fail "unable to compile $testsrclib" + return +} +set res [target_compile $testsrc $testexe executable $maintestflags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "unable to compile $testsrc" + return +} + +set output {exevar_c = 42 +exevar_i = 2 +exevar_l = 21 +exe_s->i = 1 +exe_s->l = 2 +exe_s->c = 3 +exe_s->s1 = 0x0 +exe_s == exe_s->s2 +libvar = 42 +lib_s->i = 1 +lib_s->l = 2 +lib_s->c = 3 +lib_s == lib_s->s1 +lib_s->s2 = 0x0} + +# Got to run stap with both the exe and the libraries used as -d args. +set cmd [concat stap -d $testso -d $testexe -c $testexe $testpath/$test.stp] +send_log "cmd: $cmd\n" +catch {eval exec $cmd} res +send_log "cmd output: $res\n" + +set n 0 +set m [llength [split $output "\n"]] +set expected [split $output "\n"] +foreach line [split $res "\n"] { + if {![string equal $line [lindex $expected $n]]} { + fail $test + send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\", " + send_log "Got \"$line\"\n" + return + } + incr n +} +if { $n != $m } { + fail $test + send_log "Got \"$n\" lines, expected \"$m\" lines\n" +} else { + pass $test +} +# exec rm -f $testexe $testso diff --git a/testsuite/systemtap.base/externalvar.stp b/testsuite/systemtap.base/externalvar.stp new file mode 100644 index 00000000..7d4b69bb --- /dev/null +++ b/testsuite/systemtap.base/externalvar.stp @@ -0,0 +1,39 @@ +probe process("externalvar").function("main_call") +{ + printf("exevar_c = %d\n", $exevar_c); + printf("exevar_i = %d\n", $exevar_i); + printf("exevar_l = %d\n", $exevar_l); + + printf("exe_s->i = %d\n", $exe_s->i); + printf("exe_s->l = %d\n", $exe_s->l); + printf("exe_s->c = %d\n", $exe_s->c); + + printf("exe_s->s1 = 0x%x\n", $exe_s->s1); + if ($exe_s == $exe_s->s2) + { + printf("exe_s == exe_s->s2\n"); + } + else + { + printf("exe_s != exe_s->s2\n"); + } +} + +probe process("libexternalvar.so").function("lib_call") +{ + printf("libvar = %d\n", $libvar); + + printf("lib_s->i = %d\n", $lib_s->i); + printf("lib_s->l = %d\n", $lib_s->l); + printf("lib_s->c = %d\n", $lib_s->c); + + if ($lib_s == $lib_s->s1) + { + printf("lib_s == lib_s->s1\n"); + } + else + { + printf("lib_s != lib_s->s2\n"); + } + printf("lib_s->s2 = 0x%x\n", $lib_s->s2); +} diff --git a/testsuite/systemtap.base/externalvar_lib.c b/testsuite/systemtap.base/externalvar_lib.c new file mode 100644 index 00000000..9017e798 --- /dev/null +++ b/testsuite/systemtap.base/externalvar_lib.c @@ -0,0 +1,43 @@ +/* external var test case - library helper + * Copyright (C) 2009, 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. + * + * Tests that an external exported variable can be accessed. + */ + +#include <stdlib.h> + +struct libstruct +{ + int i; + long l; + char c; + struct libstruct *s1; + struct libstruct *s2; +}; + +int libvar; +struct libstruct *lib_s; + +static void +lib_call () +{ + asm(""); // dummy method, just to probe and extract. +} + +void +lib_main () +{ + libvar = 42; + lib_s = (struct libstruct *) malloc(sizeof(struct libstruct)); + lib_s->i = 1; + lib_s->l = 2; + lib_s->c = 3; + lib_s->s1 = lib_s; + lib_s->s2 = NULL; + lib_call (); +} diff --git a/testsuite/systemtap.examples/general/badname.stp b/testsuite/systemtap.examples/general/badname.stp index 153e08c5..ba5a793c 100755 --- a/testsuite/systemtap.examples/general/badname.stp +++ b/testsuite/systemtap.examples/general/badname.stp @@ -1,4 +1,4 @@ -#!/usr/bin/stap -g +#!/usr/bin/env stap # badname.stp # Prevent the creation of files with undesirable names. # Source: http://blog.cuviper.com/2009/04/08/hacking-linux-filenames/ diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp index 9079cb40..e8655b37 100755 --- a/testsuite/systemtap.examples/general/grapher.stp +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -1,4 +1,4 @@ -#! /usr/bin/stap +#! /usr/bin/env stap probe begin { diff --git a/testsuite/systemtap.examples/general/graphs.stp b/testsuite/systemtap.examples/general/graphs.stp index f55d6cee..9e322820 100755 --- a/testsuite/systemtap.examples/general/graphs.stp +++ b/testsuite/systemtap.examples/general/graphs.stp @@ -1,4 +1,4 @@ -#! /usr/bin/stap +#! /usr/bin/env stap # ------------------------------------------------------------------------ # data collection diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 55fea0fb..57cf0978 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -58,6 +58,9 @@ keywords: <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br> <li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Callgraph tracing with arguments<br> keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#CALLGRAPH">CALLGRAPH</a> <br> <p>Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger.</p></li> +<li><a href="interrupt/interrupts-by-dev.stp">interrupt/interrupts-by-dev.stp</a> - Record interrupts on a per-device basis.<br> +keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <br> +<p>The interrupts-by-dev.stp script profiles interrupts received by each device per 100 ms.</p></li> <li><a href="interrupt/scf.stp">interrupt/scf.stp</a> - Tally Backtraces for Inter-Processor Interrupt (IPI)<br> keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> <p>The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.</p></li> @@ -69,7 +72,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BAC <p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li> <li><a href="io/ioblktime.stp">io/ioblktime.stp</a> - Average Time Block IO Requests Spend in Queue <br> keywords: <a href="keyword-index.html#IO">IO</a> <br> -<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</p></li> +<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</p></li> <li><a href="io/iostat-scsi.stp">io/iostat-scsi.stp</a> - iostat for SCSI Devices<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword-index.html#SCSI">SCSI</a> <br> <p>The iostat-scsi.stp script provides a breakdown of the number of blks read and written on the machine's various SCSI devices. The script takes one argument which is the number of seconds between reports.</p></li> @@ -78,7 +81,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PRO <p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li> <li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <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 parentheses. 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> +<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 spent 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 parentheses. 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> keywords: <a href="keyword-index.html#IO">IO</a> <br> <p>Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.</p></li> @@ -99,22 +102,22 @@ keywords: <a href="keyword-index.html#LOCKING">LOCKING</a> <br> <p>The bkl.stp script can help determine whether the Big Kernel Lock (BKL) is causing serialization on a multiprocessor system due to excessive contention of the BKL. The bkl.stp script takes one argument which is the number of processes waiting for the Big Kernel Lock (BKL). When the number of processes waiting for the BKL is reached or exceeded, the script will print a time stamp, the number of processes waiting for the BKL, the holder of the BKL, and the amount of time the BKL was held.</p></li> <li><a href="locks/bkl_stats.stp">locks/bkl_stats.stp</a> - Per Process Statistics on Big Kernel Lock (BKL) Use<br> keywords: <a href="keyword-index.html#LOCKING">LOCKING</a> <br> -<p>The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent holding the lock for each of the processes.</p></li> +<p>The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent in holding the lock for each of the processes.</p></li> <li><a href="memory/kmalloc-top">memory/kmalloc-top</a> - Show Paths to Kernel Malloc (kmalloc) Invocations<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).</p></li> +<p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be filtered to print only the first N stack traces (-t), stack traces with a minimum counts (-m), or exclude certain stack traces (-e).</p></li> <li><a href="memory/mmanonpage.stp">memory/mmanonpage.stp</a> - Track Virtual Memory System Actions on Anonymous Pages<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. Its useful in debugging leaks in the anonymous regions of a process.</p></li> +<p>The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. It's useful in debugging leaks in the anonymous regions of a process.</p></li> <li><a href="memory/mmfilepage.stp">memory/mmfilepage.stp</a> - Track Virtual Memory System Actions on File Backed Pages<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> <p>The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.</p></li> <li><a href="memory/mmreclaim.stp">memory/mmreclaim.stp</a> - Track Virtual Memory System Page Reclamation<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. Its useful is debugging performance problems that occur due to page reclamation.</p></li> +<p>The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. It's useful in debugging performance problems that occur due to page reclamation.</p></li> <li><a href="memory/mmwriteback.stp">memory/mmwriteback.stp</a> - Track Virtual Memory System Writing to Disk<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. Its useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p></li> +<p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. It's useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p></li> <li><a href="memory/numa_faults.stp">memory/numa_faults.stp</a> - Summarize Process Misses across NUMA Nodes<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#NUMA">NUMA</a> <br> <p>The numa_faults.stp script tracks the read and write pages faults for each process. When the script exits it prints out the total read and write pages faults for each process. The script also provide a break down of page faults per node for each process. This script is useful for determining whether the program has good locality (page faults limited to a single node) on a NUMA computer.</p></li> @@ -138,7 +141,7 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p></li> <li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <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> +<p>The script instruments each of the functions in the Linux kernel's net/socket.c file. The script prints out trace data. 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="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br> <p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li> @@ -150,7 +153,7 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li> <li><a href="network/tcpipstat.stp">network/tcpipstat.stp</a> - Display network statistics for individual TCP sockets.<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#STATISTICS">STATISTICS</a> <br> -<p>tcpipstat collects and display network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simmer to that of the command netstat -s, only sorted and grouped by individual sockets.</p></li> +<p>tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets.</p></li> <li><a href="process/chng_cpu.stp">process/chng_cpu.stp</a> - Monitor Changes in Processor Executing a Task<br> keywords: <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <br> <p>The chng_cpu.stp script takes an argument which is the executable name of the task it should monitor. Each time a task with that executable name is found running on a different processor, the script prints out the thread id (tid), the executable name, the processor now running the task, the thread state, and a backtrace showing the kernel functions that triggered the running of the task on the processor.</p></li> @@ -159,7 +162,7 @@ keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-inde <p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</p></li> <li><a href="process/forktracker.stp">process/forktracker.stp</a> - Trace Creation of Processes<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <br> -<p>The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes.</p></li> +<p>The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes.</p></li> <li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#LOCKING">LOCKING</a> <a href="keyword-index.html#FUTEX">FUTEX</a> <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> @@ -174,7 +177,7 @@ keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <br> <p>The script prints a variety of resource limits for a given pid, like /proc/$$/limits on recent kernels.</p></li> <li><a href="process/schedtimes.stp">process/schedtimes.stp</a> - Track Time Processes Spend in Various States using Tracepoints<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br> -<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> +<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> <li><a href="process/sig_by_pid.stp">process/sig_by_pid.stp</a> - Signal Counts by Process ID<br> keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br> <p>Print signal counts by process ID in descending order.</p></li> @@ -183,13 +186,13 @@ keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <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> keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <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 destination executable and process ID, the executable name user ID that sent the signal.</p></li> +<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the destination executable and process ID, the executable name and user ID that sents the signal.</p></li> <li><a href="process/sigmon.stp">process/sigmon.stp</a> - Track a particular signal to a specific process<br> keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <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> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> -<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> +<p>The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> <li><a href="process/sleeptime.stp">process/sleeptime.stp</a> - Trace Time Spent in nanosleep Syscalls<br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#SLEEP">SLEEP</a> <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 parentheses, the "nanosleep:" key, and the duration of the sleep in microseconds.</p></li> diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index 16b45aac..56c18c34 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -50,6 +50,13 @@ keywords: trace callgraph the trigger. +interrupt/interrupts-by-dev.stp - Record interrupts on a per-device basis. +keywords: interrupt + + The interrupts-by-dev.stp script profiles interrupts received by each + device per 100 ms. + + interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI) keywords: interrupt backtrace @@ -80,9 +87,9 @@ keywords: io The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the - average time waiting time for block IO per device and prints list - every 10 seconds. In some cases there can be too many outstanding - block IO operations and the script may exceed the default number of + average waiting time for block IO per device and prints list every 10 + seconds. In some cases there can be too many outstanding block IO + operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. @@ -112,7 +119,7 @@ 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 + amount of wall clock time spent 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 @@ -183,7 +190,7 @@ keywords: locking waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the - time spent holding the lock for each of the processes. + time spent in holding the lock for each of the processes. memory/kmalloc-top - Show Paths to Kernel Malloc (kmalloc) Invocations @@ -192,9 +199,9 @@ keywords: memory The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it - prints out sorted list. The output can be be filtered to print only - only the first stack traces (-t) stack traces with more a minimum - counts (-m), or exclude certain stack traces (-e). + prints out sorted list. The output can be filtered to print only the + first N stack traces (-t), stack traces with a minimum counts (-m), + or exclude certain stack traces (-e). memory/mmanonpage.stp - Track Virtual Memory System Actions on Anonymous Pages @@ -206,7 +213,7 @@ keywords: memory the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the - script is active. Its useful in debugging leaks in the anonymous + script is active. It's useful in debugging leaks in the anonymous regions of a process. @@ -227,7 +234,7 @@ keywords: memory The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that - occurred while the script was running. Its useful is debugging + occurred while the script was running. It's useful in debugging performance problems that occur due to page reclamation. @@ -237,8 +244,8 @@ keywords: memory The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is - running. Its useful in determining where writes are coming from on a - supposedly idle system that is experiencing unexpected IO. + running. It's useful in determining where writes are coming from on + a supposedly idle system that is experiencing unexpected IO. memory/numa_faults.stp - Summarize Process Misses across NUMA Nodes @@ -306,12 +313,12 @@ keywords: network tcp buffer memory network/socket-trace.stp - Trace Functions called in Network Socket Code 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. + The script instruments each of the functions in the Linux kernel's + net/socket.c file. The script prints out trace data. 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. network/tcp_connections.stp - Track Creation of Incoming TCP Connections @@ -343,9 +350,9 @@ keywords: network traffic network/tcpipstat.stp - Display network statistics for individual TCP sockets. keywords: network statistics - tcpipstat collects and display network statistics related to + tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are - collected are simmer to that of the command netstat -s, only sorted + collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets. @@ -375,7 +382,7 @@ process/forktracker.stp - Trace Creation of Processes keywords: process scheduler The forktracker.stp script prints out a time-stamped entry showing - each fork and exec operation on the machine. This can be useful for + each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes. @@ -418,10 +425,11 @@ process/schedtimes.stp - Track Time Processes Spend in Various States using Trac keywords: process scheduler time tracepoint The schedtimes.stp script instruments the scheduler to track the - amount of time that each process spends running, sleeping, queued, - and waiting for io. On exit the script prints out the accumulated - time for each state of processes observed. Optionally, this script - can be used with the '-c' or '-x' options to focus on a specific PID. + amount of time that each process spends in running, sleeping, + queuing, and waiting for io. On exit the script prints out the + accumulated time for each state of processes observed. Optionally, + this script can be used with the '-c' or '-x' options to focus on a + specific PID. process/sig_by_pid.stp - Signal Counts by Process ID @@ -441,8 +449,8 @@ 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 - destination executable and process ID, the executable name user ID - that sent the signal. + destination executable and process ID, the executable name and user + ID that sents the signal. process/sigmon.stp - Track a particular signal to a specific process @@ -458,7 +466,7 @@ keywords: signals process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations keywords: io scheduler backtrace - The script monitors the time that threads spend waiting for IO + The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay. diff --git a/testsuite/systemtap.examples/interrupt/interrupts-by-dev.meta b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.meta new file mode 100644 index 00000000..a89038b4 --- /dev/null +++ b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.meta @@ -0,0 +1,14 @@ +title: Record interrupts on a per-device basis. +name: interrupts-by-dev.stp +version: 1.0 +author: Prerna Saxena (prerna@linux.vnet.ibm.com) +keywords: interrupt +subsystem: interrupt +status: production +exit: user-controlled +output: timed +scope: system-wide +description: The interrupts-by-dev.stp script profiles interrupts received by each device per 100 ms. +test_support: stap -l 'kernel.trace("irq_handler_entry")' +test_check: stap -p4 interrupts-by-dev.stp +test_installcheck: stap interrupts-by-dev.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp index 3bcfd5e1..3bcfd5e1 100644..100755 --- a/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp +++ b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp diff --git a/testsuite/systemtap.examples/io/ioblktime.meta b/testsuite/systemtap.examples/io/ioblktime.meta index 01f34295..ff895a3f 100644 --- a/testsuite/systemtap.examples/io/ioblktime.meta +++ b/testsuite/systemtap.examples/io/ioblktime.meta @@ -8,6 +8,6 @@ status: production exit: user-controlled output: sorted-list scope: system-wide -description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. +description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. test_check: stap -p4 ioblktime.stp test_installcheck: stap ioblktime.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/io/iotime.meta b/testsuite/systemtap.examples/io/iotime.meta index cf22eacf..30e0599b 100644 --- a/testsuite/systemtap.examples/io/iotime.meta +++ b/testsuite/systemtap.examples/io/iotime.meta @@ -8,6 +8,6 @@ status: production exit: user-controlled output: trace scope: system-wide -description: 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 parentheses. 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. +description: 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 spent 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 parentheses. 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. test_check: stap -p4 iotime.stp test_installcheck: stap iotime.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/io/iotime.stp b/testsuite/systemtap.examples/io/iotime.stp index 60fb09af..288e91d0 100755 --- a/testsuite/systemtap.examples/io/iotime.stp +++ b/testsuite/systemtap.examples/io/iotime.stp @@ -12,7 +12,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Print out the amount of time spent in the read and write systemcall - * when a process closes each file is closed. Note that the systemtap + * when each file opened by the process is closed. Note that the systemtap * script needs to be running before the open operations occur for * the script to record data. * diff --git a/testsuite/systemtap.examples/io/ttyspy.stp b/testsuite/systemtap.examples/io/ttyspy.stp index 272d82e9..0c98f391 100755 --- a/testsuite/systemtap.examples/io/ttyspy.stp +++ b/testsuite/systemtap.examples/io/ttyspy.stp @@ -1,11 +1,11 @@ -#! /usr/bin/stap -g +#! /usr/bin/env stap # May also need --skip-badvars global activity_time, activity_log /* Concatenate head and tail, to a max of @num chars, preferring to keep the tail (as if it were a recent history buffer). */ -function strcattail:string(head:string,tail:string,num:long) %{ +function strcattail:string(head:string,tail:string,num:long) %{ /* pure */ unsigned taillen = strlen(THIS->tail); unsigned headlen = strlen(THIS->head); unsigned maxlen = THIS->num < MAXSTRINGLEN ? THIS->num : MAXSTRINGLEN; diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 1a2855e1..f7f08597 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -56,7 +56,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BAC <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="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> -<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> +<p>The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> </ul> <h3><a name="BUFFER">BUFFER</a></h3> <ul> @@ -144,6 +144,9 @@ keywords: <a href="keyword-index.html#FILESYSTEM">FILESYSTEM</a> <a href="keywor </ul> <h3><a name="INTERRUPT">INTERRUPT</a></h3> <ul> +<li><a href="interrupt/interrupts-by-dev.stp">interrupt/interrupts-by-dev.stp</a> - Record interrupts on a per-device basis.<br> +keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <br> +<p>The interrupts-by-dev.stp script profiles interrupts received by each device per 100 ms.</p></li> <li><a href="interrupt/scf.stp">interrupt/scf.stp</a> - Tally Backtraces for Inter-Processor Interrupt (IPI)<br> keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> <p>The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.</p></li> @@ -155,7 +158,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BAC <p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li> <li><a href="io/ioblktime.stp">io/ioblktime.stp</a> - Average Time Block IO Requests Spend in Queue <br> keywords: <a href="keyword-index.html#IO">IO</a> <br> -<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</p></li> +<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</p></li> <li><a href="io/iostat-scsi.stp">io/iostat-scsi.stp</a> - iostat for SCSI Devices<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword-index.html#SCSI">SCSI</a> <br> <p>The iostat-scsi.stp script provides a breakdown of the number of blks read and written on the machine's various SCSI devices. The script takes one argument which is the number of seconds between reports.</p></li> @@ -164,7 +167,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PRO <p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li> <li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <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 parentheses. 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> +<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 spent 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 parentheses. 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> keywords: <a href="keyword-index.html#IO">IO</a> <br> <p>Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.</p></li> @@ -182,7 +185,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#TTY <p>The ttyspy.stp script uses tty_audit hooks to monitor recent typing activity on the system, printing a scrolling record of recent keystrokes, on a per-tty basis.</p></li> <li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> -<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> +<p>The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> </ul> <h3><a name="LOCKING">LOCKING</a></h3> <ul> @@ -191,7 +194,7 @@ keywords: <a href="keyword-index.html#LOCKING">LOCKING</a> <br> <p>The bkl.stp script can help determine whether the Big Kernel Lock (BKL) is causing serialization on a multiprocessor system due to excessive contention of the BKL. The bkl.stp script takes one argument which is the number of processes waiting for the Big Kernel Lock (BKL). When the number of processes waiting for the BKL is reached or exceeded, the script will print a time stamp, the number of processes waiting for the BKL, the holder of the BKL, and the amount of time the BKL was held.</p></li> <li><a href="locks/bkl_stats.stp">locks/bkl_stats.stp</a> - Per Process Statistics on Big Kernel Lock (BKL) Use<br> keywords: <a href="keyword-index.html#LOCKING">LOCKING</a> <br> -<p>The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent holding the lock for each of the processes.</p></li> +<p>The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent in holding the lock for each of the processes.</p></li> <li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#LOCKING">LOCKING</a> <a href="keyword-index.html#FUTEX">FUTEX</a> <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> @@ -200,19 +203,19 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde <ul> <li><a href="memory/kmalloc-top">memory/kmalloc-top</a> - Show Paths to Kernel Malloc (kmalloc) Invocations<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).</p></li> +<p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be filtered to print only the first N stack traces (-t), stack traces with a minimum counts (-m), or exclude certain stack traces (-e).</p></li> <li><a href="memory/mmanonpage.stp">memory/mmanonpage.stp</a> - Track Virtual Memory System Actions on Anonymous Pages<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. Its useful in debugging leaks in the anonymous regions of a process.</p></li> +<p>The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. It's useful in debugging leaks in the anonymous regions of a process.</p></li> <li><a href="memory/mmfilepage.stp">memory/mmfilepage.stp</a> - Track Virtual Memory System Actions on File Backed Pages<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> <p>The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.</p></li> <li><a href="memory/mmreclaim.stp">memory/mmreclaim.stp</a> - Track Virtual Memory System Page Reclamation<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. Its useful is debugging performance problems that occur due to page reclamation.</p></li> +<p>The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. It's useful in debugging performance problems that occur due to page reclamation.</p></li> <li><a href="memory/mmwriteback.stp">memory/mmwriteback.stp</a> - Track Virtual Memory System Writing to Disk<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> -<p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. Its useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p></li> +<p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. It's useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p></li> <li><a href="memory/numa_faults.stp">memory/numa_faults.stp</a> - Summarize Process Misses across NUMA Nodes<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#NUMA">NUMA</a> <br> <p>The numa_faults.stp script tracks the read and write pages faults for each process. When the script exits it prints out the total read and write pages faults for each process. The script also provide a break down of page faults per node for each process. This script is useful for determining whether the program has good locality (page faults limited to a single node) on a NUMA computer.</p></li> @@ -254,7 +257,7 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p></li> <li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <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> +<p>The script instruments each of the functions in the Linux kernel's net/socket.c file. The script prints out trace data. 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="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br> <p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li> @@ -266,7 +269,7 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li> <li><a href="network/tcpipstat.stp">network/tcpipstat.stp</a> - Display network statistics for individual TCP sockets.<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#STATISTICS">STATISTICS</a> <br> -<p>tcpipstat collects and display network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simmer to that of the command netstat -s, only sorted and grouped by individual sockets.</p></li> +<p>tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets.</p></li> </ul> <h3><a name="NFS">NFS</a></h3> <ul> @@ -296,13 +299,13 @@ keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-inde <p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</p></li> <li><a href="process/forktracker.stp">process/forktracker.stp</a> - Trace Creation of Processes<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <br> -<p>The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes.</p></li> +<p>The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes.</p></li> <li><a href="process/plimit.stp">process/plimit.stp</a> - print resource limits<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <br> <p>The script prints a variety of resource limits for a given pid, like /proc/$$/limits on recent kernels.</p></li> <li><a href="process/schedtimes.stp">process/schedtimes.stp</a> - Track Time Processes Spend in Various States using Tracepoints<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br> -<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> +<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> </ul> <h3><a name="PROFILING">PROFILING</a></h3> <ul> @@ -335,7 +338,7 @@ keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br> <ul> <li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <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 parentheses. 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> +<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 spent 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 parentheses. 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> @@ -344,16 +347,16 @@ keywords: <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <br> <p>The chng_cpu.stp script takes an argument which is the executable name of the task it should monitor. Each time a task with that executable name is found running on a different processor, the script prints out the thread id (tid), the executable name, the processor now running the task, the thread state, and a backtrace showing the kernel functions that triggered the running of the task on the processor.</p></li> <li><a href="process/forktracker.stp">process/forktracker.stp</a> - Trace Creation of Processes<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <br> -<p>The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes.</p></li> +<p>The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes.</p></li> <li><a href="process/migrate.stp">process/migrate.stp</a> - Track the Migration of Specific Executables<br> keywords: <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <br> <p>The migrate.stp script takes an argument which is the executable name of the task it should monitor. Each time a task with that executable name migrates between processors an entry is printed with the process id (pid), the executable name, the processor off loading the task, and the process taking the task. Note that the task may or may not be executing at the time of the migration.</p></li> <li><a href="process/schedtimes.stp">process/schedtimes.stp</a> - Track Time Processes Spend in Various States using Tracepoints<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br> -<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> +<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> <li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br> keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br> -<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> +<p>The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li> </ul> <h3><a name="SCSI">SCSI</a></h3> <ul> @@ -371,7 +374,7 @@ keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <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> keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <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 destination executable and process ID, the executable name user ID that sent the signal.</p></li> +<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the destination executable and process ID, the executable name and user ID that sents the signal.</p></li> <li><a href="process/sigmon.stp">process/sigmon.stp</a> - Track a particular signal to a specific process<br> keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <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> @@ -392,7 +395,7 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde <ul> <li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <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> +<p>The script instruments each of the functions in the Linux kernel's net/socket.c file. The script prints out trace data. 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="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br> <p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li> @@ -401,13 +404,13 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <ul> <li><a href="network/tcpipstat.stp">network/tcpipstat.stp</a> - Display network statistics for individual TCP sockets.<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#STATISTICS">STATISTICS</a> <br> -<p>tcpipstat collects and display network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simmer to that of the command netstat -s, only sorted and grouped by individual sockets.</p></li> +<p>tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets.</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> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <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 parentheses. 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> +<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 spent 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 parentheses. 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/errsnoop.stp">process/errsnoop.stp</a> - tabulate system call errors<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br> <p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</p></li> @@ -440,10 +443,10 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <ul> <li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <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 parentheses. 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> +<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 spent 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 parentheses. 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/schedtimes.stp">process/schedtimes.stp</a> - Track Time Processes Spend in Various States using Tracepoints<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br> -<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> +<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> </ul> <h3><a name="TRACE">TRACE</a></h3> <ul> @@ -461,7 +464,7 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde <p>Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.</p></li> <li><a href="process/schedtimes.stp">process/schedtimes.stp</a> - Track Time Processes Spend in Various States using Tracepoints<br> keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br> -<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> +<p>The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.</p></li> </ul> <h3><a name="TRAFFIC">TRAFFIC</a></h3> <ul> @@ -497,7 +500,7 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde <ul> <li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br> keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <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 parentheses. 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> +<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 spent 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 parentheses. 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> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 6de9c330..d224d4ef 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -33,7 +33,7 @@ keywords: io backtrace process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations keywords: io scheduler backtrace - The script monitors the time that threads spend waiting for IO + The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay. @@ -198,6 +198,13 @@ keywords: filesystem hack = INTERRUPT = +interrupt/interrupts-by-dev.stp - Record interrupts on a per-device basis. +keywords: interrupt + + The interrupts-by-dev.stp script profiles interrupts received by each + device per 100 ms. + + interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI) keywords: interrupt backtrace @@ -223,9 +230,9 @@ keywords: io The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the - average time waiting time for block IO per device and prints list - every 10 seconds. In some cases there can be too many outstanding - block IO operations and the script may exceed the default number of + average waiting time for block IO per device and prints list every 10 + seconds. In some cases there can be too many outstanding block IO + operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. @@ -255,7 +262,7 @@ 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 + amount of wall clock time spent 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 @@ -305,7 +312,7 @@ keywords: io tty per-process monitor process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations keywords: io scheduler backtrace - The script monitors the time that threads spend waiting for IO + The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay. @@ -337,7 +344,7 @@ keywords: locking waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the - time spent holding the lock for each of the processes. + time spent in holding the lock for each of the processes. process/futexes.stp - System-Wide Futex Contention @@ -357,9 +364,9 @@ keywords: memory The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it - prints out sorted list. The output can be be filtered to print only - only the first stack traces (-t) stack traces with more a minimum - counts (-m), or exclude certain stack traces (-e). + prints out sorted list. The output can be filtered to print only the + first N stack traces (-t), stack traces with a minimum counts (-m), + or exclude certain stack traces (-e). memory/mmanonpage.stp - Track Virtual Memory System Actions on Anonymous Pages @@ -371,7 +378,7 @@ keywords: memory the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the - script is active. Its useful in debugging leaks in the anonymous + script is active. It's useful in debugging leaks in the anonymous regions of a process. @@ -392,7 +399,7 @@ keywords: memory The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that - occurred while the script was running. Its useful is debugging + occurred while the script was running. It's useful in debugging performance problems that occur due to page reclamation. @@ -402,8 +409,8 @@ keywords: memory The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is - running. Its useful in determining where writes are coming from on a - supposedly idle system that is experiencing unexpected IO. + running. It's useful in determining where writes are coming from on + a supposedly idle system that is experiencing unexpected IO. memory/numa_faults.stp - Summarize Process Misses across NUMA Nodes @@ -501,12 +508,12 @@ keywords: network tcp buffer memory network/socket-trace.stp - Trace Functions called in Network Socket Code 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. + The script instruments each of the functions in the Linux kernel's + net/socket.c file. The script prints out trace data. 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. network/tcp_connections.stp - Track Creation of Incoming TCP Connections @@ -538,9 +545,9 @@ keywords: network traffic network/tcpipstat.stp - Display network statistics for individual TCP sockets. keywords: network statistics - tcpipstat collects and display network statistics related to + tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are - collected are simmer to that of the command netstat -s, only sorted + collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets. @@ -601,7 +608,7 @@ process/forktracker.stp - Trace Creation of Processes keywords: process scheduler The forktracker.stp script prints out a time-stamped entry showing - each fork and exec operation on the machine. This can be useful for + each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes. @@ -616,10 +623,11 @@ process/schedtimes.stp - Track Time Processes Spend in Various States using Trac keywords: process scheduler time tracepoint The schedtimes.stp script instruments the scheduler to track the - amount of time that each process spends running, sleeping, queued, - and waiting for io. On exit the script prints out the accumulated - time for each state of processes observed. Optionally, this script - can be used with the '-c' or '-x' options to focus on a specific PID. + amount of time that each process spends in running, sleeping, + queuing, and waiting for io. On exit the script prints out the + accumulated time for each state of processes observed. Optionally, + this script can be used with the '-c' or '-x' options to focus on a + specific PID. = PROFILING = @@ -709,7 +717,7 @@ 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 + amount of wall clock time spent 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 @@ -738,7 +746,7 @@ process/forktracker.stp - Trace Creation of Processes keywords: process scheduler The forktracker.stp script prints out a time-stamped entry showing - each fork and exec operation on the machine. This can be useful for + each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes. @@ -757,16 +765,17 @@ process/schedtimes.stp - Track Time Processes Spend in Various States using Trac keywords: process scheduler time tracepoint The schedtimes.stp script instruments the scheduler to track the - amount of time that each process spends running, sleeping, queued, - and waiting for io. On exit the script prints out the accumulated - time for each state of processes observed. Optionally, this script - can be used with the '-c' or '-x' options to focus on a specific PID. + amount of time that each process spends in running, sleeping, + queuing, and waiting for io. On exit the script prints out the + accumulated time for each state of processes observed. Optionally, + this script can be used with the '-c' or '-x' options to focus on a + specific PID. process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations keywords: io scheduler backtrace - The script monitors the time that threads spend waiting for IO + The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay. @@ -801,8 +810,8 @@ 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 - destination executable and process ID, the executable name user ID - that sent the signal. + destination executable and process ID, the executable name and user + ID that sents the signal. process/sigmon.stp - Track a particular signal to a specific process @@ -841,12 +850,12 @@ keywords: syscall sleep network/socket-trace.stp - Trace Functions called in Network Socket Code 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. + The script instruments each of the functions in the Linux kernel's + net/socket.c file. The script prints out trace data. 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. network/tcp_connections.stp - Track Creation of Incoming TCP Connections @@ -864,9 +873,9 @@ keywords: network tcp socket network/tcpipstat.stp - Display network statistics for individual TCP sockets. keywords: network statistics - tcpipstat collects and display network statistics related to + tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are - collected are simmer to that of the command netstat -s, only sorted + collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets. @@ -877,7 +886,7 @@ 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 + amount of wall clock time spent 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 @@ -971,7 +980,7 @@ 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 + amount of wall clock time spent 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 @@ -986,10 +995,11 @@ process/schedtimes.stp - Track Time Processes Spend in Various States using Trac keywords: process scheduler time tracepoint The schedtimes.stp script instruments the scheduler to track the - amount of time that each process spends running, sleeping, queued, - and waiting for io. On exit the script prints out the accumulated - time for each state of processes observed. Optionally, this script - can be used with the '-c' or '-x' options to focus on a specific PID. + amount of time that each process spends in running, sleeping, + queuing, and waiting for io. On exit the script prints out the + accumulated time for each state of processes observed. Optionally, + this script can be used with the '-c' or '-x' options to focus on a + specific PID. = TRACE = @@ -1026,10 +1036,11 @@ process/schedtimes.stp - Track Time Processes Spend in Various States using Trac keywords: process scheduler time tracepoint The schedtimes.stp script instruments the scheduler to track the - amount of time that each process spends running, sleeping, queued, - and waiting for io. On exit the script prints out the accumulated - time for each state of processes observed. Optionally, this script - can be used with the '-c' or '-x' options to focus on a specific PID. + amount of time that each process spends in running, sleeping, + queuing, and waiting for io. On exit the script prints out the + accumulated time for each state of processes observed. Optionally, + this script can be used with the '-c' or '-x' options to focus on a + specific PID. = TRAFFIC = @@ -1097,7 +1108,7 @@ 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 + amount of wall clock time spent 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 diff --git a/testsuite/systemtap.examples/locks/bkl_stats.meta b/testsuite/systemtap.examples/locks/bkl_stats.meta index 16ac2911..e8080bf4 100644 --- a/testsuite/systemtap.examples/locks/bkl_stats.meta +++ b/testsuite/systemtap.examples/locks/bkl_stats.meta @@ -8,7 +8,7 @@ status: production exit: user-controlled output: sorted-list scope: system-wide -description: The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent holding the lock for each of the processes. +description: The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent in holding the lock for each of the processes. test_support: stap -l 'kernel.function("lock_kernel").return' test_check: stap -p4 bkl_stats.stp test_installcheck: stap bkl_stats.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/locks/bkl_stats.stp b/testsuite/systemtap.examples/locks/bkl_stats.stp index 4481e493..4a8eba6d 100755 --- a/testsuite/systemtap.examples/locks/bkl_stats.stp +++ b/testsuite/systemtap.examples/locks/bkl_stats.stp @@ -11,12 +11,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Print out the amount of time spent in the read and write systemcall - * when a process closes each file is closed. Note that the systemtap - * script needs to be running before the open operations occur for - * the script to record data. - * - * Description: displays statisics for waiting and holding big kernel lock (BKL) + * Description: displays statistics for waiting and holding big kernel lock (BKL) * * Run: stap bkl_stats.stap * @@ -73,11 +68,10 @@ probe kernel.function("lock_kernel").return { } probe kernel.function("unlock_kernel") { - # record the amount of time the process held the lock t = gettimeofday_us() s = holder_time[tid()] holder_time[tid()] = t - # record the amount of time waiting for the lock + # record the amount of time the process held the lock if (s) { holder_stats[tid()] <<< t - s names[tid()] = execname() diff --git a/testsuite/systemtap.examples/memory/kmalloc-top.meta b/testsuite/systemtap.examples/memory/kmalloc-top.meta index f4c2a9d1..6388c3e1 100644 --- a/testsuite/systemtap.examples/memory/kmalloc-top.meta +++ b/testsuite/systemtap.examples/memory/kmalloc-top.meta @@ -8,6 +8,6 @@ status: production exit: user-controlled output: sorted-list scope: system-wide -description: The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e). +description: The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be filtered to print only the first N stack traces (-t), stack traces with a minimum counts (-m), or exclude certain stack traces (-e). test_check: ./kmalloc-top -o "-p4" -c "sleep 0" test_installcheck: ./kmalloc-top -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/memory/mmanonpage.meta b/testsuite/systemtap.examples/memory/mmanonpage.meta index 96ddd3a3..5e5cb843 100644 --- a/testsuite/systemtap.examples/memory/mmanonpage.meta +++ b/testsuite/systemtap.examples/memory/mmanonpage.meta @@ -8,7 +8,7 @@ status: experimental exit: user-controlled output: sorted-list scope: system-wide -description: The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. Its useful in debugging leaks in the anonymous regions of a process. +description: The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active. It's useful in debugging leaks in the anonymous regions of a process. test_support: stap -l 'kernel.trace("mm_page_allocation"),kernel.trace("mm_page_free"),kernel.trace("mm_anon_fault"),kernel.trace("mm_anon_pgin"),kernel.trace("mm_anon_cow"),kernel.trace("mm_anon_unmap"),kernel.trace("mm_anon_userfree")' test_check: stap -p4 mmanonpage.stp test_installcheck: stap mmanonpage.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/memory/mmreclaim.meta b/testsuite/systemtap.examples/memory/mmreclaim.meta index 4b5c9de2..a2828574 100644 --- a/testsuite/systemtap.examples/memory/mmreclaim.meta +++ b/testsuite/systemtap.examples/memory/mmreclaim.meta @@ -8,7 +8,7 @@ status: experimental exit: user-controlled output: sorted-list scope: system-wide -description: The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. Its useful is debugging performance problems that occur due to page reclamation. +description: The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. It's useful in debugging performance problems that occur due to page reclamation. test_support: stap -l 'kernel.trace("mm_directreclaim_reclaimall"),kernel.trace("mm_pagereclaim_shrinkinactive"),kernel.trace("mm_pagereclaim_free"),kernel.trace("mm_pagereclaim_pgout"),kernel.trace("mm_pagereclaim_shrinkactive_a2a"),kernel.trace("mm_pagereclaim_shrinkinactive_i2a"),kernel.trace("mm_pagereclaim_shrinkactive_a2i"),kernel.trace("mm_pagereclaim_shrinkinactive_i2i")' test_check: stap -p4 mmreclaim.stp test_installcheck: stap mmreclaim.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/memory/mmwriteback.meta b/testsuite/systemtap.examples/memory/mmwriteback.meta index 76cc53a7..62b52cf9 100644 --- a/testsuite/systemtap.examples/memory/mmwriteback.meta +++ b/testsuite/systemtap.examples/memory/mmwriteback.meta @@ -8,7 +8,7 @@ status: experimental exit: user-controlled output: sorted-list scope: system-wide -description: The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. Its useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO. +description: The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running. It's useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO. test_support: stap -l 'kernel.trace("mm_pdflush_bgwriteout"),kernel.trace("mm_pdflush_kupdate"),kernel.trace("mm_pagereclaim_pgout")' test_check: stap -p4 mmwriteback.stp test_installcheck: stap mmwriteback.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/network/socket-trace.meta b/testsuite/systemtap.examples/network/socket-trace.meta index f73731b5..83af903c 100644 --- a/testsuite/systemtap.examples/network/socket-trace.meta +++ b/testsuite/systemtap.examples/network/socket-trace.meta @@ -8,6 +8,6 @@ status: production exit: user-controlled output: trace scope: system-wide -description: 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. +description: The script instruments each of the functions in the Linux kernel's net/socket.c file. The script prints out trace data. 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. test_check: stap -p4 socket-trace.stp test_installcheck: stap socket-trace.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/network/tcpipstat.meta b/testsuite/systemtap.examples/network/tcpipstat.meta index 9e97ea5b..59cddaa8 100644 --- a/testsuite/systemtap.examples/network/tcpipstat.meta +++ b/testsuite/systemtap.examples/network/tcpipstat.meta @@ -9,7 +9,7 @@ exit: user-controlled output: timed scope: per-socket arg_[0-9]+: tcpstat.stp [index=laddr|raddr|lport|rport|tuple] [timeout=<N sec>] [nozeros=1|0] [filters...] -description: tcpipstat collects and display network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simmer to that of the command netstat -s, only sorted and grouped by individual sockets. +description: tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets. test_support: stap -l 'tcpmib.InSegs' test_check: stap -p4 tcpipstat.stp test_installcheck: stap tcpipstat.stp timeout=1 diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp index a3f17b77..4ad4ea1b 100755 --- a/testsuite/systemtap.examples/process/errsnoop.stp +++ b/testsuite/systemtap.examples/process/errsnoop.stp @@ -1,5 +1,4 @@ -#!/bin/sh -//usr/bin/env stap -DMAXMAPENTRIES=20480 $0 $@; exit $? +#!/usr/bin/env stap -DMAXMAPENTRIES=20480 $0 $@; exit $? # errsnoop.stp # Copyright (C) 2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com> # diff --git a/testsuite/systemtap.examples/process/forktracker.meta b/testsuite/systemtap.examples/process/forktracker.meta index 2ba3a659..21c5bc29 100644 --- a/testsuite/systemtap.examples/process/forktracker.meta +++ b/testsuite/systemtap.examples/process/forktracker.meta @@ -8,6 +8,6 @@ status: production exit: user-controlled output: trace scope: system-wide -description: The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes. +description: The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes. test_check: stap -p4 forktracker.stp test_installcheck: stap forktracker.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/process/forktracker.stp b/testsuite/systemtap.examples/process/forktracker.stp index 525aa0a5..f892ce17 100755 --- a/testsuite/systemtap.examples/process/forktracker.stp +++ b/testsuite/systemtap.examples/process/forktracker.stp @@ -1,7 +1,7 @@ #! /usr/bin/env stap # # This is a stap script to monitor process creations (fork(), exec()'s). -# Based off of stap script found: http://picobot.org/wordpress/?p=27 +# Based on stap script found: http://picobot.org/wordpress/?p=27 # With some minor modifications (i.e. timestamping) # # Usage: stap forktracker.stp diff --git a/testsuite/systemtap.examples/process/schedtimes.meta b/testsuite/systemtap.examples/process/schedtimes.meta index 5315042a..9386a3e8 100644 --- a/testsuite/systemtap.examples/process/schedtimes.meta +++ b/testsuite/systemtap.examples/process/schedtimes.meta @@ -8,7 +8,7 @@ status: production exit: user-controlled output: sorted-list scope: system-wide -description: The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID. +description: The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID. test_support: stap -l 'kernel.trace("sched_switch"),kernel.trace("sched_wakeup")' test_check: stap -p4 schedtimes.stp test_installcheck: stap schedtimes.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/process/sigkill.meta b/testsuite/systemtap.examples/process/sigkill.meta index b9c83f15..fed49a05 100644 --- a/testsuite/systemtap.examples/process/sigkill.meta +++ b/testsuite/systemtap.examples/process/sigkill.meta @@ -8,7 +8,7 @@ status: production exit: user-controlled output: trace scope: systemwide -description: The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the destination executable and process ID, the executable name user ID that sent the signal. +description: The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the destination executable and process ID, the executable name and user ID that sents the signal. arg_1: The name of the signal to look for on selected process. test_check: stap -p4 sigkill.stp test_installcheck: stap sigkill.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/process/sleepingBeauties.meta b/testsuite/systemtap.examples/process/sleepingBeauties.meta index b2692ba0..693a7789 100644 --- a/testsuite/systemtap.examples/process/sleepingBeauties.meta +++ b/testsuite/systemtap.examples/process/sleepingBeauties.meta @@ -2,6 +2,6 @@ title: Generating Backtraces of Threads Waiting for IO Operations name: sleepingBeauties.stp keywords: io scheduler backtrace subsystem: scheduler -description: The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay. +description: The script monitors the time that threads spend in waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay. test_check: stap -p4 sleepingBeauties.stp test_installcheck: stap sleepingBeauties.stp -c "sleep 0.2" diff --git a/testsuite/systemtap.examples/process/sleepingBeauties.stp b/testsuite/systemtap.examples/process/sleepingBeauties.stp index 64c563a3..143fbe1c 100755 --- a/testsuite/systemtap.examples/process/sleepingBeauties.stp +++ b/testsuite/systemtap.examples/process/sleepingBeauties.stp @@ -1,4 +1,4 @@ -#! /usr/bin/stap +#! /usr/bin/env stap function time () { return gettimeofday_ms() } global time_name = "ms" diff --git a/testsuite/systemtap.examples/process/wait4time.stp b/testsuite/systemtap.examples/process/wait4time.stp index 2fd914b9..3e374b14 100755 --- a/testsuite/systemtap.examples/process/wait4time.stp +++ b/testsuite/systemtap.examples/process/wait4time.stp @@ -11,10 +11,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Print out the amount of time spent in the read and write systemcall - * when a process closes each file is closed. Note that the script needs - * to be running before the open operations occur for the script - * to record data. + * Print out the time spent in wait4 systemcall * * Format is: * timestamp pid (executabable) wait4: time_us pid diff --git a/testsuite/systemtap.examples/profiling/latencytap.stp b/testsuite/systemtap.examples/profiling/latencytap.stp index d202ec81..7fdbbc4e 100755 --- a/testsuite/systemtap.examples/profiling/latencytap.stp +++ b/testsuite/systemtap.examples/profiling/latencytap.stp @@ -1,4 +1,4 @@ -#! /usr/bin/stap -g +#! /usr/bin/env stap # Record the time that a process has spent asleep, and in what function @@ -7,8 +7,7 @@ global sleep_time global process_names global sleep_agg -function _get_sleep_time:long(rq_param:long, p_param:long) -%{ +function _get_sleep_time:long(rq_param:long, p_param:long) %{ /* pure */ struct rq *rq = (struct rq *)(unsigned long)THIS->rq_param; struct task_struct *p = (struct task_struct *)(unsigned long)THIS->p_param; struct sched_entity *se = &p->se; @@ -19,9 +18,8 @@ function _get_sleep_time:long(rq_param:long, p_param:long) THIS->__retvalue = delta; %} -# Get the backtrace from an arbitrary task -function task_backtrace:string (task:long) -%{ +# Get the backtrace from an arbitrary task +function task_backtrace:string (task:long) %{ /* pure */ _stp_stack_snprint_tsk(THIS->__retvalue, MAXSTRINGLEN, (struct task_struct *)(unsigned long)THIS->task, 0, MAXTRACE); %} diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp index 12275c1d..a9f16a8b 100644 --- a/testsuite/systemtap.pass1-4/buildok.exp +++ b/testsuite/systemtap.pass1-4/buildok.exp @@ -6,11 +6,7 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { # some tests are known to fail. switch $test { buildok/perfmon01.stp {setup_kfail 909 *-*-*} - buildok/twentyseven.stp {setup_kfail 4166 *-*-*} - buildok/sched_test.stp {setup_kfail 1155 *-*-*} - buildok/process_test.stp {setup_kfail 1155 *-*-*} buildok/rpc-all-probes.stp {setup_kfail 4413 *-*-*} - buildok/nfs-all-probes.stp {setup_kfail 4413 *-*-*} buildok/per-process-syscall.stp {if {![utrace_p]} { setup_kfail 9999 *-*-*} } } if {$rc == 0} { pass $test } else { fail $test } diff --git a/translate.cxx b/translate.cxx index cbb8f1e3..03f7c86a 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1172,6 +1172,8 @@ c_unparser::emit_module_init () // PR10228: set up symbol table-related task finders. o->newline() << "#if defined(STP_NEED_VMA_TRACKER)"; o->newline() << "_stp_sym_init();"; + o->newline() << "#else"; + o->newline() << "if (_stp_need_vma_tracker == 1) _stp_sym_init();"; o->newline() << "#endif"; // NB: we don't need per-_stp_module task_finders, since a single common one // set up in runtime/sym.c's _stp_sym_init() will scan through all _stp_modules. @@ -2609,7 +2611,7 @@ c_unparser::visit_foreach_loop (foreach_loop *s) // @count instead for aggregates. '-5' tells the // runtime to sort by count. if (s->sort_column == 0) - sort_column = -5; + sort_column = -5; /* runtime/map.c SORT_COUNT */ else sort_column = s->sort_column; @@ -5023,6 +5025,11 @@ emit_symbol_data_done (unwindsym_dump_context *ctx, systemtap_session& s) ctx->output << "0x" << hex << ctx->stp_kretprobe_trampoline_addr << dec << ";\n"; + // Note when someone requested the task_finder. + ctx->output << "static char _stp_need_vma_tracker = " + << (s.task_finder_derived_probes ? "1" : "0") + << ";\n"; + // Some nonexistent modules may have been identified with "-d". Note them. if (! s.suppress_warnings) for (set<string>::iterator it = ctx->undone_unwindsym_modules.begin(); |