• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Demonstrations of ucalls.
2
3
4ucalls summarizes method calls in various high-level languages, including Java,
5Perl, PHP, Python, Ruby, Tcl, and Linux system calls. It displays statistics on
6the most frequently called methods, as well as the latency (duration) of these
7methods.
8
9Through the syscalls support, ucalls can provide basic information on a
10process' interaction with the system including syscall counts and latencies.
11This can then be used for further exploration with other BCC tools like trace,
12argdist, biotop, fileslower, and others.
13
14For example, to trace method call latency in a Java application:
15
16# ucalls -L $(pidof java)
17Tracing calls in process 26877 (language: java)... Ctrl-C to quit.
18
19METHOD                                              # CALLS TIME (us)
20java/io/BufferedInputStream.getBufIfOpen                  1 7.00
21slowy/App.isSimplePrime                                8970 8858.35
22slowy/App.isDivisible                               3228196 3076985.12
23slowy/App.isPrime                                      8969 4841017.64
24^C
25
26
27To trace only syscalls in a particular process and print the top 10 most
28frequently-invoked ones:
29
30# ucalls -ST 10 3018
31Attached 375 kernel probes for syscall tracing.
32Tracing calls in process 3018 (language: none)... Ctrl-C to quit.
33
34METHOD                                              # CALLS
35sys_rt_sigaction                                          4
36SyS_rt_sigprocmask                                        4
37sys_mprotect                                              5
38sys_read                                                 22
39SyS_write                                                39
40SyS_epoll_wait                                           42
41sys_futex                                               177
42SyS_mmap                                                180
43sys_mmap_pgoff                                          181
44sys_munmap                                              817
45^C
46Detaching kernel probes, please wait...
47
48
49To print only the top 5 methods and report times in milliseconds (the default
50is microseconds):
51
52# ucalls -mT 5 $(pidof python)
53Tracing calls in process 26914 (language: python)... Ctrl-C to quit.
54
55METHOD                                              # CALLS
56<stdin>.<module>                                          1
57<stdin>.fibo                                       14190928
58^C
59
60
61USAGE message:
62
63# ./ucalls.py -h
64usage: ucalls.py [-h] [-l {java,perl,php,python,ruby,tcl,none}] [-T TOP] [-L] [-S] [-v]
65                 [-m]
66                 pid [interval]
67
68Summarize method calls in high-level languages.
69
70positional arguments:
71  pid                   process id to attach to
72  interval              print every specified number of seconds
73
74optional arguments:
75  -h, --help            show this help message and exit
76  -l {java,perl,php,python,ruby,tcl,none}, --language {java,perl,php,python,ruby,tcl,none}
77                        language to trace (if none, trace syscalls only)
78  -T TOP, --top TOP     number of most frequent/slow calls to print
79  -L, --latency         record method latency from enter to exit (except
80                        recursive calls)
81  -S, --syscalls        record syscall latency (adds overhead)
82  -v, --verbose         verbose mode: print the BPF program (for debugging
83                        purposes)
84  -m, --milliseconds    report times in milliseconds (default is microseconds)
85
86examples:
87    ./ucalls -l java 185        # trace Java calls and print statistics on ^C
88    ./ucalls -l python 2020 1   # trace Python calls and print every second
89    ./ucalls -l java 185 -S     # trace Java calls and syscalls
90    ./ucalls 6712 -S            # trace only syscall counts
91    ./ucalls -l ruby 1344 -T 10 # trace top 10 Ruby method calls
92    ./ucalls -l ruby 1344 -L    # trace Ruby calls including latency
93    ./ucalls -l php 443 -LS     # trace PHP calls and syscalls with latency
94    ./ucalls -l python 2020 -mL # trace Python calls including latency in ms
95