Scripts & Tools
The goal of this page is to encourage the development and sharing of a wide variety of SystemTap scripts. What should be included? Nothing is too big or too small for consideration. Please document completed scripts in the Scripts section below and suggestions in Script Ideas. Also see the WarStories page for additional scripts.
NOTE These scripts may be incomplete or obsolete. The suite of examples packaged with systemtap releases undergoes automatic testing.
Scripts (by category)
- Audit
- CPU
- Disk
disktop.stp : List the top ten activities of reading/writing disk every 5 seconds(example output)
stripesize.stp : Helps choose and validate a RAID array's stripe size.
- Files
pfiles.stp: report information for all open files by the process id *new*
opened_file_by_pid.stp :List the number of opened files for specified process
- Filesystems
- Kernel
- Locking
- Memory
- NUMA
- Network
socktop (example output): Combination shell/!SystemTap script to track reads and writes on sockets by process. Can be filtered by process IDs and names, protocols, protocol families, users and socket type.
- Processes
iotime.stp: Print the time spent in the read() and write() system calls when a process closes each file.
sigkill.stp :Monitor processes that receives a SIGKILL signal.
sigmon.stp: Monitor when a specific process ID receives a specific signal.
sleeptime.stp: Print the time spent in the nanosleep() and compat_nanosleep() systemcalls. This can help find which processes are waking based on time rather than some real event that needs to be handled.
syscalls_by_pid.stp (example output): Print the system call count by process ID in descending order.
syscalls_by_proc.stp (example output): Print the system call count by process name in descending order.
syscalltimes (example output): Combination shell/!SystemTap script to measure cumulative system call times (start/end deltas). Can be filtered by process ID, process name and user name.
traceio.stp :Another I/O activity by process name example
set_task_state.stp :Reliable way to make a process enter specified task state
proc_transition_by_pid.stp :Trace state transition of specified process
dumpstack.stp : Dump kernel stack for specified process that isn't in running
- Real-time
- Simple
- System
io_submit.stp :Trace the most common causes of schedule during the AIO call(example output)
- Users
iotop.stp : List the top ten entries of reading/writing activities every 5 seconds(example output)
usertop.stp Total CPU ticks, by UID - see https://github.com/paulmaunders/usertop.
Script Ideas (by category)
- Audit
- Scripts that utilize the audit hooks
- Scripts that emulate the audit subsystem functionality
- CPU
- Disk
- Scripts that utilize blocktrace hooks
- Files
- List open files: lsof command equivalent
- Filesystems
- Kernel
- Locking
- Memory
- Memory leak detection: track memory subsystem activity to detect who may be leaking memory
Better application memory analysis. See How much memory am I really using?
- Network
- SCTP - Stream Control Transmission Protocol
- NUMA
- Processes
- File creat()s by process name
- File descriptor usage by process name
- File opens by process name
- File IO activity by filename and process name
- List new processes as they are created
- Process creation rate
- Bytes read by process name
- Application startup analysis: a breakdown of what's happening when an application starts up. For example, why does it take Firefox so long to start?
- Implement BSD process accounting on top of systemtap
- Real-time
- Simple
- System
Power usage analysis. See powertop.
- Users
- CPU usage by UID and GID
- Network usage by UID and GID
Tools
Distribution framework for SystemTap scripts
stap_buildpkg.tgz : This framework would package a compiled kernel module(for a given script) along with systemtap-runtime into a binary executable for easy execution on machines that do not have SystemTap installed, and provides for easy execution of the same