SystemTap
Encyclopedia
In computing
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...

, SystemTap (stap) is the primary scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

 and tool
Tool
A tool is a device that can be used to produce an item or achieve a task, but that is not consumed in the process. Informally the word is also used to describe a procedure or process with a specific purpose. Tools that are used in particular fields or activities may have different designations such...

 for dynamically instrumenting
Instrumentation (computer programming)
In context of computer programming, instrumentation refers to an ability to monitor or measure the level of a product's performance, to diagnose errors and to write trace information. Programmers implement instrumentation in the form of code instructions that monitor specific components in a system...

 running production Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s. System administrators can use SystemTap to extract, filter and summarize data in order to enable diagnosis of complex performance or functional problems.

SystemTap consists of open-source
Open-source software
Open-source software is computer software that is available in source code form: the source code and certain other rights normally reserved for copyright holders are provided under a software license that permits users to study, change, improve and at times also to distribute the software.Open...

 software and includes contributions from Red Hat
Red Hat
Red Hat, Inc. is an S&P 500 company in the free and open source software sector, and a major Linux distribution vendor. Founded in 1993, Red Hat has its corporate headquarters in Raleigh, North Carolina with satellite offices worldwide....

, IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...

, Intel, Hitachi, Oracle
Oracle Corporation
Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...

, and other community members.

History

SystemTap debuted in 2005 in Red Hat Enterprise Linux
Red Hat Enterprise Linux
Red Hat Enterprise Linux is a Linux-based operating system developed by Red Hat and targeted toward the commercial market. Red Hat Enterprise Linux is released in server versions for x86, x86-64, Itanium, PowerPC and IBM System z, and desktop versions for x86 and x86-64...

 4 Update 2 as a technology preview.

After 4 years in development, SystemTap 1.0 was released in 2009.

SystemTap runs fully supported in all Linux distributions including RHEL / CentOS
Red Hat Enterprise Linux
Red Hat Enterprise Linux is a Linux-based operating system developed by Red Hat and targeted toward the commercial market. Red Hat Enterprise Linux is released in server versions for x86, x86-64, Itanium, PowerPC and IBM System z, and desktop versions for x86 and x86-64...

 5 since update 2, SLES 10, Fedora, and Ubuntu.

Tracepoints in the CPython
CPython
CPython is the default, most-widely used implementation of the Python programming language. It is written in C. In addition to CPython, there are two other production-quality Python implementations: Jython, written in Java, and IronPython, which is written for the Common Language Runtime. There...

 VM and JVM were added in SystemTap 1.2.

Usage

SystemTap files are saved as .stp files and are written in the SystemTap language, based on the language reference. They are run with the stap command line.
A number of passes are done on the script before it is allowed to run, at which point the script is compiled into a kernel module and loaded. Listing modules shows each SystemTap script as 'stap_'. The module is unloaded when the tap has finished running.

Scripts are generally based around events (such as starting or finishing a script), probe points, or kernel functions.

Some "guru mode" scripts may also have embedded C, which may be run with the -g command-line option. However, use of guru mode is discouraged, and each SystemTap release includes more probe points designed to remove the need for guru-mode taps.

Simple examples

The following script shows all applications setting TCP socket options on the system, what options are being set, and whether the option is set successfully or not:

  1. Show sockets setting options

  1. Return enabled or disabled based on value of optval

function getstatus(optval)
{
if ( optval 1 )
return "enabling"
else
return "disabling"
}

probe begin
{
print ("\nChecking for apps setting socket options\n")
}
  1. Set a socket option

probe tcp.setsockopt
{
status = getstatus(user_int($optval))
printf (" App '%s' (PID %d) is %s socket option %s... ", execname, pid, status, optstr)
}
  1. Check setting the socket option worked

probe tcp.setsockopt.return
{
if ( ret 0 )
printf ("success")
else
printf ("failed")
printf ("\n")
}

probe end
{
print ("\nClosing down\n")
}


Many other examples are shipped with SystemTap. There are also real-world examples of SystemTap use at the War Stories page .

Importing scripts from other tracing technologies

SystemTap can import DTrace
DTrace
DTrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time...

 markers to SystemTap markers providing those markers exist in RHEL.

See also

  • Kernel marker
    Kernel marker
    Kernel markers were a static kernel instrumentation support mechanism for Linux kernel source code, allowing special tools such as LTTng or SystemTap to trace information exposed by these probe points...

  • DProbes
    Dprobes
    dprobes is a Linux kernel analysis framework created in 2004, which features the ability to insert software probes dynamically into running code...

  • LTTng
    LTTng
    LTTng is a system software package for tracing the Linux kernel. LTTng consists of a kernel patch and a kernel module package. It is used together with*ltt-control, a toolchain to control tracing, and...

  • strace
    Strace
    strace is a debugging utility for Linux and some other Unix-like systems to monitor the system calls used by a program and all the signals it receives, similar to "truss" utility in other Unix systems...

  • DTrace
    DTrace
    DTrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time...

  • ProbeVue
    ProbeVue
    ProbeVue is IBM's implementation of a lightweight dynamic tracing environment introduced in AIX version 6.1. ProbeVue provides the ability to probe running processes in order to provide statistical analysis as well as retrieve data from the probed process...


External links


Papers


Presentations

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK