Skip to content

Instantly share code, notes, and snippets.

@henrikno
Created April 30, 2020 00:07
Show Gist options
  • Select an option

  • Save henrikno/4eabd7a4cb5be2f37f9d86145e5cae39 to your computer and use it in GitHub Desktop.

Select an option

Save henrikno/4eabd7a4cb5be2f37f9d86145e5cae39 to your computer and use it in GitHub Desktop.

Revisions

  1. henrikno created this gist Apr 30, 2020.
    4 changes: 4 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    PID=$(jps | grep Main | awk '{print $1}')
    CUR=$(jstat -gc $PID | tail -n 1 | awk '{split($0,a," "); sum=a[3]+a[4]+a[6]+a[8]; print sum/1024}')
    MAX=$(jstat -gccapacity $PID | tail -n 1 | awk '{split($0,a," "); sum=a[2]+a[8]; print sum/1024}')
    echo $CUR/$MAX