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 -l none -ST 10 7913 31Attached kernel tracepoints for syscall tracing. 32Tracing calls in process 7913 (language: none)... Ctrl-C to quit. 33^C 34METHOD # CALLS 35timerfd_settime 9 36tgkill 10 37getpid 10 38stat 80 39writev 158 40pselect6 204 41rt_sigreturn 301 42rt_sigprocmask 872 43poll 1387 44recvmsg 1417 45Detaching kernel probes, please wait... 46 47 48To print only the top 5 methods and report times in milliseconds (the default 49is microseconds): 50 51# ucalls -mT 5 $(pidof python) 52Tracing calls in process 26914 (language: python)... Ctrl-C to quit. 53 54METHOD # CALLS 55<stdin>.<module> 1 56<stdin>.fibo 14190928 57^C 58 59 60USAGE message: 61 62# ./ucalls.py -h 63usage: ucalls.py [-h] [-l {java,perl,php,python,ruby,tcl,none}] [-T TOP] [-L] [-S] [-v] 64 [-m] 65 pid [interval] 66 67Summarize method calls in high-level languages. 68 69positional arguments: 70 pid process id to attach to 71 interval print every specified number of seconds 72 73optional arguments: 74 -h, --help show this help message and exit 75 -l {java,perl,php,python,ruby,tcl,none}, --language {java,perl,php,python,ruby,tcl,none} 76 language to trace (if none, trace syscalls only) 77 -T TOP, --top TOP number of most frequent/slow calls to print 78 -L, --latency record method latency from enter to exit (except 79 recursive calls) 80 -S, --syscalls record syscall latency (adds overhead) 81 -v, --verbose verbose mode: print the BPF program (for debugging 82 purposes) 83 -m, --milliseconds report times in milliseconds (default is microseconds) 84 85examples: 86 ./ucalls -l java 185 # trace Java calls and print statistics on ^C 87 ./ucalls -l python 2020 1 # trace Python calls and print every second 88 ./ucalls -l java 185 -S # trace Java calls and syscalls 89 ./ucalls 6712 -S # trace only syscall counts 90 ./ucalls -l ruby 1344 -T 10 # trace top 10 Ruby method calls 91 ./ucalls -l ruby 1344 -L # trace Ruby calls including latency 92 ./ucalls -l php 443 -LS # trace PHP calls and syscalls with latency 93 ./ucalls -l python 2020 -mL # trace Python calls including latency in ms 94