SystemTap
| Developer(s) | Various |
|---|---|
| Initial release | 2005 |
| Stable release | 1.6 / July 25, 2011 |
| Written in | C++, custom scripting |
| Operating system | Linux |
| Type | Tracing |
| License | GNU General Public License |
| Website | http://sourceware.org/systemtap/ |
In computing, SystemTap (stap) is the primary scripting language and tool for dynamically instrumenting running production Linux operating systems. 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 software and includes contributions from Red Hat, IBM, Intel, Hitachi, Oracle, and other community members.[1]
Contents |
[edit] History
SystemTap debuted in 2005 in Red Hat Enterprise Linux 4 Update 2 as a technology preview.[2]
After 4 years in development, SystemTap 1.0 was released in 2009.[3]
As of 2011[update] SystemTap runs fully supported in all Linux distributions including RHEL / CentOS 5[4] since update 2, SLES 10,[5] Fedora, Debian and Ubuntu.
Tracepoints in the CPython VM and JVM were added in SystemTap 1.2.[6]
[edit] Usage
SystemTap files are saved as .stp files and are written in the SystemTap language, based on the language reference.[7] They are run with the stap command line.[8] 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_<UUID>'. 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.
[edit] 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:
# Show sockets setting options
# 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")
}
# 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)
}
# 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 .
[edit] Importing scripts from other tracing technologies
SystemTap can import DTrace markers to SystemTap markers providing those markers exist in RHEL.
[edit] See also
[edit] References
- ^ A SystemTap update
- ^ http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/RELEASE-NOTES-U2-x86-en.html
- ^ http://sourceware.org/ml/systemtap/2009-q3/msg00831.html
- ^ http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Release_Notes/x86/ar01s03.html
- ^ http://support.novell.com/techcenter/psdb/f1856527fefb7f2060aeb6907f319a09.html
- ^ http://fedoraproject.org/wiki/Features/SystemtapStaticProbes
- ^ http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/html/SystemTap_Tapset_Reference/index.html
- ^ Compare Romans, Robb (2009). "SystemTap Language Reference: A guide to the constructs and syntax used in SystemTap scripts" (PDF). Red Hat. p. 4. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.172.5186&rep=rep1&type=pdf. Retrieved 2010-12-19. "SystemTap [...] requires root privileges to actually run the kernel objects it builds using the sudo command, applied to the staprun program.[...] staprun is a part of the SystemTap package, dedicated to module loading and unloading and kernel-touser data transfer."
[edit] External links
- SystemTap Homepage
- SystemTap Wiki
- SystemTap Language Reference (PDF)
- SystemTap project analysis by Ohloh
[edit] Papers
- Frank Ch. Eigler, Systemtap tutorial
- Don Domingo, William Cohen, SystemTap Beginner's Guide
- Frank Ch. Eigler, Problem Solving With Systemtap, Ottawa Linux Symposium 2006
[edit] Presentations
- Eugene Teo, Problem Solving with SystemTap, presented at the Red Hat Summit 2007 (scripts)
- Joshua Stone, Dynamic Tracing and Performance Analysis Using SystemTap, presented at the LinuxWorld Conference 2008
- Jim Keniston, SystemTap Tutorial, presented at the Linux Plumbers Conference 2008