From cb5d59fd0b95c45b46f4991961b6cfbf4ca34fd1 Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Tue, 2 Jan 2024 15:44:06 +0800 Subject: [PATCH] update tt docs. #2771 --- .../command/monitor200/TimeTunnelCommand.java | 2 +- site/docs/doc/tt.md | 18 ++++++++++++++++++ site/docs/en/doc/tt.md | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java b/core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java index 700416165a..3c866a677b 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java @@ -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; } diff --git a/site/docs/doc/tt.md b/site/docs/doc/tt.md index 13f2854774..86e4848370 100644 --- a/site/docs/doc/tt.md +++ b/site/docs/doc/tt.md @@ -12,6 +12,11 @@ 于是乎,TimeTunnel 命令就诞生了。 +## 注意事项 + +* tt 命令的实现是:把函数的入参/返回值等,保存到一个`Map`里,默认的大小是 100。 +* tt 相关功能在使用完之后,需要手动释放内存,否则长时间可能导致OOM。退出 arthas 不会自动清除 tt 的缓存 map。 + ## 使用参考 ### 启动 Demo @@ -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 +``` \ No newline at end of file diff --git a/site/docs/en/doc/tt.md b/site/docs/en/doc/tt.md index 3849d38733..0e869f65f6 100644 --- a/site/docs/en/doc/tt.md +++ b/site/docs/en/doc/tt.md @@ -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`. 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 @@ -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 +``` \ No newline at end of file