-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyword-index.txt
3323 lines (2125 loc) · 112 KB
/
keyword-index.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
SYSTEMTAP EXAMPLES INDEX BY KEYWORD
(see also index.txt)
For systemtap version 3.0.
= _BEST =
general/eventcount.stp - Count Specified Events
keywords: _best statistics thread process
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, see the script
source.
# stap eventcount.stp syscall.* -c 'sleep 1'
general/helloworld.stp - SystemTap "Hello World" Program
keywords: _best simple
A basic "Hello World" program implemented in SystemTap script. It
prints out "hello world" message and then immediately exits.
# stap helloworld.stp
general/para-callgraph.stp - Callgraph Tracing with Arguments
keywords: _best trace callgraph
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.
# stap para-callgraph.stp 'kernel.function("*@fs/proc*.c")' \
'kernel.function("vfs_read")' -c "cat /proc/sys/vm/* || true"
general/varwatch.stp - Watch a Variable Changing Value in a Thread
keywords: _best monitoring
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.
# stap -w varwatch.stp 'kernel.statement("do_sys_open@fs/open.c:*")' \
'$$vars' -c "sleep 1"
general/whythefail.stp - Why did the function fail?
keywords: speculation monitoring function trace _best
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.
# stap whythefail.stp kernel sys_open '$return < 0' -c 'cat \
/root/no-such-file || true'
network/netfilter_summary.stp - System-Wide Count of Network Packets by IPs
keywords: _best network traffic
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.
# stap netfilter_summary.stp -c "sleep 1"
network/netfilter_summary_json.stp - System-Wide Count of Network Packets by IPs
keywords: _best network traffic json
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.
# stap netfilter_summary_json.stp -c "sleep 1"
process/cycle_thief.stp - Track IRQ's and Other Processes Stealing Cycles from a Task
keywords: _best process scheduler time tracepoint interrupt
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.
# stap cycle_thief.stp -c "sleep 1"
process/proctop.stp - Periodically Print Process Information With History
keywords: process scheduler _best
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.
# stap proctop.stp -c "sleep 1"
process/strace.stp - Trace system calls
keywords: _best process syscall
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.
# stap strace.stp -c "sleep 1"
process/thread-business.stp - monitor syscall history
keywords: _best process syscall
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
# stap thread-business.stp -c "sleep 10"
profiling/fntimes.stp - Show Functions Taking Longer Than Usual
keywords: _best profiling
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.
# stap fntimes.stp 'kernel.function("sys_*")' -c "sleep 7"
profiling/latencytap.stp - Show Reasons and Durations for Processes Sleeping
keywords: _best profiling
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.
# stap latencytap.stp --all-modules -c "sleep 1"
profiling/linetimes.stp - Show Time Spent on Each Line of a Function
keywords: profiling _best
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.
# stap linetimes.stp kernel sys_nanosleep -c "sleep 1"
profiling/pf4.stp - Profile Kernel/User Backtraces
keywords: _best profiling backtrace
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.
# stap pf4.stp -c "sleep 6" --all-modules --ldd
profiling/thread-times.stp - Profile Kernel Functions
keywords: _best profiling
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.
# stap thread-times.stp -c "sleep 1"
stapgames/2048.stp - 2048
keywords: _best stapgames
The modern classic 2048 sliding-tiles game, using local keyboard and
ansi animation.
# stap -p4 2048.stp
virtualization/kvm_service_time.stp - Time Statistics on KVM Exit Reasons
keywords: _best virtualization kvm
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.
# stap kvm_service_time.stp -c "sleep 1"
= AUDIT =
process/auditbt.stp - Generate backtraces for kernel audit events
keywords: monitoring security audit backtrace
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.
# stap auditbt.stp -d /usr/bin/sudo --ldd -c "sudo true"
= AUTOFS =
network/autofs4.stp - Watch autofs4 Operations
keywords: network autofs nfs
Trace key autofs4 operations such as mounting or unmounting remote
filesystems.
# stap autofs4.stp -c "sleep 1"
= BACKTRACE =
general/watchdog.stp - Watchdog Timer for Arbitrary Events
keywords: watchdog backtrace
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.
# stap watchdog.stp 'syscall.nanosleep' 'syscall.nanosleep.return' 1000 \
-c "sleep 1"
interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt
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.
# stap scf.stp -c "sleep 1"
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.
# stap io_submit.stp -c "sleep 1"
memory/last_100_frees.stp - Log recent free(3) calls.
keywords: memory process backtrace
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.
# stap last_100_frees.stp -c "stap -V" -d `which stap` --ldd
process/auditbt.stp - Generate backtraces for kernel audit events
keywords: monitoring security audit backtrace
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.
# stap auditbt.stp -d /usr/bin/sudo --ldd -c "sudo true"
process/pstrace_exec.stp - Print trace of process ancestors for matching exec commands
keywords: process backtrace
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.
# stap pstrace_exec.stp -c "sleep 1" bash
process/sleepingBeauties.stp - Generate Backtraces of Threads Waiting for IO Operations
keywords: io scheduler backtrace
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.
# stap sleepingBeauties.stp -c "sleep 1"
profiling/pf4.stp - Profile Kernel/User Backtraces
keywords: _best profiling backtrace
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.
# stap pf4.stp -c "sleep 6" --all-modules --ldd
= CALLGRAPH =
general/callgraph.stp - Callgraph Tracing
keywords: simple trace callgraph
Print a timed per-thread microsecond-timed nested callgraph. The
first parameter names the function probe points to trace.
# stap callgraph.stp 'kernel.function("*@fs/proc*.c")' -c "cat \
/proc/sys/vm/* || true"
general/para-callgraph-verbose.stp - Callgraph Tracing with Verbose Arguments
keywords: trace callgraph
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.
# stap para-callgraph-verbose.stp 'kernel.function("*@fs/proc*.c")' \
'kernel.function("vfs_read")' -c "cat /proc/sys/vm/* || true"
general/para-callgraph.stp - Callgraph Tracing with Arguments
keywords: _best trace callgraph
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.
# stap para-callgraph.stp 'kernel.function("*@fs/proc*.c")' \
'kernel.function("vfs_read")' -c "cat /proc/sys/vm/* || true"
= CPU =
general/graphs.stp - Graphing Disk and CPU Utilization
keywords: disk cpu utilization
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.
# stap graphs.stp -c "sleep 1"
= DEVICE =
network/netdev.stp - Trace Activity on Network Devices
keywords: network device traffic
The netdev.stp script traces configuration and transmit/receive
activity on network devices.
# stap netdev.stp -c "sleep 1"
= DIAGRAM =
process/pstree.stp - Generates a process diagram in DOT form.
keywords: process diagram
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.
# stap pstree.stp -c "sleep 1"
= DISK =
general/graphs.stp - Graphing Disk and CPU Utilization
keywords: disk cpu utilization
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.
# stap graphs.stp -c "sleep 1"
io/deviceseeks.stp - Histograms of Seek Behavior for Each Device
keywords: disk
The deviceseeks.stp script generates a histogram showing the
frequency of different sized seeks (in sectors) on each device.
# stap deviceseeks.stp -c "sleep 1"
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.
# stap disktop.stp -c "sleep 1"
io/enospc.stp - Report an disk out-of-space condition.
keywords: disk filesystem
This script monitors a filesystem implementations for early internal
indications of ENOSPC, and reports these to the system logger and the
systemtap console.
# stap enospc.stp -c "sleep 1"
io/mbrwatch.stp - Monitor Read/Write of the Boot Sector Area of Block Devices
keywords: io monitoring disk
The mbrwatch.stp script reports any attempted reads/writes of the
first few sectors of a raw block device.
# stap mbrwatch.stp -c "dd of=/dev/null count=1 if=/dev/`grep -v major \
/proc/partitions | grep . | grep -v 'sr[0-9]' | awk '{print $4}' | \
head -1`"
network/nfsd_unlink.stp - Find Which Client Is Removing NFS Files on Server
keywords: nfs disk
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.
# stap nfsd_unlink.stp -c "sleep 1"
= FILE =
io/iotime.stp - Trace Time Spent in Read and Write for Files
keywords: profiling syscall io file
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.
# stap iotime.stp -c "sleep 1"
process/pfiles.stp - Print Process File Descriptors
keywords: process file
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.
# stap -g pfiles.stp -x $$
= FILESYSTEM =
general/badname.stp - Bad Filename Filter
keywords: filesystem guru
The badname.stp script shows how one could prevent the creation of
files with undesirable names using guru mode.
# stap -g badname.stp -c "touch /tmp/myXXXbadnameXXXfile.$$ 2>&1 | grep \
denied"
io/enospc.stp - Report an disk out-of-space condition.
keywords: disk filesystem
This script monitors a filesystem implementations for early internal
indications of ENOSPC, and reports these to the system logger and the
systemtap console.
# stap enospc.stp -c "sleep 1"
lwtools/fslatency-nd.stp - Measure the distribution of file system synchronous read and write latency (non-debuginfo)
keywords: io filesystem
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.
# stap fslatency-nd.stp 1 1
lwtools/fsslower-nd.stp - Trace slow file system synchronous reads and writes (non-debuginfo)
keywords: io filesystem
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.
# stap fsslower-nd.stp -c "sleep 1"
= FORMAT =
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.
# stap ansi_colors.stp
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.
# stap ansi_colors2.stp
= FUNCTION =
general/func_time_stats.stp - Function Time Statistics
keywords: function statistics
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.
# stap func_time_stats.stp 'syscall.nanosleep' -c "sleep 1"
general/whythefail.stp - Why did the function fail?
keywords: speculation monitoring function trace _best
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.
# stap whythefail.stp kernel sys_open '$return < 0' -c 'cat \
/root/no-such-file || true'
profiling/functioncallcount.stp - Count Times Functions Are Called
keywords: profiling function
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.
# stap -w functioncallcount.stp "*@mm/*.c" -c "sleep 1"
profiling/sched_switch.stp - Display the Task Switches Happening in the Scheduler
keywords: profiling function
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.
# stap sched_switch.stp -c "sleep 1"
= FUTEX =
process/futexes.stp - System-Wide Futex Contention
keywords: syscall locking futex
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.
# stap futexes.stp -c "sleep 1"
process/futexes2.stp - System-Wide Shared Futex Contention
keywords: syscall locking futex
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.
# stap futexes2.stp -c "sleep 1"
= GURU =
general/badname.stp - Bad Filename Filter
keywords: filesystem guru
The badname.stp script shows how one could prevent the creation of
files with undesirable names using guru mode.
# stap -g badname.stp -c "touch /tmp/myXXXbadnameXXXfile.$$ 2>&1 | grep \
denied"
io/eatmydata.stp - disable fsync
keywords: io guru simple
Suppresses fsync() syscalls from processes identified by stap -c/-x
by turning them into presumed-faster fsync() on some dummy or other
file descriptor
# stap -g eatmydata.stp -c 'strace ls || true'
io/ttyspy.stp - Monitor TTY Typing
keywords: io tty monitoring guru
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.
# stap --skip-badvars -g ttyspy.stp -c "sleep 1"
network/netfilter_drop.stp - System-Wide Network Packet Dropping Tool
keywords: network packets guru
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.
# stap -g netfilter_drop.stp TCP 1 -c "sleep 2"
network/tcp_init_cwnd.stp - Increase Initial TCP Congestion Window to 10
keywords: network tcp socket guru
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.
# stap -g tcp_init_cwnd.stp -c "sleep 1"
process/noptrace.stp - Disable ptrace from Hierarchies of Processes
keywords: process security guru
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.
# stap -g noptrace.stp -c 'strace ls || true'
process/threadstacks.stp - Override default new-pthread stack sizes
keywords: thread guru
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.
# stap -g threadstacks.stp -Gsize=65536 -c "sleep 1" -d `which stap`
= INTERRUPT =
interrupt/interrupts-by-dev.stp - Record Interrupts on a Per-Device Basis
keywords: interrupt
The interrupts-by-dev.stp script profiles interrupts received by each
device per 100 ms.
# stap interrupts-by-dev.stp -c "sleep 1"
interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt
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.
# stap scf.stp -c "sleep 1"
process/cycle_thief.stp - Track IRQ's and Other Processes Stealing Cycles from a Task
keywords: _best process scheduler time tracepoint interrupt
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.
# stap cycle_thief.stp -c "sleep 1"
= IO =
general/alias_suffixes.stp - Count I/O Syscalls using Alias Suffixes
keywords: io statistics
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.
# stap alias_suffixes.stp -c "sleep 1"
io/eatmydata.stp - disable fsync
keywords: io guru simple
Suppresses fsync() syscalls from processes identified by stap -c/-x
by turning them into presumed-faster fsync() on some dummy or other
file descriptor
# stap -g eatmydata.stp -c 'strace ls || true'
io/inodewatch.stp - Monitoring Reads and Writes to a File
keywords: io
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.
# stap inodewatch.stp 0x08 0x01 100 -c "sleep 1"
io/inodewatch2.stp - Monitoring Attribute Changes to a File
keywords: io
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.
# stap inodewatch2.stp 0x08 0x01 100 -c "sleep 1"
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.
# stap io_submit.stp -c "sleep 1"
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 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.
# stap ioblktime.stp -c "sleep 1"
io/iodevstats.stp - List Executables Reading and Writing the Most Data by Device
keywords: io profiling
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.
# stap iodevstats.stp -c "sleep 1"
io/iostat-scsi.stp - IO Statistics for SCSI Devices
keywords: io profiling scsi
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.
# stap -g iostat-scsi.stp 1 -c "sleep 1"
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.
# stap iostats.stp -c "sleep 1"
io/iotime.stp - Trace Time Spent in Read and Write for Files
keywords: profiling syscall io file
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.
# stap iotime.stp -c "sleep 1"
io/iotop.stp - Periodically Print IO 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.
# stap iotop.stp -c "sleep 1"
io/mbrwatch.stp - Monitor Read/Write of the Boot Sector Area of Block Devices
keywords: io monitoring disk
The mbrwatch.stp script reports any attempted reads/writes of the
first few sectors of a raw block device.
# stap mbrwatch.stp -c "dd of=/dev/null count=1 if=/dev/`grep -v major \
/proc/partitions | grep . | grep -v 'sr[0-9]' | awk '{print $4}' | \
head -1`"
io/nfs_func_users.stp - Tally the Number of NFS Functions Used by Each Process
keywords: io profiling
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.
# stap nfs_func_users.stp -c "sleep 1"
io/slowvfs.stp - Trace slow vfs opens.
keywords: io
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.
# stap slowvfs.stp -G sloth=10 -c 'find /proc >/dev/null'
io/switchfile.stp - Switch log files
keywords: io
Every second print a log message and switch log files every 5
seconds.
# stap -o switchfile.stp.out switchfile.stp -c "sleep 8"
io/traceio.stp - Track Cumulative IO 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.
# stap traceio.stp -c "sleep 1"
io/traceio2.stp - Watch IO Activity on a Particular Device
keywords: io
Print out the executable name and process number as reads and writes
to the specified device occur.
# stap traceio2.stp 0x0801 -c "sleep 1"
io/ttyspy.stp - Monitor TTY Typing
keywords: io tty monitoring guru
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.
# stap --skip-badvars -g ttyspy.stp -c "sleep 1"
lwtools/biolatency-nd.stp - Measure block I/O latency distribution (non-debuginfo)
keywords: io
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.
# stap biolatency-nd.stp 1 1
lwtools/bitesize-nd.stp - Measure block I/O size distribution (non-debuginfo)
keywords: io
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.
# stap bitesize-nd.stp -c "sleep 1"
lwtools/execsnoop-nd.stp - Trace process exec() with command line argument details (non-debuginfo)
keywords: io
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.
# stap execsnoop-nd.stp -c "sleep 1"