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, 7 Node, Perl, PHP, Python, Ruby, and Tcl runtime. 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 51 usage: ustat.py [-h] [-l {java,node,perl,php,python,ruby,tcl}] [-C] 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 63 -l {java,node,perl,php,python,ruby,tcl}, --language {java,node,perl,php,python,ruby,tcl} 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 79