From 51c0c2ef4384c0279e12bd52cc8a760e23ebcba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=BF=97=E6=AF=85?= Date: Fri, 26 Apr 2019 17:56:59 +0800 Subject: [PATCH] fix some doc and comment (#629) --- .../taobao/arthas/core/advisor/AdviceWeaver.java | 15 ++++++++------- .../com/taobao/arthas/core/advisor/Enhancer.java | 4 +++- .../arthas/core/advisor/InvokeTraceable.java | 2 +- .../com/taobao/arthas/core/util/SearchUtils.java | 3 ++- site/src/site/sphinx/trace.md | 4 ++-- spy/src/main/java/java/arthas/Spy.java | 4 ++-- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/com/taobao/arthas/core/advisor/AdviceWeaver.java b/core/src/main/java/com/taobao/arthas/core/advisor/AdviceWeaver.java index 3d31bd6d..f2c70921 100644 --- a/core/src/main/java/com/taobao/arthas/core/advisor/AdviceWeaver.java +++ b/core/src/main/java/com/taobao/arthas/core/advisor/AdviceWeaver.java @@ -346,13 +346,14 @@ public class AdviceWeaver extends ClassVisitor implements Opcodes { /** * 构建通知编织器 * - * @param adviceId 通知ID - * @param isTracing 可跟踪方法调用 - * @param className 类名称 - * @param matcher 方法匹配 - * 只有匹配上的方法才会被织入通知器 - * @param affect 影响计数 - * @param cv ClassVisitor for ASM + * @param adviceId 通知ID + * @param isTracing 可跟踪方法调用 + * @param skipJDKTrace 是否忽略对JDK内部方法的跟踪 + * @param className 类名称 + * @param matcher 方法匹配 + * 只有匹配上的方法才会被织入通知器 + * @param affect 影响计数 + * @param cv ClassVisitor for ASM */ public AdviceWeaver(int adviceId, boolean isTracing, boolean skipJDKTrace, String className, Matcher matcher, EnhancerAffect affect, ClassVisitor cv) { super(Opcodes.ASM7, cv); diff --git a/core/src/main/java/com/taobao/arthas/core/advisor/Enhancer.java b/core/src/main/java/com/taobao/arthas/core/advisor/Enhancer.java index ce7be038..5ae3b313 100644 --- a/core/src/main/java/com/taobao/arthas/core/advisor/Enhancer.java +++ b/core/src/main/java/com/taobao/arthas/core/advisor/Enhancer.java @@ -51,6 +51,7 @@ public class Enhancer implements ClassFileTransformer { /** * @param adviceId 通知编号 * @param isTracing 可跟踪方法调用 + * @param skipJDKTrace 是否忽略对JDK内部方法的跟踪 * @param matchingClasses 匹配中的类 * @param methodNameMatcher 方法名匹配 * @param affect 影响统计 @@ -170,7 +171,7 @@ public class Enhancer implements ClassFileTransformer { // 成功计数 affect.cCnt(1); - // 排遣间谍 + // 派遣间谍 try { spy(inClassLoader); } catch (Throwable t) { @@ -265,6 +266,7 @@ public class Enhancer implements ClassFileTransformer { * @param inst inst * @param adviceId 通知ID * @param isTracing 可跟踪方法调用 + * @param skipJDKTrace 是否忽略对JDK内部方法的跟踪 * @param classNameMatcher 类名匹配 * @param methodNameMatcher 方法名匹配 * @return 增强影响范围 diff --git a/core/src/main/java/com/taobao/arthas/core/advisor/InvokeTraceable.java b/core/src/main/java/com/taobao/arthas/core/advisor/InvokeTraceable.java index c7e1eca9..a81e216b 100644 --- a/core/src/main/java/com/taobao/arthas/core/advisor/InvokeTraceable.java +++ b/core/src/main/java/com/taobao/arthas/core/advisor/InvokeTraceable.java @@ -2,7 +2,7 @@ package com.taobao.arthas.core.advisor; /** * 方法调用跟踪
- * 当一个方法内部调用另外一个方法时,会出发此跟踪方法 + * 当一个方法内部调用另外一个方法时,会触发此跟踪方法 * Created by vlinux on 15/5/27. */ public interface InvokeTraceable { diff --git a/core/src/main/java/com/taobao/arthas/core/util/SearchUtils.java b/core/src/main/java/com/taobao/arthas/core/util/SearchUtils.java index 603c9b60..47f52de8 100644 --- a/core/src/main/java/com/taobao/arthas/core/util/SearchUtils.java +++ b/core/src/main/java/com/taobao/arthas/core/util/SearchUtils.java @@ -18,10 +18,11 @@ import java.util.Set; public class SearchUtils { /** - * 根据类名匹配,搜已经被JVM加载的类 + * 根据类名匹配,搜索已经被JVM加载的类 * * @param inst inst * @param classNameMatcher 类名匹配 + * @param limit 最大匹配限制 * @return 匹配的类集合 */ public static Set> searchClass(Instrumentation inst, Matcher classNameMatcher, int limit) { diff --git a/site/src/site/sphinx/trace.md b/site/src/site/sphinx/trace.md index 7e0d0320..84b8a560 100644 --- a/site/src/site/sphinx/trace.md +++ b/site/src/site/sphinx/trace.md @@ -81,7 +81,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 41 ms. `---[0.05447ms] demo.MathGame:print() ``` -> 只会展示耗时大于4ms的调用路径,有助于在排查问题的时候,只关注异常情况 +> 只会展示耗时大于10ms的调用路径,有助于在排查问题的时候,只关注异常情况 - 是不是很眼熟,没错,在 JProfiler 等收费软件中你曾经见识类似的功能,这里你将可以通过命令就能打印出指定调用路径。 友情提醒下,`trace` 在执行的过程中本身是会有一定的性能开销,在统计的报告中并未像 JProfiler 一样预先减去其自身的统计开销。所以这统计出来有些许的不准,渲染路径上调用的类、方法越多,性能偏差越大。但还是能让你看清一些事情的。 - [12.033735ms] 的含义,`12.033735` 的含义是:当前节点在当前步骤的耗时,单位为毫秒 @@ -96,4 +96,4 @@ trace命令只会trace匹配到的函数里的子调用,并不会向下trace ```bash trace -E com.test.ClassA|org.test.ClassB method1|method2|method3 -``` \ No newline at end of file +``` diff --git a/spy/src/main/java/java/arthas/Spy.java b/spy/src/main/java/java/arthas/Spy.java index 94f58266..2af7389d 100644 --- a/spy/src/main/java/java/arthas/Spy.java +++ b/spy/src/main/java/java/arthas/Spy.java @@ -28,7 +28,7 @@ public class Spy { */ public static volatile Method AGENT_RESET_METHOD; - /* + /** * 用于普通的间谍初始化 */ public static void init( @@ -48,7 +48,7 @@ public class Spy { THROW_INVOKING_METHOD = throwInvokingMethod; } - /* + /** * 用于启动线程初始化 */ public static void initForAgentLauncher(