File: ustat_example.txt

package info (click to toggle)
bpfcc 0.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,368 kB
  • sloc: ansic: 132,727; python: 36,226; cpp: 26,973; sh: 710; yacc: 525; makefile: 141; lex: 94
file content (78 lines) | stat: -rw-r--r-- 3,052 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Demonstrations of ustat.


ustat is a "top"-like tool for monitoring events in high-level languages. It 
prints statistics about garbage collections, method calls, object allocations,
and various other events for every process that it recognizes with a Java,
Node, Perl, PHP, Python, Ruby, and Tcl runtime.

For example:

# ./ustat.py
Tracing... Output every 10 secs. Hit Ctrl-C to end
12:17:17 loadavg: 0.33 0.08 0.02 5/211 26284

PID    CMDLINE              METHOD/s   GC/s   OBJNEW/s   CLOAD/s  EXC/s  THR/s 
3018   node/node            0          3      0          0        0      0     
^C
Detaching...


If desired, you can instruct ustat to print a certain number of entries and 
exit, which can be useful to get a quick picture on what's happening on the 
system over a short time interval. Here, we ask ustat to print 5-second 
summaries 12 times (for a total time of 1 minute):

# ./ustat.py -C 5 12
Tracing... Output every 5 secs. Hit Ctrl-C to end
12:18:26 loadavg: 0.27 0.11 0.04 2/336 26455

PID    CMDLINE              METHOD/s   GC/s   OBJNEW/s   CLOAD/s  EXC/s  THR/s 
3018   node/node            0          1      0          0        0      0     

12:18:31 loadavg: 0.33 0.12 0.04 2/336 26456

PID    CMDLINE              METHOD/s   GC/s   OBJNEW/s   CLOAD/s  EXC/s  THR/s 
3018   node/node            0          0      0          0        0      0     
26439  java -XX:+ExtendedDT 2776045    0      0          0        0      0     

12:18:37 loadavg: 0.38 0.14 0.05 2/336 26457

PID    CMDLINE              METHOD/s   GC/s   OBJNEW/s   CLOAD/s  EXC/s  THR/s 
3018   node/node            0          0      0          0        0      0     
26439  java -XX:+ExtendedDT 2804378    0      0          0        0      0     

(...more output omitted for brevity)


USAGE message:

# ./ustat.py -h
usage: ustat.py [-h] [-l {java,node,perl,php,python,ruby,tcl}] [-C]
                [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d]
                [interval] [count]

Activity stats from high-level languages.

positional arguments:
  interval              output interval, in seconds
  count                 number of outputs

optional arguments:
  -h, --help            show this help message and exit
  -l {java,node,perl,php,python,ruby,tcl}, --language {java,node,perl,php,python,ruby,tcl}
                        language to trace (default: all languages)
  -C, --noclear         don't clear the screen
  -S {cload,excp,gc,method,objnew,thread}, --sort {cload,excp,gc,method,objnew,thread}
                        sort by this field (descending order)
  -r MAXROWS, --maxrows MAXROWS
                        maximum rows to print, default 20
  -d, --debug           Print the resulting BPF program (for debugging
                        purposes)

examples:
  ./ustat              # stats for all languages, 1 second refresh
  ./ustat -C           # don't clear the screen
  ./ustat -l java      # Java processes only
  ./ustat 5            # 5 second summaries
  ./ustat 5 10         # 5 second summaries, 10 times only