jiankunking@ubuntu:~$ iostat --man
Usage: iostat [ options ] [ [ ] ]
Options are:
[ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ]
[ -j { ID | LABEL | PATH | UUID | ... } ]
[ [ -H ] -g ] [ -p [ [,...] | ALL ] ]
[ [...] | ALL ]
例如:
jiankunking@ubuntu:~$ iostat 1 2
Linux 4.13.0-26-generic (ubuntu) 03/25/2018 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
1.04 0.22 1.24 2.11 0.00 95.38
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
loop0 1.78 1.99 0.00 9675 0
loop1 0.03 0.23 0.00 1142 0
loop2 0.04 0.25 0.00 1210 0
loop3 0.02 0.23 0.00 1109 0
loop4 0.04 0.25 0.00 1208 0
loop5 0.02 0.23 0.00 1112 0
sda 14.08 211.57 73.46 1028943 357292
tps:该设备每秒的传输次数(Indicate the number of transfers per second that were issued to the device.)。“一次传输”意思是“一次I/O请求”。多个逻辑请求可能会被合并为“一次I/O请求”。“一次传输”请求的大小是未知的。
kB_read/s:每秒从设备(drive expressed)读取的数据量;
kB_wrtn/s:每秒向设备(drive expressed)写入的数据量;
kB_read:读取的总数据量;
kB_wrtn:写入的总数量数据量;
这些单位都为Kilobytes。
2、统计进程、线程、进程组的资源消耗如果我们要查看Linux下面进程、进程组、线程的资源消耗的统计信息,可以使用pidstat,它可以收集并报告进程的统计信息。
pidstat实际上也是将/proc/pid下的统计信息统筹后展现给用户。
root@ubuntu:~# pidstat --man
Usage: pidstat [ options ] [ [ ] ]
Options are:
[ -d ] [ -h ] [ -I ] [ -l ] [ -R ] [ -r ] [ -s ] [ -t ] [ -U [ ] ]
[ -u ] [ -V ] [ -v ] [ -w ] [ -C ] [ -G ]
[ -p { [,...] | SELF | ALL } ] [ -T { TASK | CHILD | ALL } ]
- 列出IO统计信息:-d
- 列出内存使用统计,page fault:-r
- CPU统计信息:-u
- 上下文切换统计信息:-w
- 指定输出的维度 指定命令: -C command 指定进程号:-p { pid [,…] | SELF | ALL } 将所有列输出到单行、便于导入单张表中:-h 按每个CPU核的统计:-I 按所有CPU核统计:默认 列出命令的完整内容,包括参数:-l 列出线程统计信息:-t 按进程维度单独统计、按进程全局+子进程单独统计、按进程全局、单独统计同时按子任务单独统计:-T { TASK | CHILD | ALL }
root@ubuntu:~# jps --man
illegal argument: --man
usage: jps [-help]
jps [-q] [-mlvV] []
Definitions:
: [:]
-q 仅输出VM标识符,不包括class name,jar name,arguments in main method -m 输出main method的参数 -l 输出完全的包名,应用主类名,jar的完全路径名 -v 输出jvm参数 -V 输出通过flag文件传递到JVM中的参数(.hotspotrc文件或-XX:Flags=所指定的文件
4、查看虚拟机运行时信息root@ubuntu:~# jstat --help
invalid argument count
Usage: jstat -help|-options
jstat - [-t] [-h] [ []]
Definitions:
An option reported by the -options option
Virtual Machine Identifier. A vmid takes the following form:
[@[:]]
Where is the local vm identifier for the target
Java virtual machine, typically a process id; is
the name of the host running the target Java virtual machine;
and is the port number for the rmiregistry on the
target host. See the jvmstat documentation for a more complete
description of the Virtual Machine Identifier.
Number of samples between header lines.
Sampling interval. The following forms are allowed:
["ms"|"s"]
Where is an integer and the suffix specifies the units as
milliseconds("ms") or seconds("s"). The default units are "ms".
Number of samples to take before terminating.
-J Pass directly to the runtime system.
Jstat 是JDK自带的一个轻量级小工具。全称“Java Virtual Machine statistics monitoring tool”,它位于java的bin目录下,主要利用JVM内建的指令对Java应用程序的资源和性能进行实时的命令行的监控,包括了对Heap size和垃圾回收状况的监控。可见,Jstat是轻量级的、专门针对JVM的工具,非常适用。
参数解释:
Options — 选项,我们一般使用 -gcutil 查看gc情况
vmid — VM的进程号,即当前运行的java进程号
interval[s|ms] —— 间隔时间,单位为秒或者毫秒,默认为ms。必须是正整型。
count — 打印次数,如果缺省则打印无数次
输出参数:
-hn 每个n行输出一次列表头。默认为0,仅输出一次。
-tn 在第一列输出时间戳。该时间戳从jvm启动开始。
-JjavaOption
具体参数:
-class: 统计class loader 行为信息
-compiler: 统计编译行为信息
-gc:统计jdk gc时heap信息
-gccapacity:统计不同的generations(新生代、老生代、永久代)相应的heap容量信息
-gccause:统计gc的情况,以及引起gc的事情。同-gcutil
-gcnew:统计新生代的gc情况
-gcnewcapacity:统计新生代gc时heap的容量信息
-gcold:统计老生代的gc情况
-gcoldcapacity:统计老生代gc时heap容量信息
-gcpermcapacity:统计永久代gc时的容量信息
-gcutil:统计heap的gc情况
-printcompilation:没用过
jstat -gcutil :
结果信息:
S0 — Heap上的 Survivor space 0 区已使用空间的百分比 S1 — Heap上的 Survivor space 1 区已使用空间的百分比 E — Heap上的 Eden space 区已使用空间的百分比 O — Heap上的 Old space 区已使用空间的百分比 P — Perm space 区已使用空间的百分比 YGC — 从应用程序启动到采样时发生 Young GC 的次数 YGCT– 从应用程序启动到采样时 Young GC 所用的时间(单位秒) FGC — 从应用程序启动到采样时发生 Full GC 的次数 FGCT– 从应用程序启动到采样时 Full GC 所用的时间(单位秒) GCT — 从应用程序启动到采样时用于垃圾回收的总时间(单位秒)
5、查看虚拟机参数root@ubuntu:~# jinfo --man
Usage:
jinfo [option]
(to connect to running process)
jinfo [option]
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?