Skip to content

Commit

Permalink
update tt docs. #2771
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Jan 2, 2024
1 parent 07414df commit cb5d59f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void setRegEx(boolean regEx) {
}

@Option(shortName = "n", longName = "limits")
@Description("Threshold of execution times")
@Description("Threshold of execution times, default value 100")
public void setNumberOfLimit(int numberOfLimit) {
this.numberOfLimit = numberOfLimit;
}
Expand Down
18 changes: 18 additions & 0 deletions site/docs/doc/tt.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

于是乎,TimeTunnel 命令就诞生了。

## 注意事项

* tt 命令的实现是:把函数的入参/返回值等,保存到一个`Map<Integer, TimeFragment>`里,默认的大小是 100。
* tt 相关功能在使用完之后,需要手动释放内存,否则长时间可能导致OOM。退出 arthas 不会自动清除 tt 的缓存 map。

## 使用参考

### 启动 Demo
Expand Down Expand Up @@ -238,3 +243,16 @@ Affect(class count: 1 , method count: 1) cost in 56 ms, listenerId: 1
2. **引用的对象**

需要强调的是,`tt` 命令是将当前环境的对象引用保存起来,但仅仅也只能保存一个引用而已。如果方法内部对入参进行了变更,或者返回的对象经过了后续的处理,那么在 `tt` 查看的时候将无法看到当时最准确的值。这也是为什么 `watch` 命令存在的意义。


### 通过索引删除指定的 tt 记录

```
tt -d 1001
```

### 清除所有的 tt 记录

```
tt --delete-all
```
17 changes: 17 additions & 0 deletions site/docs/en/doc/tt.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ In such difficulties, `tt` comes into play.

With the help of `tt` (_TimeTunnel_), you can check the contexts of the methods at different times in execution history.

## Precautions

* The implementation of the tt command is to save the input parameters/return values of the function into a `Map<Integer, TimeFragment>`. The default size is 100.
* After using tt related functions, you need to manually release the memory, otherwise OOM may occur for a long time. Exiting arthas will not automatically clear tt's cache map.

## Usage

### Start Demo
Expand Down Expand Up @@ -210,3 +215,15 @@ F.Y.I
2. params may be modified

Arthas save params into an array, they are object references. The Objects may be modified by other code.

### Delete the specified tt record by index

```
tt -d 1001
```

### Clear all tt records

```
tt --delete-all
```

0 comments on commit cb5d59f

Please sign in to comment.