blob: 7191fb88558b473f6e81e479317f2b5cd7e3cc53 [file] [log] [blame]
Sasha Goldshtein070c1df2016-10-29 13:08:39 -07001Demonstrations of ucalls.
2
3
4ucalls summarizes method calls in various high-level languages, including Java,
Marko Myllynen9f3662e2018-10-10 21:48:53 +03005Perl, 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
Marko Myllynen9162be42018-09-04 19:45:16 +03007methods.
Sasha Goldshtein070c1df2016-10-29 13:08:39 -07008
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
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020016# ucalls -L $(pidof java)
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070017Tracing 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
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020052# ucalls -mT 5 $(pidof python)
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070053Tracing 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
Marko Myllynen9f3662e2018-10-10 21:48:53 +030064usage: ucalls.py [-h] [-l {java,perl,php,python,ruby,tcl,none}] [-T TOP] [-L] [-S] [-v]
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020065 [-m]
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070066 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
Marko Myllynen9f3662e2018-10-10 21:48:53 +030076 -l {java,perl,php,python,ruby,tcl,none}, --language {java,perl,php,python,ruby,tcl,none}
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070077 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
Sasha Goldshteincfb5ee72017-02-08 14:32:51 -050093 ./ucalls -l php 443 -LS # trace PHP calls and syscalls with latency
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070094 ./ucalls -l python 2020 -mL # trace Python calls including latency in ms