update trace doc.

This commit is contained in:
hengyunabc committed 2019-01-25 11:44:04 +08:00
1 parent 083144594e
commit 3a27075987
3 files changed
+21

No files matched your search

@@ -33,6 +33,7 @@ import java.util.List;
" trace *StringUtils isBlank params[0].length==1\n" + " trace *StringUtils isBlank params[0].length==1\n" +
" trace *StringUtils isBlank '#cost>100'\n" + " trace *StringUtils isBlank '#cost>100'\n" +
" trace -E org\\\\.apache\\\\.commons\\\\.lang\\\\.StringUtils isBlank\n" + " trace -E org\\\\.apache\\\\.commons\\\\.lang\\\\.StringUtils isBlank\n" +
" trace -E com.test.ClassA|org.test.ClassB method1|method2|method3\n" +
Constants.WIKI + Constants.WIKI_HOME + "trace") Constants.WIKI + Constants.WIKI_HOME + "trace")
public class TraceCommand extends EnhancerCommand { public class TraceCommand extends EnhancerCommand {
+10
View File
@@ -86,3 +86,13 @@ Affect(class-cnt:1 , method-cnt:1) cost in 41 ms.
* "[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] demo:call()" means aggregating all same method calls into one single line. The minimum time cost is `0.005428` ms, the maximum time cost is `0.094064` ms, and the total time cost for all method calls (`3` times in total) to "demo:call()" is `0.105228ms`. If "throws Exception" appears in this line, it means some exceptions have been thrown from this method calls. * "[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] demo:call()" means aggregating all same method calls into one single line. The minimum time cost is `0.005428` ms, the maximum time cost is `0.094064` ms, and the total time cost for all method calls (`3` times in total) to "demo:call()" is `0.105228ms`. If "throws Exception" appears in this line, it means some exceptions have been thrown from this method calls.
* The total time cost may not equal to the sum of the time costs each sub method call takes, this is because Arthas instrumented code takes time too. * The total time cost may not equal to the sum of the time costs each sub method call takes, this is because Arthas instrumented code takes time too.
#### trace multiple classes or multiple methods
The trace command will only trace the subcalls in the method to the trace, and will not trace down multiple layers. Because traces are expensive, multi-layer traces can lead to a lot of classes and methods that ultimately have to be traced.
You can use the regular expression to match multiple classes and methods on the path to achieve a multi-layer trace effect to some extent.
```bash
Trace -E com.test.ClassA|org.test.ClassB method1|method2|method3
```
+10
View File
@@ -87,3 +87,13 @@ Affect(class-cnt:1 , method-cnt:1) cost in 41 ms.
- [12.033735ms] 的含义,`12.033735` 的含义是:当前节点在当前步骤的耗时,单位为毫秒 - [12.033735ms] 的含义,`12.033735` 的含义是:当前节点在当前步骤的耗时,单位为毫秒
- [0,0,0ms,11]xxx:yyy() [throws Exception],对该方法中相同的方法调用进行了合并,`0,0,0ms,11` 表示方法调用耗时,`min,max,total,count`;`throws Exception` 表明该方法调用中存在异常返回 - [0,0,0ms,11]xxx:yyy() [throws Exception],对该方法中相同的方法调用进行了合并,`0,0,0ms,11` 表示方法调用耗时,`min,max,total,count`;`throws Exception` 表明该方法调用中存在异常返回
- 这里存在一个统计不准确的问题,就是所有方法耗时加起来可能会小于该监测方法的总耗时,这个是由于 Arthas 本身的逻辑会有一定的耗时 - 这里存在一个统计不准确的问题,就是所有方法耗时加起来可能会小于该监测方法的总耗时,这个是由于 Arthas 本身的逻辑会有一定的耗时
#### trace多个类或者多个函数
trace命令只会trace匹配到的函数里的子调用,并不会向下trace多层。因为trace是代价比较贵的,多层trace可能会导致最终要trace的类和函数非常多。
可以用正则表匹配路径上的多个类和函数,一定程度上达到多层trace的效果。
```bash
trace -E com.test.ClassA|org.test.ClassB method1|method2|method3
```