Sasha Goldshtein | 5a9b154 | 2016-10-29 12:35:29 -0700 | [diff] [blame] | 1 | Demonstrations of ustat. |
| 2 | |
| 3 | |
| 4 | ustat is a "top"-like tool for monitoring events in high-level languages. It |
| 5 | prints statistics about garbage collections, method calls, object allocations, |
| 6 | and various other events for every process that it recognizes with a Java, |
Sasha Goldshtein | cfb5ee7 | 2017-02-08 14:32:51 -0500 | [diff] [blame] | 7 | Python, Ruby, Node, or PHP runtime. |
Sasha Goldshtein | 5a9b154 | 2016-10-29 12:35:29 -0700 | [diff] [blame] | 8 | |
| 9 | For example: |
| 10 | |
| 11 | # ./ustat.py |
| 12 | Tracing... Output every 10 secs. Hit Ctrl-C to end |
| 13 | 12:17:17 loadavg: 0.33 0.08 0.02 5/211 26284 |
| 14 | |
| 15 | PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s |
| 16 | 3018 node/node 0 3 0 0 0 0 |
| 17 | ^C |
| 18 | Detaching... |
| 19 | |
| 20 | |
| 21 | If desired, you can instruct ustat to print a certain number of entries and |
| 22 | exit, which can be useful to get a quick picture on what's happening on the |
| 23 | system over a short time interval. Here, we ask ustat to print 5-second |
| 24 | summaries 12 times (for a total time of 1 minute): |
| 25 | |
| 26 | # ./ustat.py -C 5 12 |
| 27 | Tracing... Output every 5 secs. Hit Ctrl-C to end |
| 28 | 12:18:26 loadavg: 0.27 0.11 0.04 2/336 26455 |
| 29 | |
| 30 | PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s |
| 31 | 3018 node/node 0 1 0 0 0 0 |
| 32 | |
| 33 | 12:18:31 loadavg: 0.33 0.12 0.04 2/336 26456 |
| 34 | |
| 35 | PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s |
| 36 | 3018 node/node 0 0 0 0 0 0 |
| 37 | 26439 java -XX:+ExtendedDT 2776045 0 0 0 0 0 |
| 38 | |
| 39 | 12:18:37 loadavg: 0.38 0.14 0.05 2/336 26457 |
| 40 | |
| 41 | PID CMDLINE METHOD/s GC/s OBJNEW/s CLOAD/s EXC/s THR/s |
| 42 | 3018 node/node 0 0 0 0 0 0 |
| 43 | 26439 java -XX:+ExtendedDT 2804378 0 0 0 0 0 |
| 44 | |
| 45 | (...more output omitted for brevity) |
| 46 | |
| 47 | |
| 48 | USAGE message: |
| 49 | |
| 50 | # ./ustat.py -h |
Sasha Goldshtein | cfb5ee7 | 2017-02-08 14:32:51 -0500 | [diff] [blame] | 51 | usage: ustat.py [-h] [-l {java,python,ruby,node,php}] [-C] |
Sasha Goldshtein | 5a9b154 | 2016-10-29 12:35:29 -0700 | [diff] [blame] | 52 | [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] |
| 53 | [interval] [count] |
| 54 | |
| 55 | Activity stats from high-level languages. |
| 56 | |
| 57 | positional arguments: |
| 58 | interval output interval, in seconds |
| 59 | count number of outputs |
| 60 | |
| 61 | optional arguments: |
| 62 | -h, --help show this help message and exit |
Sasha Goldshtein | cfb5ee7 | 2017-02-08 14:32:51 -0500 | [diff] [blame] | 63 | -l {java,python,ruby,node,php}, --language {java,python,ruby,node,php} |
Sasha Goldshtein | 5a9b154 | 2016-10-29 12:35:29 -0700 | [diff] [blame] | 64 | 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 | |
| 73 | examples: |
| 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 |