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