mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
Add Press Q or Ctrl+C to abort for enhanced commands (#1454)
This commit is contained in:
@@ -56,6 +56,8 @@
|
||||
|
||||
`java -jar arthas-boot.jar`{{execute interrupt}}
|
||||
|
||||
`1`{{execute T2}}
|
||||
|
||||
最后执行下面命令查看效果:
|
||||
|
||||
`keymap | grep C-h`{{execute T2}}
|
||||
@@ -21,6 +21,6 @@
|
||||
| `"\C-x\e[3~"` | | backward-kill-line | |
|
||||
| `"\e\C-?"` | | backward-kill-word | |
|
||||
|
||||
任何时候使用 `tab`{{execute T2}}键,会根据当前的输入给出提示
|
||||
任何时候使用 `tab`键,会根据当前的输入给出提示
|
||||
|
||||
命令后敲 `-` 或 `--` ,然后按 `tab` 键,可以展示出此命令具体的选项
|
||||
|
||||
@@ -56,6 +56,8 @@ Then reconnect to Arthas console to take effect.
|
||||
|
||||
`java -jar arthas-boot.jar`{{execute interrupt}}
|
||||
|
||||
`1`{{execute T2}}
|
||||
|
||||
Finally you can see the modification by executing
|
||||
|
||||
`keymap | grep C-h`{{execute T2}}
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
| `"\C-x\e[3~"` | | backward-kill-line | |
|
||||
| `"\e\C-?"` | | backward-kill-word | |
|
||||
|
||||
Press `tab`{{execute T2}} to enable auto-completion prompt at any time.
|
||||
Press `tab` to enable auto-completion prompt at any time.
|
||||
|
||||
Enter command and `-` or `--`, then press `tab` to display the concrete options for the current command.
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
`monitor -c 5 demo.MathGame primeFactors`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ monitor -c 5 demo.MathGame primeFactors
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -39,6 +39,8 @@ Parameter `[c:]` stands for cycles of statistics. Its value is an integer value
|
||||
|
||||
`monitor -c 5 demo.MathGame primeFactors`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ monitor -c 5 demo.MathGame primeFactors
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
`stack demo.MathGame primeFactors`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors
|
||||
Press Ctrl+C to abort.
|
||||
@@ -39,6 +41,8 @@ ts=2018-12-04 01:32:19;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun
|
||||
|
||||
`stack demo.MathGame primeFactors 'params[0]<0' -n 2`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors 'params[0]<0' -n 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -59,6 +63,8 @@ Command execution times exceed limit: 2, so command will exit. You can set it wi
|
||||
|
||||
`stack demo.MathGame primeFactors '#cost>5'`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors '#cost>5'
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -26,6 +26,8 @@ Thanks for `advice`'s data structure, it is possible to observe from varieties o
|
||||
|
||||
`stack demo.MathGame primeFactors`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors
|
||||
Press Ctrl+C to abort.
|
||||
@@ -39,6 +41,8 @@ ts=2018-12-04 01:32:19;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun
|
||||
|
||||
`stack demo.MathGame primeFactors 'params[0]<0' -n 2`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors 'params[0]<0' -n 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -59,6 +63,8 @@ Command execution times exceed limit: 2, so command will exit. You can set it wi
|
||||
|
||||
`stack demo.MathGame primeFactors '#cost>5'`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ stack demo.MathGame primeFactors '#cost>5'
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
`trace demo.MathGame run`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -62,6 +64,8 @@ Affect(class-cnt:1 , method-cnt:1) cost in 28 ms.
|
||||
|
||||
`trace demo.MathGame run -n 1`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run -n 1
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -81,6 +85,8 @@ Command execution times exceed limit: 1, so command will exit. You can set it wi
|
||||
|
||||
`trace --skipJDKMethod false demo.MathGame run`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
默认情况下,trace不会包含jdk里的函数调用,如果希望trace jdk里的函数,需要显式设置`--skipJDKMethod false`。
|
||||
|
||||
```bash
|
||||
@@ -116,6 +122,8 @@ Affect(class-cnt:1 , method-cnt:1) cost in 60 ms.
|
||||
|
||||
`trace demo.MathGame run '#cost > 10'`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run '#cost > 10'
|
||||
Press Ctrl+C to abort.
|
||||
@@ -153,6 +161,8 @@ trace -E com.test.ClassA|org.test.ClassB method1|method2|method3
|
||||
|
||||
`trace demo.MathGame run`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
[arthas@59161]$ trace demo.MathGame run
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -171,6 +181,8 @@ Affect(class count: 1 , method count: 1) cost in 112 ms, listenerId: 1
|
||||
|
||||
`trace demo.MathGame primeFactors --listenerId 1`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
[arthas@59161]$ trace demo.MathGame primeFactors --listenerId 1
|
||||
Press Q or Ctrl+C to abort.
|
||||
|
||||
@@ -40,6 +40,8 @@ After version 3.3.0, you can use the Dynamic Trace feature to add new matching c
|
||||
|
||||
`trace demo.MathGame run`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -60,6 +62,8 @@ If the method invoked many times, use `-n` options to specify trace times. For e
|
||||
|
||||
`trace demo.MathGame run -n 1`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run -n 1
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -78,6 +82,8 @@ Command execution times exceed limit: 1, so command will exit. You can set it wi
|
||||
|
||||
`trace --skipJDKMethod false demo.MathGame run`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ trace --skipJDKMethod false demo.MathGame run
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -111,6 +117,8 @@ Affect(class-cnt:1 , method-cnt:1) cost in 60 ms.
|
||||
|
||||
`trace demo.MathGame run '#cost > 10'`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ trace demo.MathGame run '#cost > 10'
|
||||
Press Ctrl+C to abort.
|
||||
@@ -149,6 +157,8 @@ Open terminal 1, trace the `run` method, and you can see the printout `listenerI
|
||||
|
||||
`trace demo.MathGame run`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
[arthas@59161]$ trace demo.MathGame run
|
||||
Press Q or Ctrl+C to abort.
|
||||
@@ -167,6 +177,8 @@ Now to drill down into the sub method `primeFactors`, you can open a new termina
|
||||
|
||||
`trace demo.MathGame primeFactors --listenerId 1`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
[arthas@59161]$ trace demo.MathGame primeFactors --listenerId 1
|
||||
Press Q or Ctrl+C to abort.
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
`tt -t demo.MathGame primeFactors`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ tt -t demo.MathGame primeFactors
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -13,6 +13,8 @@ With the help of `tt` (*TimeTunnel*), you can check the contexts of the methods
|
||||
|
||||
`tt -t demo.MathGame primeFactors`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ tt -t demo.MathGame primeFactors
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -40,6 +40,8 @@ watch 的参数比较多,主要是因为它能在 4 个不同的场景观察
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,returnObj}" -x 2`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,returnObj}" -x 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -61,6 +63,8 @@ ts=2018-12-03 19:16:51; [cost=1.280502ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b
|
||||
Press Ctrl+C to abort.
|
||||
@@ -80,6 +84,8 @@ ts=2018-12-03 19:23:23; [cost=0.0353ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -125,6 +131,8 @@ ts=2018-12-03 19:29:54; [cost=4.277392ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,target}" -x 3`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,target}" -x 3
|
||||
Press Ctrl+C to abort.
|
||||
@@ -163,6 +171,8 @@ ts=2018-12-03 19:34:19; [cost=0.587833ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0"`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0"
|
||||
Press Ctrl+C to abort.
|
||||
@@ -184,15 +194,21 @@ ts=2018-12-03 19:36:04; [cost=0.530255ms] result=@ArrayList[
|
||||
* 根据参数类型进行过滤
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, params[0].class.name}' 'params[0].class.name == "java.lang.Integer"'`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
* 根据参数个数进行过滤
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, params.length}' 'params.length==1'`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
#### 观察异常信息的例子
|
||||
|
||||
`watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -214,10 +230,14 @@ ts=2018-12-03 19:38:00; [cost=1.414993ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, throwExp}' '#msg=throwExp.toString(), #msg.contains("IllegalArgumentException")' -e -x 2`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
#### 按照耗时进行过滤
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -240,6 +260,8 @@ ts=2018-12-03 19:40:28; [cost=2112.168897ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors 'target'`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
如果想查看方法运行前后,当前对象中的属性,可以使用`target`关键字,代表当前对象
|
||||
|
||||
```bash
|
||||
@@ -256,6 +278,8 @@ ts=2018-12-03 19:41:52; [cost=0.477882ms] result=@MathGame[
|
||||
|
||||
`watch demo.MathGame primeFactors 'target.illegalArgumentCount'`{{execute T2}}
|
||||
|
||||
按`Q`{{execute T2}}或者`Ctrl+c`退出
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors 'target.illegalArgumentCount'
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
@@ -38,6 +38,8 @@ Advanced:
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,returnObj}" -x 2`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,returnObj}" -x 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -59,6 +61,8 @@ ts=2018-12-03 19:16:51; [cost=1.280502ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b
|
||||
Press Ctrl+C to abort.
|
||||
@@ -80,6 +84,8 @@ Compared to the previous *check*:
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -125,6 +131,8 @@ F.Y.I
|
||||
|
||||
`watch demo.MathGame primeFactors "{params,target}" -x 3`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params,target}" -x 3
|
||||
Press Ctrl+C to abort.
|
||||
@@ -162,6 +170,8 @@ ts=2018-12-03 19:34:19; [cost=0.587833ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0"`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0"
|
||||
Press Ctrl+C to abort.
|
||||
@@ -184,14 +194,20 @@ If there are other overloaded methods with the same name in the watch method, yo
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, params[0].class.name}' 'params[0].class.name == "java.lang.Integer"'`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
* Filter according to the number of parameters
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, params.length}' 'params.length==1'`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
#### Check `exceptions`
|
||||
|
||||
`watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -213,10 +229,14 @@ Filter according to exception type or message:
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, throwExp}' '#msg=throwExp.toString(), #msg.contains("IllegalArgumentException")' -e -x 2`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
#### Filter by time cost
|
||||
|
||||
`watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2
|
||||
Press Ctrl+C to abort.
|
||||
@@ -241,6 +261,8 @@ ts=2018-12-03 19:40:28; [cost=2112.168897ms] result=@ArrayList[
|
||||
|
||||
`watch demo.MathGame primeFactors 'target'`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors 'target'
|
||||
Press Ctrl+C to abort.
|
||||
@@ -255,6 +277,8 @@ ts=2018-12-03 19:41:52; [cost=0.477882ms] result=@MathGame[
|
||||
|
||||
`watch demo.MathGame primeFactors 'target.illegalArgumentCount'`{{execute T2}}
|
||||
|
||||
Press `Q`{{execute T2}} or `Ctrl+C` to abort
|
||||
|
||||
```bash
|
||||
$ watch demo.MathGame primeFactors 'target.illegalArgumentCount'
|
||||
Press Ctrl+C to abort.
|
||||
|
||||
Reference in New Issue
Block a user