blob: 11ee2de4aa06a3c92365ed6a2471ef7d1d027e7a [file] [log] [blame]
Sasha Goldshtein5a9b1542016-10-29 12:35:29 -07001Demonstrations of ustat.
2
3
4ustat is a "top"-like tool for monitoring events in high-level languages. It
5prints statistics about garbage collections, method calls, object allocations,
6and various other events for every process that it recognizes with a Java,
Marko Myllynen9f3662e2018-10-10 21:48:53 +03007Node, Perl, PHP, Python, Ruby, and Tcl runtime.
Sasha Goldshtein5a9b1542016-10-29 12:35:29 -07008
9For example:
10
11# ./ustat.py
12Tracing... Output every 10 secs. Hit Ctrl-C to end
1312:17:17 loadavg: 0.33 0.08 0.02 5/211 26284
14
15PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s
163018 node/node 0 3 0 0 0 0
17^C
18Detaching...
19
20
21If desired, you can instruct ustat to print a certain number of entries and
22exit, which can be useful to get a quick picture on what's happening on the
23system over a short time interval. Here, we ask ustat to print 5-second
24summaries 12 times (for a total time of 1 minute):
25
26# ./ustat.py -C 5 12
27Tracing... Output every 5 secs. Hit Ctrl-C to end
2812:18:26 loadavg: 0.27 0.11 0.04 2/336 26455
29
30PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s
313018 node/node 0 1 0 0 0 0
32
3312:18:31 loadavg: 0.33 0.12 0.04 2/336 26456
34
35PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s
363018 node/node 0 0 0 0 0 0
3726439 java -XX:+ExtendedDT 2776045 0 0 0 0 0
38
3912:18:37 loadavg: 0.38 0.14 0.05 2/336 26457
40
41PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s
423018 node/node 0 0 0 0 0 0
4326439 java -XX:+ExtendedDT 2804378 0 0 0 0 0
44
45(...more output omitted for brevity)
46
47
48USAGE message:
49
50# ./ustat.py -h
Marko Myllynen9f3662e2018-10-10 21:48:53 +030051usage: ustat.py [-h] [-l {java,node,perl,php,python,ruby,tcl}] [-C]
Sasha Goldshtein5a9b1542016-10-29 12:35:29 -070052 [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d]
53 [interval] [count]
54
55Activity stats from high-level languages.
56
57positional arguments:
58 interval output interval, in seconds
59 count number of outputs
60
61optional arguments:
62 -h, --help show this help message and exit
Marko Myllynen9f3662e2018-10-10 21:48:53 +030063 -l {java,node,perl,php,python,ruby,tcl}, --language {java,node,perl,php,python,ruby,tcl}
Sasha Goldshtein5a9b1542016-10-29 12:35:29 -070064 language to trace (default: all languages)
65 -C, --noclear don't clear the screen
66 -S {cload,excp,gc,method,objnew,thread}, --sort {cload,excp,gc,method,objnew,thread}
67 sort by this field (descending order)
68 -r MAXROWS, --maxrows MAXROWS
69 maximum rows to print, default 20
70 -d, --debug Print the resulting BPF program (for debugging
71 purposes)
72
73examples:
74 ./ustat # stats for all languages, 1 second refresh
75 ./ustat -C # don't clear the screen
76 ./ustat -l java # Java processes only
77 ./ustat 5 # 5 second summaries
78 ./ustat 5 10 # 5 second summaries, 10 times only