常用命令总结

0

jps:查看当前Java进程

jstack pid:查看Java进程的线程快照

jmap -histo:live pid:查看Java进程的内存快照

内存快照时间统计:

cat file |grep cpu=|grep -Po '(cpu=\d+\.\d+ms)'|grep -Po '(\d+\.\d+)'|awk '{sum += $1}END{print sum}'

关闭JIT:

-Djava.compiler=NONE

提交Sonar:

mvn sonar:sonar -D "sonar.projectKey=snail" -D "sonar.host.url=http://localhost:9000" -D "sonar.login=token"

消息分类统计:

cat snail.log.*|grep -a 处理piece消息|grep TCP|wc -l;cat snail.log.*|grep -a 处理piece消息|grep UTP|wc -l;cat snail.log.*|grep -a 发送piece消息|grep TCP|wc -l;cat snail.log.*|grep -a 发送piece消息|grep UTP|wc -l;

异常分类统计:

cat snail.log.* | grep -a Exception | sort | uniq -c | sort