Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Making the Operation of Code More Transparent and Obvious with SystemTap

May 14, 2018
William Cohen
Related topics:
LinuxDeveloper Tools
Related products:
Red Hat Enterprise Linux

Share:

    You can study source code and manually instrument functions as described in the “Use the dynamic tracing tools, Luke” blog article, but why not make it easier to find key points in the software by adding user-space markers to the application code? User-space markers have been available in Linux for quite some time (since 2009). The inactive user-space markers do not significantly slow down the code. Having them available allows you to get a more accurate picture of what the software is doing internally when unexpected issues occur. The diagnostic instrumentation can be more portable with the user-space markers, because the instrumentation does not need to rely on instrumenting particular function names or lines numbers in source code. The naming of the instrumentation points can also make clearer what event is associated with a particular instrumentation point.

    For example, Ruby MRI on Red Hat Enterprise Linux 7 has a number of different instrumentation points made available as a SystemTap tapset. If SystemTap is installed on the system, as described by What is SystemTap and how to use it?, the installed Ruby MRI instrumentation points can be listed with the stap -L" command shown below. These events show the start and end of various operations in the Ruby runtime, such as the start and end of garbage collection (GC) marking and sweeping.

    $ stap -L "ruby.**"
    ruby.array.create size:long file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.cmethod.entry classname:string methodname:string file:string line:long $arg1:long $arg2:long $arg3:long $arg4:long
    ruby.cmethod.return classname:string methodname:string file:string line:long $arg1:long $arg2:long $arg3:long $arg4:long
    ruby.find.require.entry requiredfile:string file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.find.require.return requiredfile:string file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.gc.mark.begin
    ruby.gc.mark.end
    ruby.gc.sweep.begin
    ruby.gc.sweep.end
    ruby.hash.create size:long file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.load.entry loadedfile:string file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.load.return loadedfile:string $arg1:long $arg2:long $arg3:long
    ruby.method.entry classname:string methodname:string file:string line:long $arg1:long $arg2:long $arg3:long $arg4:long
    ruby.method.return classname:string methodname:string file:string line:long $arg1:long $arg2:long $arg3:long $arg4:long
    ruby.object.create classname:string file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.parse.begin parsedfile:string parsedline:long $arg1:long $arg2:long
    ruby.parse.end parsedfile:string parsedline:long $arg1:long $arg2:long
    ruby.raise classname:string file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.require.entry requiredfile:string file:string line:long $arg1:long $arg2:long $arg3:long
    ruby.require.return requiredfile:string $arg1:long $arg2:long $arg3:long
    ruby.string.create size:long file:string line:long $arg1:long $arg2:long $arg3:long
    

    Ruby and other languages provide tools to give some information about aspects of the their operation, such as statistics about garbage collection. However, often these tools are designed just to work within the confines of that language and a single process. These language-specific tools are less useful for examining problems that span code written in different languages or problems between multiple communicating processes. There are existing compiled C libraries that have been plugged into Python, Ruby, and Java code. Having SystemTap tapsets for the operations and events in these shared libraries can make it easier to write diagnostics that give a clearer understanding of what is occurring across multiple software components of complex systems.

    For example, you might have a Ruby program that uses a GUI built on GNOME GLib libraries. You observe pauses when doing the screen updates. You suspect that the pause might be due to Ruby's garbage collection, but also consider that the pauses could be due to issues in the GLib library operations. The developers of the GLib libraries have included a number of instrumentation points in the libraries. Having instrumentation points in both the Ruby runtime and GLib libraries allows you to check both of those different areas of code using a single tool, SystemTap.

    Over time, developers and maintainers of various software packages have added user-space markers to their applications. At Red Hat, we have enabled that instrumentation where possible in the RHEL packages. On RHEL 7.5, a number of RPMs make SystemTap user-space probes available, as seen with a query of files in /usr/share/systemtap/tapset:

    $ cd /usr/share/systemtap/tapset; find -path "*.stp" -exec rpm -qf {} \; |sort |uniq
    glib2-devel-2.54.2-2.el7.x86_64
    java-1.7.0-openjdk-devel-1.7.0.171-2.6.13.2.el7.x86_64
    libvirt-client-3.9.0-14.el7_5.2.x86_64
    nodejs-6.14.0-1.el7.x86_64
    pcp-3.12.2-5.el7.x86_64
    perl-devel-5.16.3-292.el7.x86_64
    python-libs-2.7.5-68.el7.x86_64
    qemu-kvm-1.5.3-156.el7.x86_64
    qemu-system-alpha-2.0.0-1.el7.6.x86_64
    qemu-system-arm-2.0.0-1.el7.6.x86_64
    qemu-system-cris-2.0.0-1.el7.6.x86_64
    qemu-system-lm32-2.0.0-1.el7.6.x86_64
    qemu-system-m68k-2.0.0-1.el7.6.x86_64
    qemu-system-microblaze-2.0.0-1.el7.6.x86_64
    qemu-system-mips-2.0.0-1.el7.6.x86_64
    qemu-system-moxie-2.0.0-1.el7.6.x86_64
    qemu-system-or32-2.0.0-1.el7.6.x86_64
    qemu-system-s390x-2.0.0-1.el7.6.x86_64
    qemu-system-sh4-2.0.0-1.el7.6.x86_64
    qemu-system-unicore32-2.0.0-1.el7.6.x86_64
    qemu-system-x86-2.0.0-1.el7.6.x86_64
    qemu-system-xtensa-2.0.0-1.el7.6.x86_64
    qemu-user-2.0.0-1.el7.6.x86_64
    ruby-libs-2.0.0.648-33.el7_4.x86_64
    sssd-common-1.16.0-19.el7.x86_64
    systemtap-client-3.2-4.el7.x86_64
    systemtap-devel-3.2-4.el7.x86_64

    You should consider adding similar, handy instrumentation probe points to the applications you maintain to make it easier for you and others to investigate issues on complex systems. Adding User Space Probing to an Application (heapsort example) provides information about how to implement this instrumentation.

    Last updated: May 29, 2018

    Recent Posts

    • Assessing AI for OpenShift operations: Advanced configurations

    • OpenShift Lightspeed: Assessing AI for OpenShift operations

    • OpenShift Data Foundation and HashiCorp Vault securing data

    • Axolotl meets LLM Compressor: Fast, sparse, open

    • What’s new for developers in Red Hat OpenShift 4.19

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue