1、基于JVisualVM的可视化监控html
一、打开C:\Program Files\Java\jdk1.8.0_131\bin下的jvisualvm.exejava
二、打开后,会列出本机全部的Java进程git
三、安装插件visualvmgithub
1)查看java的版本工具
2)打开https://visualvm.github.io/pluginscenters.html插件
选择1313d
3)打开工具-> 插件->设置xml
编辑, 设置为https://visualvm.github.io/uc/8u131/updates.xml.gzhtm
而后在可用插件中选择Visual GC,而后“安装”blog
而后安装BTrace
四、使用JVisualVM+BTrace 查看访问参数
前置条件: 接口测建立和BTrace脚本的建立,参考http://www.javashuo.com/article/p-sggzjnin-en.html
BTrace打开位置为
而后将Btrace脚本复制进去
package com.example.monitor_tuning.chapter4; import com.sun.btrace.AnyType; import com.sun.btrace.BTraceUtils; import com.sun.btrace.annotations.*; /** * 此Btrace脚本和要跟踪的代码不是放在同一个工程里的。这里演示方便,放在一块儿。 */ @BTrace public class PrintArgSimple { /*要拦截哪一个类,哪一个方法,何时拦截*/ @OnMethod( clazz = "com.example.monitor_tuning.chapter4.Ch4Controller", method="arg1", location = @Location(Kind.ENTRY) ) /*ProbeClassName 方法类名; ProbeMethodName 方法名 ; AnyType[] 方法参数*/ public static void anyRead(@ProbeClassName String pcn, @ProbeMethodName String pmn, AnyType[] args) { BTraceUtils.printArray(args); BTraceUtils.println(pcn + "," + pmn); BTraceUtils.println(); } }
点击start,编译完成
访问http://localhost:8080/monitor_tuning/ch4/arg1?name=Bob
显示效果: