blob: fffc76f4ef4d7fc0f89255cab17032363390b795 [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,
Sasha Goldshteincfb5ee72017-02-08 14:32:51 -05005Python, Ruby, PHP, and Linux system calls. It displays statistics on the most
Sasha Goldshtein070c1df2016-10-29 13:08:39 -07006frequently called methods, as well as the latency (duration) of these methods.
7
8Through the syscalls support, ucalls can provide basic information on a
9process' interaction with the system including syscall counts and latencies.
10This can then be used for further exploration with other BCC tools like trace,
11argdist, biotop, fileslower, and others.
12
13For example, to trace method call latency in a Java application:
14
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020015# ucalls -L $(pidof java)
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070016Tracing calls in process 26877 (language: java)... Ctrl-C to quit.
17
18METHOD # CALLS TIME (us)
19java/io/BufferedInputStream.getBufIfOpen 1 7.00
20slowy/App.isSimplePrime 8970 8858.35
21slowy/App.isDivisible 3228196 3076985.12
22slowy/App.isPrime 8969 4841017.64
23^C
24
25
26To trace only syscalls in a particular process and print the top 10 most
27frequently-invoked ones:
28
29# ucalls -ST 10 3018
30Attached 375 kernel probes for syscall tracing.
31Tracing calls in process 3018 (language: none)... Ctrl-C to quit.
32
33METHOD # CALLS
34sys_rt_sigaction 4
35SyS_rt_sigprocmask 4
36sys_mprotect 5
37sys_read 22
38SyS_write 39
39SyS_epoll_wait 42
40sys_futex 177
41SyS_mmap 180
42sys_mmap_pgoff 181
43sys_munmap 817
44^C
45Detaching kernel probes, please wait...
46
47
48To print only the top 5 methods and report times in milliseconds (the default
49is microseconds):
50
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020051# ucalls -mT 5 $(pidof python)
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070052Tracing 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
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020063usage: ucalls.py [-h] [-l {java,python,ruby,php,none}] [-T TOP] [-L] [-S] [-v]
64 [-m]
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070065 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
Paul Chaignon4bb6d7f2017-03-30 19:05:40 +020075 -l {java,python,ruby,php,none}, --language {java,python,ruby,php,none}
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070076 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
Sasha Goldshteincfb5ee72017-02-08 14:32:51 -050092 ./ucalls -l php 443 -LS # trace PHP calls and syscalls with latency
Sasha Goldshtein070c1df2016-10-29 13:08:39 -070093 ./ucalls -l python 2020 -mL # trace Python calls including latency in ms