From Fedora Project Wiki

< Features

Revision as of 11:34, 11 February 2010 by Mjw (talk | contribs) (Move python status into scope)

Systemtap Static Probes


Systemtap allows event tracing of programs when they have static probes inserted. This allows for tracing specifics of an application on a higher level that is meaningful to the application user so they don't have to know the exact source code details for tracing what is happening.


  • email:

Current status

  • Targeted release: Fedora 13
  • Last updated: 11 Feb 2009
  • Percentage of completion: 75%, in a testable state for java, python and postresql, needs work for other targets (could reduce scope to just those ready).
  • systemtap-sdt-devel 1.1 is now available.
  • java (since 1:1.6.0-21.b16 and since 34.b17 also jni and jstack support), postgresql (since 8.3.6-4) and python (2.6.4-19) have had static probes enabled.
  • Tracking bug:
  • See under scope for individual package status.


  • Some experiments showed some greater than expected impact on performance in the dormant case. So for each package identified we need to do some benchmarking to make sure there is zero overhead in to normal case. (Add any relevants benchmarks to the scopes section under the relevant package please).


  • Identified deficiencies upstream:
 * [PR10013] support ENABLED sdt probe macro - Fixed in 1.1
 * [PR10601] user-space deref/registers in loc2c (i386 mainly, but could affect x86_64 and other arches also) - Fixed in 1.1

Detailed Description

By packaging a new version of systemtap, that enables programs that already have static dtrace probe markers in their sources and by making those packages build depend on the new systemtap-sdt-devel package and recompiling them with probe points enabled, users of those packages will be able to trace any high level events that these packages provide.

Benefit to Fedora

It will be easier for developers and users to observe what is really happening on their system on a higher (application) level.


  • Work with upstream to identify any issues with the new capabilities while we activate probes in packages.
  • Package new version of Systemtap (including new subpackage systemtap-sdt-devel).
  • Identify packages that already include static user probes (see below)
  • Work with package maintainer to enable them in the Fedora build spec file.
  • Add documentation on enabled probes and how to use them with a systemtap tapset.

Currently identified packages:


Tracking bug: Already able to build something that works with current rpm. Documentation: upstream docs Example: example trace Screencast: video presentation


  • Need tweaks to systemtap to gen proper header from .d file (should be fixed with systemtap 1.1 package).
  • Add patch from upstream docs


Tracking bug:

  • upstream docs
  • Static probes ready, plus hotspot tapset, jni tapset and java backtraces all done..


Tracking bug:


Tracking bug:


  • mysql 6.0.8: really new alpha version from has probes. However, the version in fedora 5.0.67 doesn't. A backport would be required. Won't be in next fedora


  • apachetop-0.12.6 (newer httpd have patches directly [1] - note needs some build tweaking)


perl-5.10.0: implemented as an out-of-tree patch to the core (5.10.1 has some, see INSTALL)


Ideas for python probes:

  • function calls/returns (this is what the dtrace probe has)
  • GIL events: instrument the raw function to claim/release of the lock, then capture the times at which it happens, then render stats
  • threads starting/stopping
  • bytecode execution metrics: e.g. trace individual bytecodes; how often does LOAD_GLOBAL get invoked
  • exceptions being thrown
  • unhandled exceptions
  • arenas being claimed/freed
  • dictionaries switching to inefficient form:
  • _warnings.c: do_warn() (e.g. whole-system python3 warnings for all python 2 running on your system)
  • py-level backtraces
    • DONE: Latest build of Python 2 is python-2.6.4-19.fc13 with:
      • a tapset providing these probepoints:
        • python.function.entry
        • python.function.return
      • built with a systemtap patch that adds the static markers that implement the above to the libpython2.6 shared library
      • contains an example of usage added to docs in python-libs subpackage, logging all Python 2 function calls/return hierarchically across the whole system or for one process
      • dmalcolm has tested the example script on a rawhide box and verified that it works on i686.
      • dmalcolm has done initial testing of the performance of the patch, initial indications suggest the patch we're using imposes negligible performance cost for the case when the probe points aren't in use
    • TODO:
      • Double-check generated machine code
      • Test with and without probes, on both architectures
      • More documentation
      • Additional probepoints as listed under "Scope" below
      • All of the above for Python 3


  • php-5.2.8: implemented as an add-on module (shared library listed in /etc/php.ini) that intercepts internal php interpreter function pointers and wraps those calls with markers


  • ruby-1.8.6-p287: similar to php, but richer & far more complicated




It seems as if several of the above were dtrace-instrumented in code that was never merged into the upstream versions of the package, but instead represented as run-time add-ons or private patches for Solaris distributions. Disappointing, but perhaps we can do better and engage the respective upstream teams. This will of course take time and panache.

At least the patches tend to be very small so we have some freedom to choose between approaches (adding STAP_PROBE/whatever hooks directly to the core upstream code; or fedora local patches; or add-on shared libraries like for php/httpd).

Another approach worth considering is adding tapsets that map process.mark() events to process.function/statement() to approximate the dtrace out-of-tree patches.

How To Test

Whether systemtap and static markers are working in general can be tested by installing systemtap, kernel-debuginfo and the systemtap-testsuite. Running sudo make installcheck in /usr/share/systemtap/testsuite

When applications get static markers enabled we should add them to a testing page listing:

  • Package install instructions.
  • Setup and sample run of the application
  • A reference to the probe names.
  • And an simple example stap invocation listing markers that can be enabled.

Question: Is there a convention/template for adding such test pages for test days?

User Experience

For packages that have static probes enabled users will be able to trace high-level events, like for example database transactions, through stap.


  • A new version of systemtap with the systemtap-sdt-devel subpackage.
  • Any package wishing to expose existing probes in its (upstream) sources depending on systemtap-sdt-devel and adding an --enable-dtrace or equivalent to its spec file.

Contingency Plan

Even if all the tracing will not work, packages that are converted to provide static probes will not be impacted since the probe points have (near) zero overhead, so in the worse case some packages were recompiled to enable the feature, but users will still not be able to use it.


The upstream wiki is the best description for now the systemtap list has an example on converting a package

While working on this feature this section will be expanded to list packages that have probe points enabled and pointers to (upstream) package documentation on the probe names and semantics like for postgresql


The following Systemtap probe points have been added to Fedora 13's Python 2 packages:

Probe point Parameters Overview Example of usage
  • str filename
  • str funcname
  • int lineno
Indicates that execution of a Python function has begun
stap \
  -e'probe python.function.entry {log(filename);}' \
  -c yum help
  • str filename
  • str funcname
  • int lineno
Indicates that the Python runtime has returned from a function Probing modules visited as the python runtime starts up:
stap \
-e'probe python.function.return {log(filename);}' \
-c "python -c 'pass'"

A sample script that uses these probe points to show the hierarchy of function calls and returns within a python process (or across the whole system) has been added to the python-libs subpackage.

Here's an example of running it (in verbose mode) to trace what happens during the invocation of a python script (the yum tool, as it happens).

# stap -v /usr/share/doc/python-libs-2.6.4/systemtap-example.stp -c yum help
Pass 1: parsed user script and 66 library script(s) using
20224virt/12248res/2040shr kb, in 150usr/10sys/160real ms.
Pass 2: analyzed script: 2 probe(s), 14 function(s), 2 embed(s), 2 global(s)
using 25184virt/14572res/3380shr kb, in 20usr/0sys/14real ms.
Pass 3: using cached
Pass 4: using cached
Pass 5: starting run.
     0 yum(23287): => <module> in /usr/lib/python2.6/
   439 yum(23287):  => <module> in /usr/lib/python2.6/
  1021 yum(23287):   => <module> in /usr/lib/python2.6/
  1146 yum(23287):    => <module> in /usr/lib/python2.6/
  1163 yum(23287):    <= <module> in /usr/lib/python2.6/
  1272 yum(23287):    => <module> in /usr/lib/python2.6/
  1292 yum(23287):    <= <module> in /usr/lib/python2.6/
  1483 yum(23287):    => <module> in /usr/lib/python2.6/
  1677 yum(23287):     => <module> in /usr/lib/python2.6/
  1698 yum(23287):     <= <module> in /usr/lib/python2.6/

Release Notes

Systemtap has been extended to support user space tracing, and in particular to support static (dtrace compatible) markers enabled in various programs in Fedora 12. This enables users, developers and administrators a high level overview of what is going on with their system or deep down in a specific program or subsystem.

Systemtap comes with a tutorial, a language reference manual, a tapsets reference and an examples directory under /usr/share/doc/systemtap-?.?/

  • TODO: Should have a list of which packages were enabled with markers when finished.

Comments and Discussion