zhenwei pi | 8614895 | 2021-02-15 19:19:17 +0800 | [diff] [blame] | 1 | Demonstrations of virtiostat, the Linux eBPF/bcc version. |
| 2 | |
| 3 | |
| 4 | This program traces virtio devices to analyze the IO operations and |
| 5 | throughput. For example, guest side mounts a 9p fs, and we can't get |
| 6 | io statistics by `iostat` command any more. In this scenario, we can |
| 7 | only get statistics from VIRTIO layer instead of block layer. |
| 8 | |
| 9 | Example |
| 10 | #./virtiostat -T |
| 11 | Tracing virtio devices statistics ... Hit Ctrl-C to end. |
| 12 | 14:48:30 |
| 13 | Driver Device VQ Name In SGs Out SGs In BW Out BW |
| 14 | virtio_net virtio0 input.0 260669 0 406743040 0 |
| 15 | virtio_net virtio0 output.0 0 9873 0 833344 |
| 16 | virtio_blk virtio4 req.0 28 46 448 278976 |
| 17 | 9pnet_virtio virtio6 requests 99083 99354 1883687 137537263 |
| 18 | 14:48:33 |
| 19 | Driver Device VQ Name In SGs Out SGs In BW Out BW |
| 20 | virtio_net virtio0 input.0 260718 0 406819328 0 |
| 21 | virtio_net virtio0 output.0 0 7139 0 562355 |
| 22 | virtio_blk virtio4 req.0 11 18 176 110768 |
| 23 | 9pnet_virtio virtio6 requests 91520 91141 1737364 125320785 |
| 24 | |
| 25 | |
zhenwei pi | fa7bec9 | 2021-03-10 18:36:24 +0800 | [diff] [blame] | 26 | Show virtio block devices only: |
| 27 | #./virtiostat.py -d virtio_blk |
| 28 | Tracing virtio devices statistics ... Hit Ctrl-C to end. |
| 29 | -------- |
| 30 | Driver Device VQ Name In SGs Out SGs In BW Out BW |
| 31 | virtio_blk virtio4 req.0 4 6 4 24640 |
| 32 | virtio_blk virtio5 req.0 678756 339378 1390431666 5430048 |
| 33 | |
| 34 | |
zhenwei pi | 8614895 | 2021-02-15 19:19:17 +0800 | [diff] [blame] | 35 | Full USAGE: |
| 36 | |
| 37 | #./virtiostat -h |
zhenwei pi | fa7bec9 | 2021-03-10 18:36:24 +0800 | [diff] [blame] | 38 | usage: virtiostat.py [-h] [-T] [-d DRIVER] [-n DEVNAME] [-D] |
| 39 | [interval] [count] |
zhenwei pi | 8614895 | 2021-02-15 19:19:17 +0800 | [diff] [blame] | 40 | |
| 41 | Show virtio devices input/output statistics |
| 42 | |
| 43 | positional arguments: |
zhenwei pi | fa7bec9 | 2021-03-10 18:36:24 +0800 | [diff] [blame] | 44 | interval output interval, in seconds |
| 45 | count number of outputs |
zhenwei pi | 8614895 | 2021-02-15 19:19:17 +0800 | [diff] [blame] | 46 | |
| 47 | optional arguments: |
zhenwei pi | fa7bec9 | 2021-03-10 18:36:24 +0800 | [diff] [blame] | 48 | -h, --help show this help message and exit |
| 49 | -T, --timestamp show timestamp on output |
| 50 | -d DRIVER, --driver DRIVER |
| 51 | filter for driver name |
| 52 | -n DEVNAME, --devname DEVNAME |
| 53 | filter for device name |
| 54 | -D, --debug print BPF program before starting (for debugging |
| 55 | purposes) |
zhenwei pi | 8614895 | 2021-02-15 19:19:17 +0800 | [diff] [blame] | 56 | |
| 57 | examples: |
zhenwei pi | fa7bec9 | 2021-03-10 18:36:24 +0800 | [diff] [blame] | 58 | ./virtiostat # print 3(default) second summaries |
| 59 | ./virtiostat 1 10 # print 1 second summaries, 10 times |
| 60 | ./virtiostat -T # show timestamps |
| 61 | ./virtiostat -d virtio_blk # only show virtio block devices |
| 62 | ./virtiostat -n virtio0 # only show virtio0 device |
| 63 | ./virtiostat -D # show debug bpf text |