Skip to content

Commit

Permalink
style: 调整图片所在位置
Browse files Browse the repository at this point in the history
  • Loading branch information
youngledo committed Jul 8, 2024
1 parent 303f0f6 commit d2151f3
Show file tree
Hide file tree
Showing 26 changed files with 19 additions and 19 deletions.
File renamed without changes
File renamed without changes
Binary file removed docs/java/tools/cli/assets/jhsdb-jmap.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
14 changes: 7 additions & 7 deletions docs/java/tools/cli/jcmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
> [jcmd](https://docs.oracle.com/en/java/javase/11/troubleshoot/diagnostic-tools.html#GUID-42A18B29-B4AD-4831-B846-2CDBA55F2254),在Java 8新增的一个命令行的工具。它是一个多功能的工具,可以用来实现前面除了`jstat`之外所有命令的功能,Java 8官网建议使用它来替代其它命令行工具。比如用它来导出堆、线程、内存使用、查看Java进程、GC、JVM运行时间等。
## 使用说明
![jcmd-help.png](assets/jcmd-help.png)
![jcmd-help.png](assets/jcmd/jcmd-help.png)

### 命令项
- jcmd:打印进程信息,等同于`jps -lm`但貌似某些进程显示不了(如图)。

![jcmd.png](assets/jcmd.png)
![jcmd.png](assets/jcmd/jcmd.png)

- pid或者主类名:输出可用的命令
```bash
Expand All @@ -31,7 +31,7 @@ Compiler.directives_add
```
- help命令:`jcmd <pid或者主类名> help 命令`输出命令的使用说明

![jcmd-pid-help.png](assets/jcmd-pid-help.png)
![jcmd-pid-help.png](assets/jcmd/jcmd-pid-help.png)

##### 命令分类
- 线程
Expand All @@ -41,17 +41,17 @@ Compiler.directives_add
1. jcmd <process id/main class> VM.version:打印完整的HotSpot和JDK版本ID。
2. jcmd <process id/main class> VM.system_properties:打印为虚拟机设置的所有系统属性。

![jcmd-pid-vm.sys_properties.png](assets/jcmd-pid-vm.sys_properties.png)
![jcmd-pid-vm.sys_properties.png](assets/jcmd/jcmd-pid-vm.sys_properties.png)

3. jcmd <process id/main class> VM.flags:打印标志信息,即使您没有提供任何标志,也会打印一些默认值,例如初始和最大堆大小。

![jcmd-pid-vm.flags.png](assets/jcmd-pid-vm.flags.png)
![jcmd-pid-vm.flags.png](assets/jcmd/jcmd-pid-vm.flags.png)
4. jcmd <process id/main class> VM.native_memory:打印虚拟机的本地内存使用情况,包含机会整个JVM的内存情况。
> 注意需要设置`-XX:NativeMemoryTracking=[off | summary | detail]`选项才能使用该命令。
>
> 详情参考官网:[Native Memory Tracking](https://docs.oracle.com/en/java/javase/11/vm/native-memory-tracking.html#GUID-710CAEA1-7C6D-4D80-AB0C-B0958E329407)
![assets/jcmd-VM.native_memory.png](assets/jcmd-VM.native_memory.png)
![assets/jcmd-VM.native_memory.png](assets/jcmd/jcmd-VM.native_memory.png)

- GC
1. GC.class_histogram:内部类和特定于应用程序的类都包含在列表中。占用最多内存的类列在顶部,并且类按降序列出。
Expand All @@ -62,7 +62,7 @@ Compiler.directives_add
> 提供通用Java堆信息。
> 影响: 中等
>
![jcmd-GC.heap_info.png](assets/jcmd-GC.heap_info.png)
![jcmd-GC.heap_info.png](assets/jcmd/jcmd-GC.heap_info.png)
4. GC.run
> 调用`java.lang.System.gc()`
>
Expand Down
10 changes: 5 additions & 5 deletions docs/java/tools/cli/jinfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## 使用说明

![jinfo-help.png](assets/jinfo-help.png)
![jinfo-help.png](assets/jinfo/jinfo-help.png)

### 选项

Expand All @@ -16,7 +16,7 @@
$ jinfo -flag MaxHeapSize 8404
-XX:MaxHeapSize=167772160
```
![jinfo-flag.png](assets/jinfo-flag.png)
![jinfo-flag.png](assets/jinfo/jinfo-flag.png)

- -flag `[+|-]name`:启用或禁用指定的布尔命令行标志(立即生效)。
```bash
Expand All @@ -33,7 +33,7 @@

- -flags:打印传递给JVM的命令行标志。

![jinfo-flags.png](assets/jinfo-flags.png)
![jinfo-flags.png](assets/jinfo/jinfo-flags.png)
- -sysprops:以键值对的形式打印Java系统属性。

- **不加选项**:则打印`flags``sysprops`的选项参数,以及虚拟机参数(`VM Arguments`)。
Expand Down Expand Up @@ -62,8 +62,8 @@
# 打印虚拟机可以被管理的标志的最终值
java -XX:+PrintFlagsFinal -version | grep manageable
```
![java-manageable.png](assets/java-manageable.png)
![java-manageable.png](assets/java/java-manageable.png)

否则抛出异常:

![jinfo-flag-set.png](assets/jinfo-flag-set.png)
![jinfo-flag-set.png](assets/jinfo/jinfo-flag-set.png)
2 changes: 1 addition & 1 deletion docs/java/tools/cli/jmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

终端输入`jmap`即可查看帮助手册:

![jmap.png](assets/jmap.png)
![jmap.png](assets/jmap/jmap.png)

### 选项
- dump
Expand Down
8 changes: 4 additions & 4 deletions docs/java/tools/cli/jps.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
>
> 说明:对于本地虚拟机进程来说,本地虚拟机ID与操作系统的进程ID是一致的,是唯一的。
## 使用说明
![image.png](assets/jps-help.png)
![image.png](assets/jps/jps-help.png)

### 选项
- -q(quiet):仅仅显示LVMID(local virtual machine id),即本地虚拟机ID,不显示主类的名称。注意,该选项与以下存在互斥。
- mlvV:以下选项可以任意组合
- -l(long):显示应用程序主类的完整包名称或应用程序`jar`包的完整路径名。
![jps-l.png](assets/jps-l.png)
![jps-l.png](assets/jps/jps-l.png)
- -m(main):显示传递给 main 方法的参数。对于`嵌入式JVM`,输出可能为空。
![jps-m.png](assets/jps-m.png)
![jps-m.png](assets/jps/jps-m.png)
- -v:显示传递给JVM的参数。,比如`-Xms1024m -Xmx1024m`
![jps-v.png](assets/jps-v.png)
![jps-v.png](assets/jps/jps-v.png)
- V:抑制类名、JAR 文件名和传递给 main 方法的参数的输出,仅生成本地JVM标识符的列表。
- hostid:jps也支持远程连接`[protocol:][[//]hostname][:port][/servername]`
```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/java/tools/cli/jstack.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

终端输入`jstack`即可查看帮助手册:

![jstack.png](assets/jstack.png)
![jstack.png](assets/jstack/jstack.png)

```bash
$ jstack 18880
Expand Down
2 changes: 1 addition & 1 deletion docs/java/tools/cli/jstat.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
> 它可以显示本地或者远程虚拟机进程中的类装载、内存、垃圾回收、JIT编译器(即时编译器)等运行数据。 在没有图形化界面时,它将是运行期定位虚拟机性能问题的首选工具。
## 使用说明
![jstat-help.png](assets/jstat-help.png)
![jstat-help.png](assets/jstat/jstat-help.png)

### 选项说明
#### 1. class选项:显示有关类加载器行为的统计信息。
Expand Down

0 comments on commit d2151f3

Please sign in to comment.