# metavirt_content

c0title: Tracing glib2 memory allocations
c1name: gmalloc_watch.stp
c2keywords: trace
c4path: apps
c3description:
The gmalloc_watch.stp script from Colin Walters' blog (https://blog.verbum.org/2011/03/19/analyzing-memory-use-with-systemtap/) traces the allocation of glib2 memory using the markers in glib2.


c0title: Trace libguestfs startup
c1name: libguestfs_log.stp
c2keywords: application trace bpf
c4path: apps
c3description:
The libguestfs_log.stp script prints a log of when various libgueststartup steps are encountered.   The first column is microseconds since the script started.  The second column is the time elapsed in microseconds between the previous and current events and the third column is the event name.


c0title: Provide elapsed times for Passes of SystemTap script compilation
c1name: stap_time.stp
c2keywords: application trace
c4path: apps
c3description:
SystemTap has multiple passes to convert the text of a SystemTap script into instrumentation that actually collect data on the system.  The stap_time.stp script uses the markers in SystemTap to note the amount of time that each of the passes requires.  When SystemTap completes pass 4 (compiling the instrumentation into a kernel module) the script print out the script name followed by the amount of time in milliseconds required for Pass 0 (command line option parsing), Pass 1 (script parsing), Pass 2 (elaboration), Pass 3 (code generation), and Pass 4 (module compilation).  The resulting data can be analyzed to determine if there are issues with the amount of time that systemtap takes to generate instrumentation.


c0title: Count I/O Syscalls using Alias Suffixes
c1name: alias_suffixes.stp
c2keywords: io statistics
c4path: general
c3description:
alias_suffixes.stp is a demonstration of how alias suffixes in the systemtap language might be used. The script tracks the wall clock time for each invocation of the system calls open, close, read, and write. When the script exists it prints out the minimum, average, and maximum times in microseconds for each system call, followed by a count of times that each syscall was invoked and a histogram showing the distributions of times.


c0title: Keep a tally of executables run on the system
c1name: also_ran.stp
c2keywords: prometheus
c4path: general
c3description:
The also_ran.stp script tallies each time a executable is started or a shared library is loaded for execution.  This information can be useful to determine what software is actually being used on the system.  The script makes the information available via procfs in Prometheus readable format.


c0title: Color Table for ansi_set_color()
c1name: ansi_colors.stp
c2keywords: format bpf
c4path: general
c3description:
The script prints a table showing the available color combinations for the ansi_set_color() function in the ansi.stp tapset.


c0title: Show Attribues in Table for ansi_set_color()
c1name: ansi_colors2.stp
c2keywords: format bpf
c4path: general
c3description:
The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color() function in the ansi.stp tapset.


c0title: Bad Filename Filter
c1name: badname.stp
c2keywords: filesystem guru
c4path: general
c3description:
The badname.stp script shows how one could prevent the creation of files with undesirable names using guru mode.


c0title: Callgraph Tracing
c1name: callgraph.stp
c2keywords: simple trace callgraph
c4path: general
c3description:
Print a timed per-thread microsecond-timed nested callgraph.  The first parameter names the function probe points to trace.


c0title: Monitor Intel processors for throttling due to power or thermal limits
c1name: cpu_throttle.stp
c2keywords: prometheus limits
c4path: general
c3description:
Intel processors have hardware mechanisms that will reduce the effective processors speed to avoid exceeding set thermal or power constraints. The cpu_throttle.stp script monitors when CPU throttling occurs and accumulates the amount of time in milliseconds that each processor is throttled.  The script makes the information available via procfs in Prometheus readable format.


c0title: Interactive Count Specified Events
c1name: eventcount.stp
c2keywords: interactive statistics thread process
c4path: general
c3description:
The script periodically prints a count of specified events and their related tid's over the course of execution. Numerous configuration options exist to control filtering / reporting, some of which can be modified at runtime. See the script source for more information.


c0title: Function Time Statistics
c1name: func_time_stats.stp
c2keywords: function statistics
c4path: general
c3description:
The func_time_stats.stp script tracks the wall clock time for each invocation of the function probe listed as the first command line argument. When the script exits it prints out the minimum, average, and maximum times in microseconds followed by a count of times that the function was called and a histogram showing the distributions of times.


c0title: Graphing Disk and CPU Utilization with gnuplot
c1name: graphs.stp
c2keywords: monitoring
c4path: general
c3description:
The script tracks the disk and CPU utilization.  It prints a stream of data which, when piped directly into gnuplot, draws historical curves for each.


c0title: SystemTap "Hello World" Program
c1name: helloworld.stp
c2keywords: _best simple bpf
c4path: general
c3description:
A basic "Hello World" program implemented in SystemTap script. It prints out "hello world" message and then immediately exits.


c0title: make keyboard noises
c1name: key.stp
c2keywords: simple
c4path: general
c3description:
For fans of Leroy Anderson and Typewriters only, this script arranges to play a click or a zing for various keystrokes.


c0title: Hack the keyboard
c1name: keyhack.stp
c2keywords: simple guru
c4path: general
c3description:
This script makes it appear that one's keyboard is broken, by changing keycodes at the kernel device driver level.  Annoy your friends!


c0title: Measure intervals between events
c1name: measureinterval.stp
c2keywords: monitoring
c4path: general
c3description:
The measureinteval.stp script allows quick creation of instrumentation to measure quantity between different probe points, aggregate the measurements, and display the results. The first argument to the script is the quantity to measure such as time in microseconds via "gettimeofday_us()".   There could be multiple intervals being measured concurrently and the second argument is the means to match the start probe points listed in the fourth argument with the end probes listed in the fifth argument.  The third argument is how to display the aggregated data.  The data could be displayed as a sum (@sum), an average (@avg), or a histogram (@hist_log).  The fourth and fifth arguments are lists of probes marking the start and end of an interval.  An optional sixth argument allows grouping of the intervals. One could use "tid()" for the matching argument to measure the intervals on a per-thread basis, but then use "execname()" for the optional argument to group the measurements by executable name.  If there is no sixth argument, all the intervals are aggregated into a single entry.


c0title: Callgraph Tracing with Verbose Arguments
c1name: para-callgraph-verbose.stp
c2keywords: trace callgraph
c4path: general
c3description:
Print a timed per-thread microsecond-timed callgraph, complete with pretty-printed 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.


c0title: Callgraph Tracing with Arguments
c1name: para-callgraph.stp
c2keywords: _best trace callgraph
c4path: general
c3description:
Print a timed per-thread microsecond-timed 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.


c0title: Report opened files whose names match a given regex
c1name: regex.stp
c2keywords: regex
c4path: general
c3description:
Uses the regex functionality to detect opened files whose names match a pattern given on the command line. If no command line parameter is given, demonstrate by filtering for files that end with an extension showing them to be an archive.


c0title: Interactive Print the Size of a C Type
c1name: sizeof_interactive.stp
c2keywords: statistics memory interactive
c4path: general
c3description:
This script prints the size of a type, based on dwarf debuginfo for any kernel or userspace module, or trial-compilation of a given header file name. Types and corresponding locations are provided to the script at runtime via keyboard input. The format of the input is identical to that of sizeof.stp (see script source for more information). Types and locations can be repeatedly given until the process is terminated. 


c0title: Trace Socket Activity of a Process
c1name: socket-events.stp
c2keywords: socket syscall
c4path: general
c3description:
Prints the life cycle of all sockets associated with a process. This includes bytes and timing. The timing information that is tracked includes event completion relative to the start of said event and the end of the previous event. Currently tracks read, write, recv, send, connect and close.


c0title: Profile Tcl calls
c1name: tcl-funtop.stp
c2keywords: profiling
c4path: general
c3description:
The tcl-funtop.stp script displays a top-like view of most frequently used Tcl functions for the each five second interval.


c0title: Watch a Variable Changing Value in a Thread
c1name: varwatch.stp
c2keywords: _best monitoring
c4path: general
c3description:
This script places a set of probes (specified by $1), each of which monitors the state of some context $variable expression (specified by $2).  Whenever the value changes, with respect to the active thread, the event is traced.


c0title: Watchdog Timer for Arbitrary Events
c1name: watchdog.stp
c2keywords: watchdog backtrace
c4path: general
c3description:
The watchdog.stp script provides a watchdog timer mechanism for arbitrary events. The script takes three arguments: the events to start watchdog timer, the event to stop the watchdog timer, and the time in millseconds for the watchdog. If the watchdog timer is exceed, the script will trigger a stack backtrace of the user-process that timed out using pstack. This script can be used to diagnose what the userspace application is doing when a slower than expected operation occurs.


c0title: Why did the function fail?
c1name: whythefail.stp
c2keywords: speculation monitoring function trace _best
c4path: general
c3description:
The whythefail.stp script prints a statement-execution trace for a given function, but only for those runs of the function that ended up with a (configurable) post-return condition.


c0title: SystemTap "Floating Point" Program
c1name: floatingpoint.stp
c2keywords: simple floatingpoint
c4path: general
c3description:
A basic "Floating Point" program implemented in SystemTap script. It extracts floating point from benchmark-sdt section in main.cxx and takes one pseudo floating point, printing out results of various simple floating point operations.


c0title: Print the Size of a C Type
c1name: sizeof.stp
c2keywords: statistics memory bpf
c4path: general
c3description:
This script prints the size of a type, based on dwarf debuginfo for any kernel or userspace module, or trial-compilation of a given header file name.


c0title: See the amount of wall clock time a process spends in various states
c1name: stopwatches.stp
c2keywords: time bpf
c4path: general
c3description:
The stopwatch.stp script illustrates how to use multiple stopwatches record how much wallclock time a process spends in kernel- and user-space.  On exit the script prints out the time in seconds, milliseconds, microseconds, and nanoseconds. Note that this output of this script is not directly comparable to the time command because time records the time that the process is actually active in kernel- and user-space.


c0title: Tally Backtraces for Inter-Processor Interrupt
c1name: scf.stp
c2keywords: interrupt backtrace
c4path: interrupt
c3description:
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.


c0title: Histograms of Seek Behavior for Each Device
c1name: deviceseeks.stp
c2keywords: disk
c4path: io
c3description:
The deviceseeks.stp script generates a periodic histogram showing the frequency of different sized seeks (in sectors) on each device, or optional given device-name regexp


c0title: disable fsync
c1name: eatmydata.stp
c2keywords: io guru simple
c4path: io
c3description:
Suppresses fsync() syscalls from processes identified by stap -c/-x by turning them into presumed-faster fsync() on some dummy or other file descriptor


c0title: Report an disk out-of-space condition.
c1name: enospc.stp
c2keywords: disk filesystem
c4path: io
c3description:
This script monitors a filesystem implementations for early internal indications of ENOSPC, and reports these to the system logger and the systemtap console.


c0title: Monitoring Reads and Writes to a File
c1name: inodewatch.stp
c2keywords: io
c4path: io
c3description:
 The inodewatch.stp outputs the executable name and process id each time a read or write occurs to the specified inode on the specified major/minor device.


c0title: Monitoring Attribute Changes to a File
c1name: inodewatch2.stp
c2keywords: io
c4path: io
c3description:
 The inodewatch2.stp script outputs the executable name, process id, and attributes each time the attributes are changed on the specified inode on the specified major/minor device.


c0title: Tally Reschedule Reason During AIO io_submit Call
c1name: io_submit.stp
c2keywords: io backtrace
c4path: io
c3description:
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.


c0title: Average Time Block IO Requests Spend in Queue
c1name: ioblktime.stp
c2keywords: io
c4path: io
c3description:
The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many outstanding 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.


c0title: List Executables Reading and Writing the Most Data by Device
c1name: iodevstats.stp
c2keywords: io profiling
c4path: io
c3description:
 The iodevstats.stp script measures the amount of data successfully read and written by all the executables for each io device on the system.  The output is sorted from greatest sum of bytes read and written to a device by an executable to the least. The output contains device major/minor number, the count of operations (reads and writes), the totals and averages for the number of bytes read and written.


c0title: IO Statistics for SCSI Devices
c1name: iostat-scsi.stp
c2keywords: io profiling scsi
c4path: io
c3description:
The iostat-scsi.stp script provides a breakdown of the number of blks read and written on the machine's various SCSI devices. The script takes one argument which is the number of seconds between reports.


c0title: List Executables Reading and Writing the Most Data
c1name: iostats.stp
c2keywords: io profiling
c4path: io
c3description:
 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.


c0title: Trace Time Spent in Read and Write for Files
c1name: iotime.stp
c2keywords: profiling syscall io file
c4path: io
c3description:
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 spent 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 parentheses. 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.


c0title: Periodically Print IO Activity by Process Name
c1name: iotop.stp
c2keywords: io
c4path: io
c3description:
Every five seconds print out the top ten executables generating I/O traffic during that interval sorted in descending order.


c0title: Monitor Read/Write of the Boot Sector Area of Block Devices
c1name: mbrwatch.stp
c2keywords: io monitoring disk simple
c4path: io
c3description:
 The mbrwatch.stp script reports any attempted reads/writes of the first few sectors of a raw block device.


c0title: Tally the Number of NFS Functions Used by Each Process
c1name: nfs_func_users.stp
c2keywords: io profiling
c4path: io
c3description:
The nfs_func_users.stp script counts the uses of NFS functions in the kernel on a per process bases.  The output is sorted from the process with the greatest number of NFS functions called to the least. The output contains the executable name, the process number, and the total number of NFS functions called by the process.


c0title: Trace slow vfs opens.
c1name: slowvfs.stp
c2keywords: io simple
c4path: io
c3description:
This script prints a line for every kernel vfs_open operation that takes longer than a configurable number of microseconds.  Highly contended or remote filesystems are likelier to hit this.


c0title: Track Cumulative IO Activity by Process Name
c1name: traceio.stp
c2keywords: io
c4path: io
c3description:
Every second print out the top ten executables sorted in descending order based on cumulative I/O traffic observed.


c0title: Monitor TTY Typing
c1name: ttyspy.stp
c2keywords: io tty monitoring guru
c4path: io
c3description:
The ttyspy.stp script uses tty_audit hooks to monitor recent typing activity on the system, printing a scrolling record of recent keystrokes, on a per-tty basis.


c0title: Tracing Contention on Big Kernel Lock
c1name: bkl.stp
c2keywords: locking
c4path: locks
c3description:
The bkl.stp script can help determine whether the Big Kernel Lock (BKL) is causing serialization on a multiprocessor system due to excessive contention of the BKL. The bkl.stp script takes two arguments. The first one is optional, and used to enable backtraces, and print them once a process has been holding the BKL for a user specified number of nseconds is reached. The second option is compulsory and is the number of processes waiting for the Big Kernel Lock (BKL). When the number of processes waiting for the BKL is reached or exceeded, the script will print a time stamp, the number of processes waiting for the BKL, the holder of the BKL, and the amount of time the BKL was held. If backtraces are enabled, a backtrace will be printed as well.


c0title: Per Process Statistics on Big Kernel Lock Use
c1name: bkl_stats.stp
c2keywords: locking
c4path: locks
c3description:
The bkl_stats.stp script can indicate which processes have excessive waits for the Big Kernel Lock (BKL) and which processes are taking the BKL for long periods of time. The bkl_stats.stp script prints lists of all the processes that require the BKL. Every five seconds two tables are printed out. The first table lists the processes that waited for the BKL followed by the number of times that the process waited, the minimum time of the wait, the average and the maximum time waited. The second table lists has similar information for the time spent in holding the lock for each of the processes.


c0title: Measure block I/O size distribution (non-debuginfo)
c1name: bitesize-nd.stp
c2keywords: io
c4path: lwtools
c3description:
This uses the kernel tracepoint block_rq_insert to read the size of I/O. The output includes the name of the process or thread that was on-CPU when the I/O request was inserted on the issue queue.


c0title: Show socket lifespan, from accept() to close() (non-debuginfo)
c1name: accept2close-nd.stp
c2keywords: network socket
c4path: lwtools
c3description:
This traces socket duration from the accept() syscall to close(), and provides details on the lifespan of these passive connections, showing the distribution as a histogram.


c0title: Measure block I/O latency distribution (non-debuginfo)
c1name: biolatency-nd.stp
c2keywords: io
c4path: lwtools
c3description:
This measures block I/O latency (storage I/O, ie, disk I/O), and shows the distribution as a histogram. This can be useful to identify the characteristics of I/O latency, beyond the averages shown by iostat(1). For example, to study I/O latency outliers, or multi-modal distributions.


c0title: Trace process exec() with command line argument details (non-debuginfo)
c1name: execsnoop-nd.stp
c2keywords: io
c4path: lwtools
c3description:
This can identify if CPU is consumed by short-lived processes, by tracing new process execution. It works by tracing exec() from the fork()->exec() sequence, which means it will not catch new processes that only fork(). It will also show every exec(), including those if a process re-execs.


c0title: Measure the distribution of file system synchronous read and write latency (non-debuginfo)
c1name: fslatency-nd.stp
c2keywords: io filesystem
c4path: lwtools
c3description:
This dynamically traces two common file system functions: do_sync_read() and do_sync_write(), and reports a histogram distribution of latency. Many, but not all, file systems and workloads use these functions. Tracing their time provides one view of suffered file system latency.


c0title: Trace slow file system synchronous reads and writes (non-debuginfo)
c1name: fsslower-nd.stp
c2keywords: io filesystem
c4path: lwtools
c3description:
This dynamically traces two common file system functions: do_sync_read() and do_sync_write(), and shows details of each call that is slower than a threshold. Many, but not all, file systems and workloads use these functions. Tracing their time provides one view of suffered file system latency.


c0title: Trace kill() signals showing process and signal details (non-debuginfo)
c1name: killsnoop-nd.stp
c2keywords: io
c4path: lwtools
c3description:
This traces signals system-wide, including those sent by the kill(1) command, and shows various details.


c0title: Summarize read() and write() syscall latency (non-debuginfo)
c1name: rwtime-nd.stp
c2keywords: io
c4path: lwtools
c3description:
This traces read() and write() syscalls, producing a histogram summary of their durations (aka latencies).


c0title: Count syscalls with process details (non-debuginfo)
c1name: syscallbypid-nd.stp
c2keywords: io
c4path: lwtools
c3description:
This traces syscalls system-wide, and produces a summary report showing their counts by process ID, process name, and syscall types.


c0title: Count Page Cache Hits and Misses
c1name: cachestat.stp
c2keywords: memory bpf
c4path: memory
c3description:
Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.


c0title: Overview glibc malloc internal operations
c1name: glibc-malloc.stp
c2keywords: memory process
c4path: memory
c3description:
This script reports on internal statistics of the glibc malloc implementation, as used by a process restricted by stap -x/-c


c0title: Summarize the time each process spends clearing huge pages
c1name: hugepage_clear_delays.stp
c2keywords: memory
c4path: memory
c3description:
When a huge page is initially used by a process it must be cleared of its original contents to avoid leaking information between processes.  On x86_64 machines the huge pages are 2MB in size, 512 times larger than a normal 4KB page.  Thus, clearing a huge page can delay program execution by a hundred or more microseconds and maybe noticeable to latency sensitive programs.  This script will tally the number of times that each process triggers a huge page clear, the total time in microseconds spent clearing the pages, and the average time in microseconds of the huge page clear.


c0title: Log the kernel collapsing normal pages into a huge page
c1name: hugepage_collapse.stp
c2keywords: memory
c4path: memory
c3description:
The kernel may attempt to group many normal sized pages into a single huge page to improve TLB performance.  This operation may take a significant amount of time and affect program performance.  You can identify if huge page collapse operations are occurring with the systemtap hugepage_collapse.stp script.


c0title: Summarize the time each process spends doing copy on write for huge pages
c1name: hugepage_cow_delays.stp
c2keywords: memory
c4path: memory
c3description:
The system may attempt to reduce memory use by having two or more difference processes share the same writeable page in memory.  However, when one of the processes write to shared page that is marked copy on write (COW) the page must be duplicated and then modified.  On x86_64 machines the huge pages are 2MB in size, 512 times larger than a normal 4KB page.  Thus, copy on write operation on a huge page can delay program execution by a hundred or more microseconds and maybe noticeable to latency sensitive programs.  This script will tally the number of times that each process triggers a huge page copy on write, the total time in microseconds spent copying the pages, and the average time in microseconds of the huge page copy.


c0title: Log the kernel splitting huge pages into normal sized pages
c1name: hugepage_split.stp
c2keywords: memory
c4path: memory
c3description:
Because some portions of the kernel code only work with normal-sized pages the kernel may convert a huge page into a set of normal-sized pages using a split operation. This operation may be relatively expensive and noticeable to latency sensitive programs. You can identify if split operations are occurring with the systemtap hugepage_split.stp script.


c0title: Watch a Kernel Address Using Breakpoint Hardware
c1name: hw_watch_addr.stp
c2keywords: memory watchpoint
c4path: memory
c3description:
The script will watch accesses to a single kernel address and prints a traceback each time the address is accessed. This script needs to be run as root to allow access to the breakpoint hardware.


c0title: Watch a Kernel Symbol Using Breakpoint Hardware
c1name: hw_watch_sym.stp
c2keywords: memory watchpoint
c4path: memory
c3description:
The script will watch accesses to the starting address of a single kernel symbol and prints a traceback each time the symbol is accessed. This script needs to be run as root to allow access to the breakpoint hardware.


c0title: Show Paths to Kernel Malloc Invocations
c1name: kmalloc-top
c2keywords: memory
c4path: memory
c3description:
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 filtered to print only the first N stack traces (-t), stack traces with a minimum counts (-m), or exclude certain stack traces (-e).


c0title: Log recent free(3) calls.
c1name: last_100_frees.stp
c2keywords: memory process backtrace
c4path: memory
c3description:
This script reports on the last few free(3) libc calls done by processes (possibly restricted by stap -x/-c), along with a userspace backtrace at those moments.


c0title: Track Virtual Memory System Actions on Anonymous Pages
c1name: mmanonpage.stp
c2keywords: memory
c4path: memory
c3description:
The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active.  It's useful in debugging leaks in the anonymous regions of a process.


c0title: Track Virtual Memory System Actions on File Backed Pages
c1name: mmfilepage.stp
c2keywords: memory bpf
c4path: memory
c3description:
The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.


c0title: Track Virtual Memory System Page Reclamation
c1name: mmreclaim.stp
c2keywords: memory
c4path: memory
c3description:
The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. It's useful in debugging performance problems that occur due to page reclamation.


c0title: Track Virtual Memory System Writing to Disk
c1name: mmwriteback.stp
c2keywords: memory bpf
c4path: memory
c3description:
The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running.  It's useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.


c0title: Summarize Process Misses across NUMA Nodes
c1name: numa_faults.stp
c2keywords: memory numa
c4path: memory
c3description:
The numa_faults.stp script tracks the read and write pages faults for each process. When the script exits it prints out the total read and write pages faults for each process. The script also provide a break down of page faults per node for each process. This script is useful for determining whether the program has good locality (page faults limited to a single node) on a NUMA computer.


c0title: Generate Log of Major and Minor Page Faults
c1name: pfaults.stp
c2keywords: memory
c4path: memory
c3description:
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 occurring.


c0title: Collect Slab Allocation Statistics
c1name: vm.tracepoints.stp
c2keywords: memory statistics
c4path: memory
c3description:
The script will probe all memory slab/slub allocations and collects information about the size of the object (bytes requested) and user-space process in execution. When run over a period of time, it helps to correlate kernel-space memory consumption owing to user-space processes.


c0title: Log Failed Process Memory Allocation Due to Overcommit Limits
c1name: overcommit.stp
c2keywords: memory limits
c4path: memory
c3description:
The overcommit.stp script prints a line each time the kernel refuses a memory allocation request from a process because of /proc/sys/vm/overcommit* limits.


c0title: Show Process Ancestry for IP Connections
c1name: connect_stat.stp
c2keywords: network socket process
c4path: network
c3description:
The connect_stat.stp script prints a task's entire ancestry (parent process name/uid/gid) whenever it attempts an outgoing socket connection to a given IP address.


c0title: Watch Where Socket Buffers Are Freed in the Kernel
c1name: dropwatch.stp
c2keywords: network tracepoint socket
c4path: network
c3description:
Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.


c0title: Tracks time between packet queue and transmit.
c1name: net_xmit_json.stp
c2keywords: network statistics json
c4path: network
c3description:
This script tracks time between packet queue and transmit. The information is provided to userspace via procfs in JSON format.


c0title: System-Wide Network Packet Dropping Tool
c1name: netfilter_drop.stp
c2keywords: network packets guru
c4path: network
c3description:
The script drops the specified number of packets of the specified protocol. Valid protocols are TCP, UDP, or ALL. If ALL is specified, all incoming packets are dropped. The number of packets to drop can be specified with a positive integer. A value of 0 indicates that packets should be dropped until the user manually exits.


c0title: System-Wide Count of Network Packets by IPs
c1name: netfilter_summary.stp
c2keywords: _best network traffic
c4path: network
c3description:
The script watches all IPv4 network traffic on the system. On exit the script prints a list showing the number of packets sent along source IP address / destination IP address pair encountered, and the total number of bytes sent among the pair. The list is ordered from greatest to least number of packets seen among the source/destination pairs.


c0title: System-Wide Count of Network Packets by IPs
c1name: netfilter_summary_json.stp
c2keywords: _best network traffic json
c4path: network
c3description:
The script watches all IPv4 network traffic on the system. The data is output in JSON format and includes the number of packets sent along source IP address / destination IP address pair encountered, and the total number of bytes sent among the pair.


c0title: Periodic Listing of Processes Using Network Interfaces
c1name: nettop.stp
c2keywords: network traffic
c4path: network
c3description:
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.


c0title: Keep track of NFS server statistics
c1name: nfsd-recent.stp
c2keywords: nfs statistics
c4path: network
c3description:
This script tracks all nfsd server operations by client_ip address, and periodically lists those clients that have made recent requests.  It's a way of finding out which nfs clients might be considered still connected.


c0title: Trace NFSD requests with file names.
c1name: nfsd-trace.stp
c2keywords: nfs trace
c4path: network
c3description:
This script traces all nfsd server operations by client_ip address, operation, and complete file name (if possible).


c0title: Find Which Client Is Removing NFS Files on Server
c1name: nfsd_unlink.stp
c2keywords: nfs disk
c4path: network
c3description:
The nfsd_unlink.stp script lists the ip address and file name each time time a file is being removed or unlinked by the nfsd. This script is run on the nfs server.


c0title: Network packet contents
c1name: packet_contents.stp
c2keywords: network traffic
c4path: network
c3description:
The packet_contents.stp script displays the length of each network packet and its contents in both hexadecimal and ASCII. Systemtap strings are MAXSTRINGLEN in length by default which may not be enough for larger packets. In order to print larger packets, this limit can be increased by passing in the "-DMAXSTRINGLEN=65536" command line option.


c0title: Track Start and Stop of Processes Due to Network Buffer Space
c1name: sk_stream_wait_memory.stp
c2keywords: network tcp process bpf
c4path: network
c3description:
The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.


c0title: Trace Functions Called in Network Socket Code
c1name: socket-trace.stp
c2keywords: network socket
c4path: network
c3description:
The script instruments each of the functions in the Linux kernel's net/socket.c file. The script prints out trace data. 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.


c0title: Periodically Summarize Socket Activity on the System
c1name: socktop
c2keywords: network socket
c4path: network
c3description:
The socktop script periodically prints out a list of the processes with the highest socket activity.  Command line options for the script allow filtering to focus on particular types of sockets. The "-h" option lists socktop script's filtering options.


c0title: Dump of STP packets
c1name: stp_dump.stp
c2keywords: network traffic
c4path: network
c3description:
The stp_dump.stp prints out the packet contents. Each block contains the STP protocol ID, version ID, flags, root and bridge MAC addresses, and various times.


c0title: Track Creation of Incoming TCP Connections
c1name: tcp_connections.stp
c2keywords: network tcp socket
c4path: network
c3description:
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.


c0title: Increase Initial TCP Congestion Window to 10
c1name: tcp_init_cwnd.stp
c2keywords: network tcp socket guru
c4path: network
c3description:
Run the tcp_init_cwnd.stp script in the background to override a kernel's default tcp cwnd value to 10, which has been found to improve latency for web server type workloads.  The script prints a count of cwnd value changes when it is stopped.


c0title: TCP Connection Tracing Utility
c1name: tcp_trace.stp
c2keywords: network trace
c4path: network
c3description:
This scripts traces a given TCP connection based on the filter parameters given by the user. The indexing is done by the 4 tuples local address, remote address, local port, remote port.


c0title: Dump of Received UDP/TCP Packets
c1name: tcpdumplike.stp
c2keywords: network traffic
c4path: network
c3description:
The tcpdumplike.stp prints out a line for each TCP & UDP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.


c0title: Display Network Statistics for Individual TCP Sockets
c1name: tcpipstat.stp
c2keywords: network statistics
c4path: network
c3description:
The tcpipstat script collects and displays network statistics related to individual TCP sockets or groups of sockets.  The statistics that are collected are simular to that of the command netstat -s, only sorted and grouped by individual sockets.


c0title: Trace threads sending network traffic to given host and/or port
c1name: who_sent_it.stp
c2keywords: network trace traffic simple
c4path: network
c3description:
This script traces outgoing network packets using the netfilter probes (not requiring debuginfo), printing the source thread name/id and destination host:port.  It may be filtered with the_dport and the_daddr globals, e.g., to watch only for DNS traffic (port 53), and/or only to the localhost (127.0.0.1).


c0title: Generate backtraces for kernel audit events
c1name: auditbt.stp
c2keywords: monitoring security backtrace
c4path: process
c3description:
Attaches to the kernel audit-log paths (also used by libaudit), and log every record being sent, along with a user-space backtrace of the process that caused it.


c0title: Monitor Changes in Processor Executing a Task
c1name: chng_cpu.stp
c2keywords: scheduler
c4path: process
c3description:
The chng_cpu.stp script takes an argument which is the executable name of the task it should monitor. Each time a task with that executable name is found running on a different processor, the script prints out the thread id (tid), the executable name, the processor now running the task, the thread state, and a backtrace showing the kernel functions that triggered the running of the task on the processor.


c0title: Track IRQ's and Other Processes Stealing Cycles from a Task
c1name: cycle_thief.stp
c2keywords: _best process scheduler time tracepoint interrupt
c4path: process
c3description:
The cycle_thief.stp script instruments the scheduler and IRQ handler to determine which processes and interrupts are competing with the specified task for the cpu cycles. This script uses the '-c' or '-x' options to focus on a specific task. The script output the number of times the task migrates between processors, histograms showing the length of time on and off processor, lists of processes running while the task is off the processor, and the interrupts that occurred while the task was running.


c0title: Tabulate System Call Errors
c1name: errsnoop.stp
c2keywords: process syscall
c4path: process
c3description:
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).


c0title: Trace Creation of Processes
c1name: forktracker.stp
c2keywords: process scheduler
c4path: process
c3description:
The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful to determine what process is creating a flurry of short-lived processes.


c0title: System-Wide Futex Contention
c1name: futexes.stp
c2keywords: syscall locking futex
c4path: process
c3description:
The script watches the futex syscall on the system. On exit the futex's address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.


c0title: System-Wide Shared Futex Contention
c1name: futexes2.stp
c2keywords: syscall locking futex
c4path: process
c3description:
The script watches just shared futex syscalls on the system. On exit the futex's key, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.


c0title: uprobes-based ltrace
c1name: ltrace.stp
c2keywords: process
c4path: process
c3description:
The ltrace.stp script lists calls that the designated process makes through PLTs (procedure linkage tables), generally into shared libraries.


c0title: Track the Migration of Specific Executables
c1name: migrate.stp
c2keywords: scheduler
c4path: process
c3description:
The migrate.stp script takes an argument which is the executable name of the task it should monitor. Each time a task with that executable name migrates between processors an entry is printed with the process id (pid), the executable name, the processor off loading the task, and the process taking the task. Note that the task may or may not be executing at the time of the migration.


c0title: pthread mutex contention analysis
c1name: mutex-contention.stp
c2keywords: locking
c4path: process
c3description:
Tracks pthread-mutex initialization/use and underlying futex operations, to identify (with backtraces/symbol-names) the mutexes suffering most contention.  Invoke with "-d SHLIB --ldd", perhaps with -DMAXMAPENTRIES=NNNN for some large NNNN, if the arrays overflow due to heavy activity.


c0title: Disable ptrace from Hierarchies of Processes
c1name: noptrace.stp
c2keywords: process security guru
c4path: process
c3description:
Blocks ptrace(2) attempts from processes identified by stap -c/-x, as also specifiable from /proc/systemtap/stap_XXX/ control files.  Processes may be added or removed from the blocked list.


c0title: Print Process File Descriptors
c1name: pfiles.stp
c2keywords: process file
c4path: process
c3description:
Run pfiles.stp to produce a human-readable summary of all open file descriptors of a given process.  Specify the process-id as -x PID for fastest performance.


c0title: Print Resource Limits of Process
c1name: plimit.stp
c2keywords: process
c4path: process
c3description:
The script prints a variety of resource limits for a given pid, like /proc/$$/limits on recent kernels.


c0title: Monitor process creation/termination and module [un]loading
c1name: procmod_watcher.stp
c2keywords: process monitoring syscall tracepoint
c4path: process
c3description:
The procmod_watcher.stp script monitors calls to fork(), exec(), exit(), init_module(), and delete_module(). Event-specific details are also printed out (e.g. for exec(), the file being exec'ed). This script does not require debuginfo.


c0title: Periodically Print Process Information With History
c1name: proctop.stp
c2keywords: process scheduler _best
c4path: process
c3description:
Every 5 seconds, print out a list of 25 processes that took the most system time with information about the processes. Includes information on processes that may have exited while the script was running. The script contains configuration options listed in the script source.


c0title: Print Process File Descriptors
c1name: psig.stp
c2keywords: process signals
c4path: process
c3description:
Run psig.stp to produce a human-readable summary of the signal handling configuration of a given process.  Specify the process-id as -x PID for fastest performance.


c0title: Print trace of process ancestors for matching exec commands
c1name: pstrace_exec.stp
c2keywords: process backtrace
c4path: process
c3description:
The pstrace_exec.stp script watches each exec operation. If the exec contains a substring that matches the script's command-line argument, it prints out that process and all of its ancestors.


c0title: Generates a process diagram in DOT form.
c1name: pstree.stp
c2keywords: process diagram
c4path: process
c3description:
The pstree.stp script generates a process diagram in DOT form.  For instance, it may be useful on a 'make' command to see all the processes that are started.


c0title: Trace processes running out of file descriptors
c1name: rlimit_nofile.stp
c2keywords: limits
c4path: process
c3description:
This script watches processes being scheduled and which try to allocate a file descriptor without luck.


c0title: track wakeup-to-dispatch latency stats
c1name: sched-latency.stp
c2keywords: process scheduler time tracepoint
c4path: process
c3description:
This script periodically reports a histogram of the latency between a task (thread) being woken up and it actually being dispatched to a CPU: the amount of time it's spent in the runnable queue.


c0title: Track Time Processes Spend in Various States Using Tracepoints
c1name: schedtimes.stp
c2keywords: process scheduler time tracepoint
c4path: process
c3description:
The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends in running, sleeping, queuing, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed.  Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID and its children.


c0title: Track SIGKILL Signals
c1name: sigkill.stp
c2keywords: signals
c4path: process
c3description:
The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the destination executable and process ID, the executable name and user ID that sents the signal.


c0title: Track a Particular Signal to a Specific Process
c1name: sigmon.stp
c2keywords: signals
c4path: process
c3description:
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.


c0title: Generate Backtraces of Threads Waiting for IO Operations
c1name: sleepingBeauties.stp
c2keywords: io scheduler backtrace
c4path: process
c3description:
The script monitors the time that threads spend in 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.


c0title: Trace Time Spent in Nanosleep Syscalls
c1name: sleeptime.stp
c2keywords: syscall nanosleep
c4path: process
c3description:
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 parentheses, the "nanosleep:" key, and the duration of the sleep in microseconds.


c0title: Track Creation of Processes by process and execname
c1name: spawn_seeker.stp
c2keywords: process scheduler
c4path: process
c3description:
The spawn_seeker.stp script every minute (and on exit) prints out the local time and sorted lists of which processes and executables spawned tasks during the previous minute. This can be useful to determine what process is creating a flurry of short-lived processes.  When a process exits its count of tasks created is added to its parent's count to better account for the indirect task creation by children processes.  For more detailed examination of task creation consider using forktracker.stp.


c0title: Trace system calls
c1name: strace.stp
c2keywords: _best process syscall
c4path: process
c3description:
The script loosely emulates strace, when applied to individual processes or hierarchies (via -c/-x), or the entire system (without -c/-x).  A few output configuration parameters may be set with -G.


c0title: System-Wide Count of Syscalls by PID
c1name: syscalls_by_pid.stp
c2keywords: syscall
c4path: process
c3description:
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.


c0title: System-Wide Count of Syscalls by Executable
c1name: syscalls_by_proc.stp
c2keywords: syscall
c4path: process
c3description:
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 greatest to least number of syscalls.


c0title: System-Wide Syscall Statistics with Filtering
c1name: syscalltimes
c2keywords: syscall
c4path: process
c3description:
Combination shell/systemtap script to measure system call counts and times.  Can be filtered by process IDs, process names and users.


c0title: monitor syscall history
c1name: thread-business.stp
c2keywords: _best process syscall
c4path: process
c3description:
Prints a periodic tabular report about the counts of syscall activity of all threads on the system, along with a textual recent-syscall-history for each


c0title: Override default new-pthread stack sizes
c1name: threadstacks.stp
c2keywords: thread guru
c4path: process
c3description:
Overrides default NPTL pthread_create stack size for all new threads created by target processes.  Reports one line per process when the related glibc variable __default_stacksize is updated.  Moot for glibc versions that support $LIBC_PTHREAD_DEFAULT_STACKSIZE_NP.


c0title: Trace Time Spent in wait4 Syscalls
c1name: wait4time.stp
c2keywords: syscall process
c4path: process
c3description:
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 parentheses, 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".


c0title: Monitor capabilities and syscalls used by a process and it children
c1name: container_check.stp
c2keywords: profiling container syscall
c4path: profiling
c3description:
The container_check.stp script monitors the use of linux capablities and optionally forbidden syscalls by a process and its children.  On exit the script prints out lists showing the capabilies used by each executable, which syscall used specific capabilites for each executable, a list of forbidden syscalls used, and details on any syscalls that failed during monitoring.  This script is designed to help diagnose issues caused by restricted capabilies and syscalls when running an application in a container.  If the script warns about skipped probes, the number of active kretprobes may need to be increased with "-DKRETACTIVE=100" option on the command line


c0title: Show Which Processes and System Calls Return Errors Most Frequently
c1name: errno.stp
c2keywords: profiling
c4path: profiling
c3description:
On exit the errno.stp script provides a sorted list showing which combination of PID, system call, and error occur most frequently.


c0title: Profile Kernel/User Functions
c1name: fileline-profile.stp
c2keywords: profiling
c4path: profiling
c3description:
The fileline-profile.stp script ends by printing out a sorted list of the top twenty kernel and/or user processes providing file:line information, if available, from the samples addresses gathered over the time period the script is run. Use any of --ldd, --all-modules, -d MODULE, -d /PATH/TO/EXEC to add more symbolic info. To include the symbol name in the output, specify guru mode (-g) and add symbolname="yes" to the stap command.


c0title: Show Functions Taking Longer Than Usual
c1name: fntimes.stp
c2keywords: _best profiling
c4path: profiling
c3description:
The fntimes.stp script monitors the execution time history of a given function family (assumed non-recursive).  Each time (beyond a warmup interval) is then compared to the historical maximum.  If it exceeds a certain threshold (250%), a message is printed.


c0title: Monitor which executables use ioctl syscalls and what kernel code is handling the ioctl
c1name: ioctl_handler.stp
c2keywords: profiling
c4path: profiling
c3description:
The ioctl systemcall is used to manipulate devices setting or special files.  The way that ioctl syscalls are handled depend greatly on the device the special file is associated with. Using strace to monitor the open and ioctl syscalls may not give a good indication of what kernel code is actually handling the ioctl operations.  The ioctl_handler.stp script is designed to provide more details. On exit the ioctl_handler.stp script provides a count of the ioctl syscalls for each executable run on the system. If there was some special device driver code used to handle to the ioctl, the output will have a tally of the times the function name and module was called for that executable.  The "--all-modules" option should be included on the command line so the script can provide function name information.


c0title: Show Reasons and Durations for Processes Sleeping
c1name: latencytap.stp
c2keywords: _best profiling
c4path: profiling
c3description:
The latencytap.stp script collects data on the intervals processes are deactivated (sleeping).  The script categorizes the reasons for the sleeps by analyzing the backtraces and displays a sorted list of the top 20 causes from largest total sum time sleeping to smallest. The output is updated every 30 seconds. The script needs to be compiled with the '--all-modules' option to produce reasons for sleeps caused by modules.  Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.


c0title: Show Time Spent on Each Line of a Function
c1name: linetimes.stp
c2keywords: profiling _best
c4path: profiling
c3description:
The linetimes.stp script takes two arguments: where to find the function and the function name. linetimes.stp will instrument each line in the function. It will print out the number of times that the function is called, a table with the average and maximum time each line takes, and control flow information when the script exits.


c0title: Show performance ratios using perf.counter to access performance counters
c1name: perf.stp
c2keywords: profiling
c4path: profiling
c3description:
On exit the perf.stp script provides a sorted list showing cycles per insn, branches per insn, and cache refs per insn


c0title: Show the Period of the Various Timers on the System
c1name: periodic.stp
c2keywords: profiling
c4path: profiling
c3description:
The periodic.stp script uses the  kernel.trace("timer_expire_entry") tracepoint to collect data on period and frequency of the various timers on the system.  The script displays a sorted list of the timers observed on the system from most frequent to least frequent. The script needs to be compiled with the '--all-modules' option to produce list the function names.  Optionally, this script can be used with a numerical argument to indicate the interval in seconds between printing output.


c0title: Profile Kernel Functions
c1name: pf2.stp
c2keywords: profiling
c4path: profiling
c3description:
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.


c0title: Profile Kernel/User Functions
c1name: pf3.stp
c2keywords: profiling
c4path: profiling
c3description:
The pf3.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty kernel and/or user functions with samples.  Use any of --ldd, --all-modules, -d MODULE, -d /PATH/TO/EXEC to add more symbolic info.


c0title: Profile Kernel/User Backtraces
c1name: pf4.stp
c2keywords: _best profiling backtrace
c4path: profiling
c3description:
The pf4.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty kernel and/or user stack backtraces (on a per-cpu basis).  Use any of --ldd, --all-modules, -d MODULE, -d /PATH/TO/EXEC to add more symbolic info.


c0title: Display the Task Switches Happening in the Scheduler
c1name: sched_switch.stp
c2keywords: profiling function
c4path: profiling
c3description:
The sched_switch.stp script takes two arguments, first argument can be "pid" or "name" to indicate what is being passed as second argument. The script will trace the process based on pid/name and print the scheduler switches happening with the process. If no arguments are passed, it displays all the scheduler switches. This can be used to understand which tasks schedule out the current process being traced, and when it gets scheduled in again.


c0title: Provide a per-process syscall error tally on the system
c1name: syscallerrorsbypid.stp
c2keywords: prometheus process syscall tracepoint
c4path: profiling
c3description:
The syscallerrorsbypid.stp script tallies syscall errors for each running process.  This information can be useful to whether there are excessive errors for various processes on the system.  The script makes the information available via procfs in Prometheus readable format.  When a process exits its data will be eliminated from the prometheus output.  To avoid exceeding the storage limitations of SystemTap older entries maybe overwritten by newer entries.  This can lead to some active process syscall error counts disappearing and/or later reappearing with a lower value.  Also note that the script does not properly name syscalls for 32-bit applications running on 64-bit machines.


c0title: Provide a per-process accumulation of syscall latency on the system
c1name: syscalllatency.stp
c2keywords: prometheus process syscall tracepoint
c4path: profiling
c3description:
The syscalllatency.stp script accumulates syscall latency for each running process.  This information can be useful to whether excessive time is being spent in particular syscalls on the system.  The script makes the information available via procfs in Prometheus readable format.  When a process exits its data will be eliminated from the prometheus output.  To avoid exceeding the storage limitations of SystemTap older entries maybe overwritten by newer entries.  This can lead to some active process syscall error counts disappearing and/or later reappearing with a lower value.  Also note that the script does not properly name syscalls for 32-bit applications running on 64-bit machines.


c0title: Provide a per-process syscall tally on the system
c1name: syscallsbypid.stp
c2keywords: prometheus process syscall tracepoint
c4path: profiling
c3description:
The syscallsbypid.stp script tallies each syscall for each running process.  This information can be useful to determine the activity of various processes on the system.  The script makes the information available via procfs in Prometheus readable format.  When a process exits its data will be eliminated from the prometheus output.  To avoid exceeding the storage limitations of SystemTap older entries maybe overwritten by newer entries.  This can lead to some active process syscall counts disappearing and/or later reappearing with a lower value.  Also note that the script does not properly name syscalls for 32-bit applications running on 64-bit machines.


c0title: Provide a tally of read and write syscalls run on the system
c1name: syscallsrw.stp
c2keywords: prometheus syscall bpf
c4path: profiling
c3description:
The syscallsrw.stp script tallies the read and write syscalls. This is a demo script for stapbpf prometheus-exporter scripts.


c0title: Profile Kernel Functions
c1name: thread-times.stp
c2keywords: _best profiling
c4path: profiling
c3description:
The thread-times.stp script sets up time-based sampling.  Every five seconds it prints out a sorted list with the top twenty threads occupying the CPUs, broken down as a percentage of user and kernel time.


c0title: Show Processes Doing Polling Operations
c1name: timeout.stp
c2keywords: profiling
c4path: profiling
c3description:
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.


c0title: Show Processes Doing Polling Operations
c1name: topsys.stp
c2keywords: profiling
c4path: profiling
c3description:
 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.


c0title: Profile method invocations in Java, Perl, Php, Python, Ruby, and Tcl scripts
c1name: ucalls.stp
c2keywords: profiling syscall
c4path: profiling
c3description:
The ucalls.stp script is modeled after the BCC ucalls script (https://github.com/iovisor/bcc/blob/master/tools/lib/ucalls.py) by Sasha Goldshtein. The ucalls.stp script monitors the process indicated by the -x or -c option.  When the scripts exits it prints out information about the number of times that each method is invoked for code written in Java, Perl, Php, Python, Ruby, and Tcl.  Include the word "syscalls" on the command line to count syscalls invoked by the process.  If you want latency information, include "latency" on the command line. Note that the latency option does not work for recursive functions


c0title: Count Times Functions Are Called
c1name: functioncallcount.stp
c2keywords: profiling function
c4path: profiling
c3description:
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.


c0title: Time Statistics on KVM Exit Reasons
c1name: kvm_service_time.stp
c2keywords: _best virtualization kvm
c4path: virtualization
c3description:
The kvm_service_time.stp script tracks the statistics about the amount of time that the processor left the guest virtual machine for each exit reason (for example fixing up a page table or handling an IO operation).  When the script exits it prints out the number of times each exit reason was encountered, the total duration of time it left the guest VM, the minimum time, the average time, and the maximum time in microseconds for that exit reason. On Linux 2.6.38 and newer kernel the script can automatically determine whether it is running on Intel or AMD processors. For older kernels with a kernel.trace("kvm_exit") tracepoint that does not have the $isa parameter you can explicitly state the kvm type with a "-G kvm=intel" or "-G kvm=amd" on the command line.


c0title: Tally the Number of User-Space QEMU Events
c1name: qemu_count.stp
c2keywords: virtualization qemu kvm
c4path: virtualization
c3description:
The qemu_count.stp script tallies the number of times each of the user-space qemu probepoints is encountered. When the script exits, it prints a list of the number of times each user-space qemu probepoint is encountered.


c0title: Tally the Number of User-Space QEMU IO on Each IO Port
c1name: qemu_io.stp
c2keywords: virtualization qemu kvm io
c4path: virtualization
c3description:
The qemu_io.stp script tallies the number of times each of the IO port on the guest virtual machines is touched by a input or output operation. When the script exits, it prints a count of the number of times each IO port read and written.


