forked from superhj1987/awesome-scripts
-
Notifications
You must be signed in to change notification settings - Fork 25
/
vjmap
executable file
·29 lines (22 loc) · 968 Bytes
/
vjmap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
## use vjmap to view heap usage in generation
echo '==========Thanks to https://github.com/vipshop/vjtools=========='
if [ -z "$JAVA_HOME" ]; then
echo "JAVA_HOME env is not set, try to find it out"
JAVA_PATH=`which java 2>/dev/null`
if [ "x$JAVA_PATH" != "x" ]; then
JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
JAVA_HOME=`dirname $JAVA_PATH 2>/dev/null`
fi
fi
SA_JDI_PATH=$JAVA_HOME/lib/sa-jdi.jar
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo -e "\033[31mWARNING!! STW(Stop-The-World) will be performed on your Java process, if this is NOT wanted, type 'Ctrl+C' to exist. \033[0m"
echo "using JDK $JAVA_VERSION"
PRGDIR=`dirname "$0"`
BASEDIR=`cd "$PRGDIR/lib" >/dev/null; pwd`
if [ -f ${SA_JDI_PATH} ]; then
java -XX:AutoBoxCacheMax=20000 -classpath $BASEDIR/vjmap.jar:$SA_JDI_PATH com.vip.vjtools.vjmap.VJMap $*
else
echo "JAVA_HOME/lib/sa-jdi.jar is not exist, please set your JAVA_HOME env";
fi