JDK command line tools

The most important of these is the jstat command! The most commonly used argument is -gcutil, in the following format:

jstat -gcutil [pid] [intervel] [count]
Copy the code

The output is as follows

D:\Java\jdk1.6.0_21\bin > jstat -gcutil 2764
Copy the code

S0 s1 E O P YGC YGCT FGC FGCT GCT 0.00 0.00 6.20 41.42 47.20 16 0.105 3 0.472 0.577

Description:

  • S0: percentage of used space on Survivor space 0 on the heap
  • S1: Percentage of used space on Survivor space 1 on the heap
  • E: the percentage of used space in Eden area on the heap
  • O: The percentage of Old space used on the heap
  • P: The percentage of Perm space used on the heap
  • YGC: The number of Minor GC’s that occurred from the start of the program to the time of sampling
  • YGCT: The time from the start of the program to the time of sampling for the Minor GC
  • FGC: The number of Full GC’s that occur from the start of the program to the time of sampling
  • FGCT: Time from program start to Full GC at sampling time
  • GCT: Total time from program start to GC at sampling time

The ps command (Linux)

For the JPS command, in fact, there is no need to use, generally use Linux PS is enough, PS provides us with the current process status of the one-time view, it provides the view results are not dynamic continuous, if you want to monitor the process time, you should use the top tool.

Five states of a process on Linux

  • Running [R, Runnable] : running or waiting in a run queue;
  • 1. [S, Sleep] In hibernation, blocked, waiting for the formation of a condition or receipt of a signal;
  • Non-interruptible [D] : the process must wait until an interrupt occurs.
  • Zombie [Z, zombie] : The process terminates, but the process descriptor exists until the parent releases the wait4() system call;
  • Stop [T, Traced or Stop] : A process stops running when it receives SIGSTOP, SIGSTP, SIGTIN, or SIGTOU signals.

The sample

Ps - A # list all process information (details) ps aux # list all processes the information of ps aux | grep ZSH

Ps - ef # show all process information, together with the command line, ps - ef | grep ZSH

Ps -u root # display user information ps -l # display user information

Copy the code

Ps axjf # also lists the process tree information