<link rel="stylesheet" href="https://js.how234.com/third-party/SyntaxHighlighter/shCoreDefault.css" type="text/css" /><script type="text/javascript" src="https://js.how234.com/third-party/SyntaxHighlighter/shCore.js"></script><script type="text/javascript"> SyntaxHighlighter.all(); </script>
java jstat是什麼,讓我們一起了解一下?
jstat位於java的bin目錄下,主要利用JVM內建的指令對Java應用程序的資源和性能進行實時的命令行的監控,包括了對Heap size和垃圾回收狀況的監控。可見,Jstat是輕量級的、專門針對JVM的工具,非常適用。
jstat作爲性能調優工具,它的使用參數是什麼?
C:UsersAdministrator>jstat -helpUsage: 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:UsersAdministrator>jstat -class 2284Loaded 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(); }}