SystemTap logo SystemTap | 
 

Examples

 

Example Indexes

All Examples

  • general/ansi_colors.stp - Color Table for ansi_set_color2() and ansi_set_color3()
    keywords: FORMAT

    The script prints a table showing the available color combinations for the ansi_set_color2() and ans_set_color3() functions in the ansi.stp tapset.

  • general/ansi_colors2.stp - Show Attribues in Table for ansi_set_color3()
    keywords: FORMAT

    The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset.

  • general/graphs.stp - Graphing Disk and CPU Utilization
    keywords: DISK CPU USE GRAPH

    The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.

  • general/helloworld.stp - SystemTap "Hello World" Program
    keywords: SIMPLE

    A basic "Hello World" program implemented in SystemTap script. It prints out "hello world" message and then immediately exits.

  • general/para-callgraph.stp - Callgraph tracing with arguments
    keywords: TRACE CALLGRAPH

    Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger.

  • interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
    keywords: INTERRUPT BACKTRACE

    The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.

  • io/disktop.stp - Summarize Disk Read/Write Traffic
    keywords: DISK

    Get the status of reading/writing disk every 5 seconds, output top ten entries during that period.

  • io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
    keywords: IO BACKTRACE

    When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.

  • io/ioblktime.stp - Average Time Block IO Requests Spend in Queue
    keywords: IO

    The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.

  • io/iostats.stp - List Executables Reading and Writing the Most Data
    keywords: IO PROFILING

    The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.

  • io/iotime.stp - Trace Time Spent in Read and Write for Files
    keywords: SYSCALL READ WRITE TIME IO

    The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.

  • io/iotop.stp - Periodically Print I/O Activity by Process Name
    keywords: IO

    Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.

  • io/traceio.stp - Track Cumulative I/O Activity by Process Name
    keywords: IO

    Every second print out the top ten executables sorted in descending order based on cumulative I/O traffic observed.

  • io/traceio2.stp - Watch I/O Activity on a Particular Device
    keywords: IO

    Print out the executable name and process number as reads and writes to the specified device occur.

  • memory/kmalloc-top - Show Paths to Kernel Malloc (kmalloc) Invocations
    keywords: MEMORY

    The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).

  • memory/pfaults.stp - Generate Log of Major and Minor Page Faults
    keywords: MEMORY

    The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.

  • network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
    keywords: NETWORK TRACEPOINT BUFFER FREE

    Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.

  • network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
    keywords: NETWORK TRAFFIC PER-PROCESS

    Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.

  • network/socket-trace.stp - Trace Functions called in Network Socket Code
    keywords: NETWORK SOCKET

    The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.

  • network/tcp_connections.stp - Track Creation of Incoming TCP Connections
    keywords: NETWORK TCP SOCKET

    The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.

  • network/tcpdumplike.stp - Dump of Received TCP Packets
    keywords: NETWORK TRAFFIC

    The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.

  • process/errsnoop.stp - tabulate system call errors
    keywords: PROCESS SYSCALL

    The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).

  • process/futexes.stp - System-Wide Futex Contention
    keywords: SYSCALL LOCKING FUTEX

    The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.

  • process/pf2.stp - Profile kernel functions
    keywords: PROFILING

    The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.

  • process/sig_by_pid.stp - Signal Counts by Process ID
    keywords: SIGNALS

    Print signal counts by process ID in descending order.

  • process/sig_by_proc.stp - Signal Counts by Process Name
    keywords: SIGNALS

    Print signal counts by process name in descending order.

  • process/sigkill.stp - Track SIGKILL Signals
    keywords: SIGNALS

    The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.

  • process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
    keywords: SIGNALS

    The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.

  • process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
    keywords: IO SCHEDULER BACKTRACE

    The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.

  • process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls
    keywords: SYSCALL SLEEP

    The script watches each nanosleep syscall on the system. At the end of each nanosleep syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "nanosleep:" key, and the duration of the sleep in microseconds.

  • process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
    keywords: SYSCALL

    The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each PID ordered from greatest to least number of syscalls.

  • process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable
    keywords: SYSCALL

    The script watches all syscall on the system. On exit the script prints a list showing the number of systemcalls executed by each executable ordered from greates to least number of syscalls.

  • process/wait4time.stp - Trace Time Spent in wait4 Syscalls
    keywords: SYSCALL WAIT4

    The script watches each wait4 syscall on the system. At the end of each wait4 syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "wait4:" key, the duration of the wait and the PID that the wait4 was waiting for. If the waited for PID is not specified , it is "-1".

  • profiling/functioncallcount.stp - Count Times Functions Called
    keywords: PROFILING FUNCTIONS

    The functioncallcount.stp script takes one argument, a list of functions to probe. The script will run and count the number of times that each of the functions on the list is called. On exit the script will print a sorted list from most frequently to least frequently called function.

  • profiling/thread-times.stp - Profile kernel functions
    keywords: PROFILING

    The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.

  • profiling/timeout.stp - Show Processes Doing Polling Operations
    keywords: PROFILING

    The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes.

  • profiling/topsys.stp - Show Processes Doing Polling Operations
    keywords: PROFILING

    The topsys.stp script lists out the top twenty systemcalls for the previous 5 seconds. The output is sorted from most frequent to least frequent.