java jstat是什么,让我们一起了解一下?
jstat位于java的bin目录下,主要利用JVM内建的指令对Java应用程序的资源和性能进行实时的命令行的监控,包括了对Heap size和垃圾回收状况的监控。可见,Jstat是轻量级的、专门针对JVM的工具,非常适用。
jstat作为性能调优工具,它的使用参数是什么?
C:\Users\Administrator>jstat -help
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.类加载的行为统计是如何实现的?
C:\Users\Administrator>jstat -class 2284 Loaded Bytes Unloaded Bytes Time 30116 75021.8 26 51.4 86.72
1、Loaded :加载class的数量。
2、Bytes : 加载class的大小(单位KB)。
3、Unloaded :卸载class的数量。
4、Bytes: 卸载class的大小(单位KB)。
5、Time : 加载和卸载class所耗费的时间。
实战操作:定义一个测试类。
package com.rf.designPatterns.structural;
import java.util.Scanner;
/**
- @description:
- @author: xiaozhi
- @create: 2020-06-17 10:11
*/
public class Test {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
sc.next();
}
}以上就是小编今天的分享了,希望可以帮助到大家。