xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Docs/Examples/sh_lines_example.txt (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1The following are examples of sh_lines.d.
2
3This is a simple script to count Bourne shell line execution. Here it traces an
4example program, Code/Shell/func_slow.sh.
5
6   # sh_lines.d
7   Tracing... Hit Ctrl-C to end.
8   ^C
9
10                                FILE:LINE        COUNT
11                        func_slow.sh:5               1
12                        func_slow.sh:6               1
13                        func_slow.sh:15              1
14                        func_slow.sh:16              1
15                        func_slow.sh:21              1
16                        func_slow.sh:26              1
17                        func_slow.sh:27              1
18                        func_slow.sh:32              1
19                        func_slow.sh:35              1
20                        func_slow.sh:30            100
21                        func_slow.sh:28            101
22                        func_slow.sh:19            200
23                        func_slow.sh:17            201
24                        func_slow.sh:9             300
25                        func_slow.sh:7             301
26                        func_slow.sh:1             600
27
28The most frequently executed line was line 1 of func_slow.sh - which is actually
29line 1 of func_slow.sh subshells (command substitution, ` `). Apart from
30this slight confusion, the rest of the output should make sense (and most
31scripts only call one line in command substitution anyway).
32
33