From: Alan Maguire <alan.maguire@oracle.com>
To: dtrace@lists.linux.dev
Cc: dtrace-devel@oss.oracle.com, Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v3 9/9] documentation: update stapsdt docs to describe wildcard support
Date: Tue, 13 Jan 2026 16:51:32 +0000 [thread overview]
Message-ID: <20260113165132.2454591-10-alan.maguire@oracle.com> (raw)
In-Reply-To: <20260113165132.2454591-1-alan.maguire@oracle.com>
We now have a limited form of wildcard support; document it.
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
.../reference/dtrace_providers_stapsdt.md | 54 ++++++++++++++++++-
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/doc/userguide/reference/dtrace_providers_stapsdt.md b/doc/userguide/reference/dtrace_providers_stapsdt.md
index cb6ce71f..b91a9d23 100644
--- a/doc/userguide/reference/dtrace_providers_stapsdt.md
+++ b/doc/userguide/reference/dtrace_providers_stapsdt.md
@@ -52,12 +52,25 @@ DTrace will pass semaphore details to the kernel for reference counting.)
The `stapsdt` provider also supports probes created dynamically via `libstapsdt`.
See [https://github.com/linux-usdt/libstapsdt](https://github.com/linux-usdt/libstapsdt).
-In your D scripts, the provider name must have the pid for your process
+In your D scripts, two forms of provider specification are supported.
+
+In the first, the provider name must have the pid for your process
appended. For the provider shown above, you might have `myprovider12345` for
-pid 12345. No wildcard may be used, but a symbolic value like `$target` may.
+pid 12345. A symbolic value like `$target` may be used also.
+
+In the second approach, a wildcard may be used, but it must be used
+in combination with the path or name of binary or library. In the case
+where only a binary or library name is specified, DTrace will use
+PATH or LD_LIBRARY_PATH to find the absolute path and add instrumentation.
+Probes are added on a file basis, so it is vital to specify the correct
+file that contains the probe; unlike in the per-process case we need to
+know if a probe is delivered in a library or in a program for example.
In your D scripts, the `stapsdt` module name may be `a.out`, just as with
the [`pid` provider](dtrace_providers_pid.md#dt_ref_pidprobes_prov).
+However as noted above, for a wildcarded pid a filename discoverable
+via PATH or LD_LIBRARY_PATH must be specified so that DTrace can find
+the file to instrument.
In probe names, two consecutive underscores \(`__`\) become a dash \(`-`\)
just as with USDT probe names. For example, if a probe is defined in source
@@ -147,6 +160,13 @@ Displaying notes found in: .note.stapsdt
Arguments: -4@-4(%rbp) 8@%rax -4@$18
```
+Alternatively we can list the probes in the object via DTrace
+provided we know the provider name:
+
+```
+$ dtrace -lm 'myprovider*:/path2/a.out'
+```
+
Notice that the instrumented source code includes the header file
`<sys/sdt.h>`. On Oracle Linux, this file is installed
by the RPM package `systemtap-sdt-devel`, but the package also
@@ -154,6 +174,36 @@ installs `/usr/bin/dtrace`. So be sure to have `/usr/sbin`
in front of `/usr/bin` in your path, or explicitly specify
`/usr/sbin/dtrace` whenever you want to use `dtrace`.
+We can also specify systemwide probes for tracing; for example when
+Python 3 is built `--with-dtrace` we can do the following to show the top 5
+function-entry calls system-wide:
+
+```
+$ sudo dtrace -qn 'python*:libpython3.6m.so::function-entry {
+ @c[execname,stringof(arg0),stringof(arg1)] = count();
+}
+END {
+ trunc(@c, 5);
+ printf("%10s %35s %20s %10s\n", "PROG", "FILE", "FUNC", "COUNT");
+ printa("%10s %35s %20s %@10d\n", @c);
+}'
+^C
+ PROG FILE FUNC COUNT
+ tuned /usr/lib64/python3.6/threading.py __exit__ 5
+ tuned /usr/lib64/python3.6/threading.py _acquire_restore 5
+ tuned /usr/lib64/python3.6/threading.py _is_owned 5
+ tuned /usr/lib64/python3.6/threading.py _release_save 5
+ tuned /usr/lib64/python3.6/threading.py wait 10
+```
+
+So we see the top 5 functions called were all called by `tuned`.
+
+We specified `libpython.3.6m.so` because that is where the probes are
+defined; in some cases they are in the python3 program itself, and cavets
+mentioned above about identifying whether probes are in a library or a
+program (in this case libypthon3.6.m.so or python3.6) apply. To determine
+probe location we can use `dtrace -lm` as described above.
+
## stapsdt Stability <a id="dt_ref_stapsdtstab_prov">
The `stapsdt` provider uses DTrace's stability mechanism to describe its stabilities.
--
2.43.5
next prev parent reply other threads:[~2026-01-13 16:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 16:51 [PATCH v3 0/9] stapsdt provider: simple system-wide probing Alan Maguire
2026-01-13 16:51 ` [PATCH v3 1/9] dt_lex: support '/' in probe descriptors Alan Maguire
2026-01-15 22:48 ` Kris Van Hees
2026-01-16 10:14 ` Alan Maguire
2026-01-13 16:51 ` [PATCH v3 2/9] stapsdt provider: support systemwide probing Alan Maguire
2026-01-13 16:51 ` [PATCH v3 3/9] test: add systemwide stapsdt note test Alan Maguire
2026-01-13 16:51 ` [PATCH v3 4/9] test: add systemwide stapsdt note test using absolute path Alan Maguire
2026-01-13 16:51 ` [PATCH v3 5/9] test: add systemwide stapsdt note test for library Alan Maguire
2026-01-13 16:51 ` [PATCH v3 6/9] stapsdt: add test for listing systemwide probes in object Alan Maguire
2026-01-13 16:51 ` [PATCH v3 7/9] stapsdt: add test for listing systemwide probes in absolute path object Alan Maguire
2026-01-13 16:51 ` [PATCH v3 8/9] stapsdt: add systemwide test for is-enabled probes Alan Maguire
2026-01-13 16:51 ` Alan Maguire [this message]
2026-01-16 14:48 ` [PATCH v3 0/9] stapsdt provider: simple system-wide probing Kris Van Hees
2026-01-16 15:10 ` Alan Maguire
2026-01-16 15:33 ` Kris Van Hees
2026-01-16 15:36 ` Alan Maguire
2026-01-16 16:22 ` Kris Van Hees
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260113165132.2454591-10-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox