xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Docs/Examples/pl_subcalls_example.txt (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1The following are examples of pl_subcalls.d.
2
3This is a simple script to count executed Perl subroutines. Here it traces
4an example program, Code/Perl/func_abc.pl.
5
6   # pl_subcalls.d
7   Tracing... Hit Ctrl-C to end.
8   ^C
9    FILE                             SUB                                 CALLS
10    func_abc.pl                      func_a                                  1
11    func_abc.pl                      func_b                                  1
12    func_abc.pl                      func_c                                  1
13
14While tracing, func_a() from the program "func_abc.pl" was executed once,
15along with func_b() and func_c().
16
17
18
19The following traces a Perl network interface statistics tool, "nicstat"
20version 0.99,
21
22   # pl_subcalls.d
23   Tracing... Hit Ctrl-C to end.
24   ^C
25    FILE                             SUB                                 CALLS
26    Config.pm                        DESTROY                                 1
27    Config.pm                        TIEHASH                                 1
28    Config.pm                        import                                  1
29    DynaLoader.pm                    bootstrap                               1
30    DynaLoader.pm                    dl_load_flags                           1
31    Std.pm                           getopts                                 1
32    nicstat                          fetch_net_data                          1
33    nicstat                          find_nets                               1
34    register.pm                      import                                  1
35    warnings.pm                      BEGIN                                   1
36    Config.pm                        BEGIN                                   2
37    DynaLoader.pm                    BEGIN                                   2
38    Exporter.pm                      import                                  2
39    register.pm                      mkMask                                  2
40    vars.pm                          import                                  2
41    Kstat.pm                         BEGIN                                   3
42    nicstat                          BEGIN                                   3
43    vars.pm                          BEGIN                                   3
44    Config.pm                        FETCH                                   4
45    strict.pm                        unimport                                4
46    strict.pm                        import                                  5
47    AutoLoader.pm                    BEGIN                                   6
48    strict.pm                        bits                                    6
49    nicstat                          print_neat                             18
50
51The number of subroutines called by nicstat can be seen above, which includes
52subroutines from libraries and modules that the program used.
53
54