summaryrefslogtreecommitdiffstats
path: root/runtime/sym.c
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-09-08 20:23:42 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-09-08 20:36:53 -0400
commit89ba308506249736c6d0c8490d3c897af4e42df8 (patch)
tree2d381ed9dbae2be8daaa37257986e785709b1fc9 /runtime/sym.c
parentd1292e962e1207cddf686a0196effa6bc8f6a217 (diff)
downloadsystemtap-steved-89ba308506249736c6d0c8490d3c897af4e42df8.tar.gz
systemtap-steved-89ba308506249736c6d0c8490d3c897af4e42df8.tar.xz
systemtap-steved-89ba308506249736c6d0c8490d3c897af4e42df8.zip
PR10524: reduce massive-uprobe script modules' .data consumption
The general approach is to rip out task_finder_tgt's from all over the place (including the unwindsym vmcbs, and the stap_uprobe_specs), and instead have a small handful of them: one for all unwindsyms, and one per abstract probed process (PID or NAME). These are in turn shared by all new stap_unwind_specs by index. Before: probe process("./stap").function("*") -rw-r--r--. 1 fche users 11775283 2009-09-08 20:26 /var/tmp/fche/systemtap/cache/96/stap_96c0479d674db55ec98d8a8750a790e7_7989596.ko text data bss dec hex filename 445158 8351944 4306472 13103574 c7f1d6 /var/tmp/fche/systemtap/cache/96/stap_96c0479d674db55ec98d8a8750a790e7_7989596.ko After: (Note how data shrank, though text gained a bit in const-init-data.) -rw-r--r--. 1 fche users 4021569 2009-09-08 20:27 /var/tmp/fche/systemtap/cache/e4/stap_e46e88634efd850b1586e81c231c239a_8058419.ko text data bss dec hex filename 1896511 2192 4324808 6223511 5ef697 /var/tmp/fche/systemtap/cache/e4/stap_e46e88634efd850b1586e81c231c239a_8058419.ko * tapsets.cxx (uprobe_derived_probe_group): Rewrite emit_module_decls, and adjust emit_module_init. * runtime/sym.c (_stp_sym_init): Initialize unwindsyms-shared vmcb. * runtime/sym.h (_stp_module): Remove *vmcb field. * translate.cxx (emit_module_init, dump_unwindsyms): Adapt. * translate.h (assert_0_indent): Flush output before possibly assert-failing.
Diffstat (limited to 'runtime/sym.c')
-rw-r--r--runtime/sym.c55
1 files changed, 40 insertions, 15 deletions
diff --git a/runtime/sym.c b/runtime/sym.c
index 856ccbcc..0baa1a5e 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -16,21 +16,6 @@
#include "string.c"
#include "task_finder_vma.c"
-/** @file sym.c
- * @addtogroup sym Symbolic Functions
- * Symbolic Lookup Functions
- * @{
- */
-
-static void _stp_sym_init(void)
-{
- static int initialized = 0;
- if (! initialized) {
- __stp_tf_vma_initialize();
- initialized = 1;
- }
-}
-
/* Callback that needs to be registered (in
session.unwindsyms_modules) for every user task path for which we
might need symbols or unwind info. */
@@ -409,4 +394,44 @@ static void _stp_symbol_snprint(char *str, size_t len, unsigned long address,
}
/** @} */
+
+
+/** @file sym.c
+ * @addtogroup sym Symbolic Functions
+ * Symbolic Lookup Functions
+ * @{
+ */
+static void _stp_sym_init(void)
+{
+ // NB: it's too "early" to make this conditional on STP_NEED_VMA_TRACKER,
+ // since we're #included at the top of the generated module, before any
+ // tapset-induced #define's.
+#if defined(CONFIG_UTRACE)
+ static int initialized = 0;
+ static struct stap_task_finder_target vmcb = {
+ // NB: no .pid, no .procname filters here.
+ // This means that we get a system-wide mmap monitoring
+ // widget while the script is running. (The system-wideness may
+ // be restricted by stap -c or -x.) But this seems to
+ // be necessary if we want to to stack tracebacks through arbitrary
+ // shared libraries. XXX: There may be an optimization opportunity
+ // for executables (for which the main task-finder callback should be
+ // sufficient).
+ .mmap_callback = &_stp_tf_mmap_cb,
+ .munmap_callback = &_stp_tf_munmap_cb,
+ };
+ if (! initialized) {
+ int rc;
+ __stp_tf_vma_initialize();
+ rc = stap_register_task_finder_target (& vmcb);
+#ifdef DEBUG_TASK_FINDER_VMA
+ _stp_dbug(__FUNCTION__, __LINE__, "registered vmcb");
+#endif
+ (void) rc; // XXX
+ initialized = 1;
+ }
+#endif
+}
+
+
#endif /* _STP_SYM_C_ */