diff --git a/README.md b/README.md index 827c5c798..569c9d172 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,12 @@ Arthas was built to solve these issues. A developer can trouble-shoot your produ * Supports JDK 6+ * Supports Linux/Mac/Windows + +### Online Tutorials(Recommend) + +* [Arthas Basics](https://alibaba.github.io/arthas/arthas-tutorials?language=en&id=arthas-basics) +* [Arthas Advanced](https://alibaba.github.io/arthas/arthas-tutorials?language=en&id=arthas-advanced) + ### Quick start #### Use `arthas-boot`(Recommend) @@ -72,6 +78,7 @@ You can enter its interactive interface by executing `as.sh`, or execute `as.sh ### Documentation +* [Online Tutorials(Recommend)](https://alibaba.github.io/arthas/arthas-tutorials?language=en) * [User manual](https://alibaba.github.io/arthas/en) * [Installation](https://alibaba.github.io/arthas/en/install-detail.html) * [Quick start](https://alibaba.github.io/arthas/en/quick-start.html) @@ -96,7 +103,7 @@ You can enter its interactive interface by executing `as.sh`, or execute `as.sh See what is eating your cpu (ranked by top cpu usage) and what is going on there in one glance: -``` +```bash $ thread -n 3 "as-command-execute-daemon" Id=29 cpuUsage=75% RUNNABLE at sun.management.ThreadImpl.dumpThreads0(Native Method) @@ -162,11 +169,28 @@ public interface Servlet { } ``` +#### mc + +Memory compiler, compiles `.java` files into `.class` files in memory. + +```bash +mc /tmp/Test.java +``` + +#### redefine + +Load the external `*.class` files to re-define the loaded classes in JVM. + +```bash +redefine /tmp/Test.class +redefine -c 327a647b /tmp/Test.class /tmp/Test\$Inner.class +``` + #### sc Search any loaded class with detailed information. -``` +```bash $ sc -d org.springframework.web.context.support.XmlWebApplicationContext class-info org.springframework.web.context.support.XmlWebApplicationContext code-source /Users/xxx/work/test/WEB-INF/lib/spring-web-3.2.11.RELEASE.jar @@ -202,7 +226,7 @@ $ sc -d org.springframework.web.context.support.XmlWebApplicationContext View the call stack of `test.arthas.TestStack#doGet`: -``` +```bash $ stack test.arthas.TestStack doGet Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 286 ms. @@ -243,7 +267,7 @@ See what is slowing down your method invocation with trace command: Watch the first parameter and thrown exception of `test.arthas.TestWatch#doGet` only if it throws exception. -``` +```bash $ watch test.arthas.TestWatch doGet {params[0], throwExp} -e Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 65 ms. @@ -257,7 +281,7 @@ ts=2018-09-18 10:26:28;result=@ArrayList[ Monitor a specific method invocation statistics, including total number of invocations, average response time, success rate, every 5 seconds: -``` +```bash $ monitor -c 5 org.apache.dubbo.demo.provider.DemoServiceImpl sayHello Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 109 ms. @@ -278,7 +302,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 109 ms. Record method invocation data, so that you can check the method invocation parameters, returned value and thrown exception later. It works as if you could come back and replay the past method invocation via time tunnel. -``` +```bash $ tt -t org.apache.dubbo.demo.provider.DemoServiceImpl sayHello Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 75 ms. @@ -297,7 +321,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 75 ms. #### Classloader -``` +```bash $ classloader name numberOfInstances loadedCountTotal BootstrapClassLoader 1 3346 diff --git a/README_CN.md b/README_CN.md index d5ad3af0c..27720dcbf 100644 --- a/README_CN.md +++ b/README_CN.md @@ -27,9 +27,14 @@ English version goes [here](README.md). `Arthas`支持JDK 6+,支持Linux/Mac/Windows,采用命令行交互模式,同时提供丰富的 `Tab` 自动补全功能,进一步方便进行问题的定位和诊断。 +### 在线教程(推荐) + +* [基础教程](https://alibaba.github.io/arthas/arthas-tutorials?language=cn&id=arthas-basics) +* [进阶教程](https://alibaba.github.io/arthas/arthas-tutorials?language=cn&id=arthas-advanced) + ### 快速开始 -#### 使用`arthas-boot`(推荐) +#### 使用`arthas-boot`(推荐) 下载`arthas-boot.jar`,然后用`java -jar`的方式启动: @@ -60,9 +65,9 @@ curl -L https://alibaba.github.io/arthas/install.sh | sh 也可以执行`./as.sh -h`来获取更多参数信息。 - ### 文档 +* [在线教程(推荐)](https://alibaba.github.io/arthas/arthas-tutorials?language=cn) * [用户文档](https://alibaba.github.io/arthas/) * [安装](https://alibaba.github.io/arthas/install-detail.html) * [快速入门](https://alibaba.github.io/arthas/quick-start.html) @@ -155,11 +160,28 @@ public interface Servlet { } ``` +#### mc + +Memory Compiler/内存编译器,编译`.java`文件生成`.class`。 + +```bash +mc /tmp/Test.java +``` + +#### redefine + +加载外部的`.class`文件,redefine jvm已加载的类。 + +```bash +redefine /tmp/Test.class +redefine -c 327a647b /tmp/Test.class /tmp/Test\$Inner.class +``` + #### sc 查找JVM中已经加载的类 -``` +```bash $ sc -d org.springframework.web.context.support.XmlWebApplicationContext class-info org.springframework.web.context.support.XmlWebApplicationContext code-source /Users/xxx/work/test/WEB-INF/lib/spring-web-3.2.11.RELEASE.jar @@ -195,7 +217,7 @@ $ sc -d org.springframework.web.context.support.XmlWebApplicationContext 查看方法 `test.arthas.TestStack#doGet` 的调用堆栈: -``` +```bash $ stack test.arthas.TestStack doGet Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 286 ms. @@ -236,7 +258,7 @@ ts=2018-09-18 10:11:45;thread_name=http-bio-8080-exec-10;id=d9;is_daemon=true;pr 观察方法 `test.arthas.TestWatch#doGet` 执行的入参,仅当方法抛出异常时才输出。 -``` +```bash $ watch test.arthas.TestWatch doGet {params[0], throwExp} -e Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 65 ms. @@ -251,7 +273,7 @@ ts=2018-09-18 10:26:28;result=@ArrayList[ 监控某个特殊方法的调用统计数据,包括总调用次数,平均rt,成功率等信息,每隔5秒输出一次。 -``` +```bash $ monitor -c 5 org.apache.dubbo.demo.provider.DemoServiceImpl sayHello Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 109 ms. @@ -272,7 +294,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 109 ms. 记录方法调用信息,支持事后查看方法调用的参数,返回值,抛出的异常等信息,仿佛穿越时空隧道回到调用现场一般。 -``` +```bash $ tt -t org.apache.dubbo.demo.provider.DemoServiceImpl sayHello Press Ctrl+C to abort. Affect(class-cnt:1 , method-cnt:1) cost in 75 ms. @@ -293,7 +315,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 75 ms. 了解当前系统中有多少类加载器,以及每个加载器加载的类数量,帮助您判断是否有类加载器泄露。 -``` +```bash $ classloader name numberOfInstances loadedCountTotal BootstrapClassLoader 1 3346 diff --git a/site/src/site/sphinx/en/mc.md b/site/src/site/sphinx/en/mc.md index 3259900e1..195418056 100644 --- a/site/src/site/sphinx/en/mc.md +++ b/site/src/site/sphinx/en/mc.md @@ -1,7 +1,7 @@ mc === -> Memory compiler, compiles java files into bytecode and class files in memory. +> Memory compiler, compiles `.java` files into `.class` files in memory. ```bash mc /tmp/Test.java diff --git a/site/src/site/sphinx/en/redefine.md b/site/src/site/sphinx/en/redefine.md index 2bd09c22e..c6f2b364b 100644 --- a/site/src/site/sphinx/en/redefine.md +++ b/site/src/site/sphinx/en/redefine.md @@ -1,7 +1,7 @@ redefine ======== -> Load the external `*.class` files to re-define the loaded peer class in JVM. +> Load the external `*.class` files to re-define the loaded classes in JVM. Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-)