diff --git a/site/src/site/sphinx/en/watch.md b/site/src/site/sphinx/en/watch.md index d248e7f39..eaaa7fc02 100644 --- a/site/src/site/sphinx/en/watch.md +++ b/site/src/site/sphinx/en/watch.md @@ -234,3 +234,42 @@ Affect(class-cnt:1 , method-cnt:1) cost in 67 ms. ts=2018-12-03 20:04:34; [cost=131.303498ms] result=@Integer[8] ts=2018-12-03 20:04:35; [cost=0.961441ms] result=@Integer[8] ``` + + +#### Use the -v parameter to print more information + +> The watch/trace/monitor/stack/tt commands all support the `-v` parameter. + +When the command is executed, there is no output result. There are two possibilities: + +1. The matched function is not executed +2. The result of the conditional expression is false + +But the user cannot tell which situation is. + +Using the `-v` option, the specific value and execution result of `Condition express` will be printed for easy confirmation. + +such as: + +``` +$ watch -v -x 2 demo.MathGame print 'params' 'params[0] > 100000' +Press Q or Ctrl+C to abort. +Affect(class count: 1 , method count: 1) cost in 29 ms, listenerId: 11 +Condition express: params[0] > 100000 , result: false +Condition express: params[0] > 100000 , result: false +Condition express: params[0] > 100000 , result: true +ts=2020-12-02 22:38:56; [cost=0.060843ms] result=@Object[][ + @Integer[200033], + @ArrayList[ + @Integer[200033], + ], +] +Condition express: params[0] > 100000 , result: true +ts=2020-12-02 22:38:57; [cost=0.052877ms] result=@Object[][ + @Integer[123047], + @ArrayList[ + @Integer[29], + @Integer[4243], + ], +] +``` \ No newline at end of file diff --git a/site/src/site/sphinx/watch.md b/site/src/site/sphinx/watch.md index 81e4b754b..a413a7c74 100644 --- a/site/src/site/sphinx/watch.md +++ b/site/src/site/sphinx/watch.md @@ -234,3 +234,41 @@ Affect(class-cnt:1 , method-cnt:1) cost in 67 ms. ts=2018-12-03 20:04:34; [cost=131.303498ms] result=@Integer[8] ts=2018-12-03 20:04:35; [cost=0.961441ms] result=@Integer[8] ``` + +#### 使用 -v 参数打印更多信息 + +> watch/trace/monitor/stack/tt 命令都支持 `-v` 参数 + +当命令执行之后,没有输出结果。有两种可能: + +1. 匹配到的函数没有被执行 +2. 条件表达式结果是 false + +但用户区分不出是哪种情况。 + +使用 `-v`选项,则会打印`Condition express`的具体值和执行结果,方便确认。 + +比如: + +``` +$ watch -v -x 2 demo.MathGame print 'params' 'params[0] > 100000' +Press Q or Ctrl+C to abort. +Affect(class count: 1 , method count: 1) cost in 29 ms, listenerId: 11 +Condition express: params[0] > 100000 , result: false +Condition express: params[0] > 100000 , result: false +Condition express: params[0] > 100000 , result: true +ts=2020-12-02 22:38:56; [cost=0.060843ms] result=@Object[][ + @Integer[200033], + @ArrayList[ + @Integer[200033], + ], +] +Condition express: params[0] > 100000 , result: true +ts=2020-12-02 22:38:57; [cost=0.052877ms] result=@Object[][ + @Integer[123047], + @ArrayList[ + @Integer[29], + @Integer[4243], + ], +] +``` \ No newline at end of file