Monthly Archives: June 2020

Show the GC Statistic for Tomcat

To print the GC statistic of a running tomcat process every 5 seconds:

/home/user$ pid=jps | grep Bootstrap | cut -d' ' -f1; jstat -gcutil $pid 5000
  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT   
 25.96   0.00  89.72  25.30  94.37     18   10.044     0    0.000   10.044
 29.64   0.00  12.71  28.39  94.09     20   10.241     0    0.000   10.241
  0.00  27.27  74.97  30.29  94.46     21   10.339     0    0.000   10.339
  0.00  47.80  67.70  34.32  94.81     23   10.554     0    0.000   10.554
  0.00  58.01  31.34  39.08  94.95     25   10.797     0    0.000   10.797
 27.86   0.00  43.51  42.36  95.13     26   10.927     0    0.000   10.927
  0.00  31.09  72.16  43.90  95.26     27   11.017     0    0.000   11.017
 36.36   0.00  73.28  45.63  95.39     28   11.109     0    0.000   11.109