update en doc

pull/483/head
hengyunabc 6 years ago
parent e1aec34af0
commit 5124cca8eb

@ -92,10 +92,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -1,15 +1,15 @@
Batch Processing Batch Processing
================ ================
With the help of `Batch Processing`, you can run several commands in one line and get the results. With the help of Batch Processing, you can run multiple commands in batch and get the final result at the end.
### Usage ### Usage
#### Step-1: Create the script #### Step 1: Create the script
Creating a `test.as` script suffixed with `as` here for consistency (actually any suffix is acceptable). Create a `test.as` script suffixed with `as`. Here `as` is suggested for the suffix of the filename, but in fact any suffix is acceptable.
``` ```bash
➜ arthas git:(develop) cat /var/tmp/test.as ➜ arthas git:(develop) cat /var/tmp/test.as
help help
dashboard -b -n 1 dashboard -b -n 1
@ -18,21 +18,21 @@ thread
sc -d org.apache.commons.lang.StringUtils sc -d org.apache.commons.lang.StringUtils
``` ```
Attention: Note:
* each command takes each independent line; * Each command takes one line.
* `dashboard` command should include `-b` to turn on batch mode and `-n` to ensure the script ends; * Batch mode (via `-b`) and execution times (via `-n`) must be explicitly specified for `dashboard`, otherwise batch script cannot terminate.
* commands as `watch/tt/trace/monitor/stack` should include `-n` option to ensure the script ends; * Commands such as `watch`/`tt`/`trace`/`monitor`/`stack` should include `-n` option to ensure the script can be able to quit.
* [asynchronous](async.md) can also be used as `watch c.t.X test returnObj > &`; * Also consider to use `async` (for example: `watch c.t.X test returnObj > &`) to put commands run at background and get the output from the log file, see more from [asynchronous job](async.md)
#### Step-2: Run the script #### Step 2: Run the script
Using `-b` to turn on script mode, and `-f` to run it and you can also *redirect* the output as: Use `-b` to turn on batch mode, and use `-f` to specify the script file. By default the result will be output to the standard output, but you can redirect the output to the file like this:
```bash ```bash
./as.sh -b -f /var/tmp/test.as 56328 > test.out ./as.sh -b -f /var/tmp/test.as 56328 > test.out
``` ```
#### Step-3: Check the outputs #### Step 3: Check the outputs
```bash ```bash
cat test.out cat test.out

@ -1,23 +1,23 @@
classloader classloader
=========== ===========
Check the inheritance tree, urls and classes loading profiles of the class loaders. View hierarchy, urls and classes-loading info for the class-loaders.
It can be a great help for `ResourceNotFoundException` when you can use command `classloader` to specify a class loader to `getResources` and print all the urls of the valid resources. `classloader` can search and print out the URLs for a specified resource from one particular classloader. It is quite handy when analyze `ResourceNotFoundException`.
### Options ### Options
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|[l]|list all class loader instances based on thread count| |[l]|list all class loader instances|
|[t]|print the inheritance structure of the class loaders| |[t]|print classloader's hierarchy|
|[a]|list all the classes loaded by all the class loaders (use it with great caution since the output can be huge)| |[a]|list all the classes loaded by all the class loaders (use it with great caution since the output can be huge)|
|[c:]|get the hashcode of the class loader| |[c:]|print classloader's hashcode|
|[c: r:]|using class loader to search resource| |[c: r:]|using class loader to search resource|
### Usage ### Usage
* Categorised by class loader * View statistics categorized by class type
```bash ```bash
$ classloader $ classloader
@ -36,7 +36,7 @@ $ classloader
Affect(row-cnt:11) cost in 66 ms. Affect(row-cnt:11) cost in 66 ms.
``` ```
* Categorized by class loader instance * View statistics categorized by loaded classes number
```bash ```bash
$ classloader -l $ classloader -l
@ -86,7 +86,7 @@ $ classloader -l
sun.reflect.misc.MethodUtil@1201f221 1 1201f221 sun.misc.Launcher$AppClassLoader@14dad5dc sun.reflect.misc.MethodUtil@1201f221 1 1201f221 sun.misc.Launcher$AppClassLoader@14dad5dc
``` ```
* Check inheritance tree of the class loaders * View class-loaders hierarchy
```shell ```shell
$ classloader -t $ classloader -t
@ -100,7 +100,7 @@ $ classloader -t
| | +-sun.reflect.DelegatingClassLoader@73f44f24 | | +-sun.reflect.DelegatingClassLoader@73f44f24
``` ```
* Check URL of the class loader * Show the URLs from which to load classes and resources for one particular URLClassLoader
```shell ```shell
$ classloader -c 5ffe9775 $ classloader -c 5ffe9775
@ -113,7 +113,7 @@ file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.th
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/picocontainer-2.14.3.jar file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/picocontainer-2.14.3.jar
``` ```
* Using class loader to search for resource * Use one class loader to search one particular resource
```shell ```shell
$ classloader -c 226b143b -r META-INF/MANIFEST.MF $ classloader -c 226b143b -r META-INF/MANIFEST.MF
@ -121,7 +121,7 @@ $ classloader -c 226b143b -r META-INF/MANIFEST.MF
jar:file:/Users/hello/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar!/META-INF/MANIFEST.MF jar:file:/Users/hello/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar!/META-INF/MANIFEST.MF
``` ```
* Using class loader to look for `*.class` file * Use one class loader to search one particular class
```shell ```shell
$ classloader -c 1b6d3586 -r java/lang/String.class $ classloader -c 1b6d3586 -r java/lang/String.class

@ -1,16 +1,12 @@
All Commands All Commands
============= =============
* [dashboard](dashboard.md) * [dashboard](dashboard.md)
* [thread](thread.md) * [thread](thread.md)
* [jvm](jvm.md) * [jvm](jvm.md)
* [sysprop](sysprop.md) * [sysprop](sysprop.md)
* [getstatic](getstatic.md) * [getstatic](getstatic.md)
* [sc](sc.md) * [sc](sc.md)
* [sm](sm.md) * [sm](sm.md)
* [dump](dump.md) * [dump](dump.md)
@ -28,16 +24,16 @@ All Commands
* [options](options.md) * [options](options.md)
### Basic Commands ### Basic Arthas Commands
* help - check the assistant info for the command * help - examine help information
* cls - clear out the current screen area * cls - clear out the screen
* session - check the current session profile * session - examine the current session
* [reset](reset.md) - clear the injected code from the classes (B.T.W when Arthas server closed, all the injected will also be cleared) * [reset](reset.md) - reset enhanced classes. All enhanced classes will be reset to their original states. When Arthas server closes, all these enhanced classes will be reset too
* version - the version of the working Arthas * version - print out Arthas's version
* quit - exit the current Arthas client without affecting other clients * quit - exit the current Arthas client without affecting other clients
* shutdown - terminate the Arthas server and all clients * shutdown - terminate the Arthas server, all the Arthas clients connecting to this server will be disconnected
* [keymap](keymap.md) - shortcuts for Arthas and also you can define your own * [keymap](keymap.md) - list all Arthas keyboard shortcuts and shortcut customizations.

@ -1,11 +1,11 @@
dashboard dashboard
========= =========
This is the realtime dashboard for the system; press `Ctrl+C` to exit. > This is the real time statistics dashboard for the current system, press `Ctrl+C` to exit.
When running in *Ali-tomcat*, the dashboard will present the realtime statistics of the tomcat including [QPS](https://en.wikipedia.org/wiki/Queries_per_second), RT, error counts, thread profile and the like. When running in Apache Tomcat Alibaba edition, the dashboard will also present the real time statistics of the tomcat, including [QPS](https://en.wikipedia.org/wiki/Queries_per_second), RT, error counts, and thread pool, etc.
### A Demo ### Usage
``` ```
$ dashboard $ dashboard
@ -44,18 +44,18 @@ processors 4 threadpool
uptime 16020s busy 0 uptime 16020s busy 0
``` ```
### Specification ### Notes on column headers
* ID: thread ID in JVM (this is different from the nativeID in thread dump) * ID: JVM thread ID, pls. note this ID is different from the nativeID in jstack
* NAME: thread name * NAME: thread name
* GROUP: group the thread is in * GROUP: thread group name
* STATE: the current state of the thread * PRIORITY: thread priority, ranged from 1 to 10. The greater number, the higher priority
* PRIORITY: within 1 ~ 10 (the higher the number, the higher the priority) * STATE: thread state
* CPU%: CPU usage ratio within 100ms * CPU%: the ratio of CPU usage for the thread, sampled every 100ms
* TIME: total running time in minute:second format * TIME: total running time in `minute:second` format
* INTERRUPTED: the thread interrupted state * INTERRUPTED: the thread interruption state
* DAEMON: is daemon thread or not * DAEMON: daemon thread or not
### Screenshots ### Screenshot
![alt text](../_static/dashboard.png "dashboard") ![alt text](../_static/dashboard.png "dashboard")

@ -1,15 +1,15 @@
dump dump
=== ===
Dump the bytecode the loaded classes to a specified directory. > Dump the bytecode for the particular classes to the specified directory.
### Options ### Options
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|*class-pattern*|pattern for the class name| |*class-pattern*|class name pattern|
|[c:]|hashcode of the [class loader](classloader.md) that loaded the class| |`[c:]`|hashcode of the [class loader](classloader.md) that loaded the target class|
|[E]|turn on regex matching while the default is wildcard matching| |`[E]`|turn on regex match, the default behavior is wild card match|
### Usage ### Usage

@ -1,13 +1,13 @@
getstatic getstatic
========= =========
Check the static fields of classes conveniently as `getstatic class_name field_name` Check the static fields of classes conveniently, the usage is `getstatic class_name field_name`.
Tip: if the *field* is a composite object, you can even use [`OGNL`](https://en.wikipedia.org/wiki/OGNL) to traverse, filter and access the internal properties of it. Tip: if the static field is a complex class, you can even use [`OGNL`](https://en.wikipedia.org/wiki/OGNL) to traverse, filter and access the inner properties of this class.
E.g. suppose `n` is a `Map` and the key is a `Enum` then if you want to get the key with a specific `Enum` value - `STOP` or `a`, you can achieve it as: E.g. suppose `n` is a `Map` and its key is a `Enum`, then you can achieve this if you want to pick the key with a specific `Enum` value:
``` ```bash
$ getstatic com.alibaba.arthas.Test n 'entrySet().iterator.{? #this.key.name()=="STOP"}' $ getstatic com.alibaba.arthas.Test n 'entrySet().iterator.{? #this.key.name()=="STOP"}'
field: n field: n
@ArrayList[ @ArrayList[

@ -0,0 +1,170 @@
groovy
===
> Arthas support groovy scripting to allow user to use script like BTrace. It is possible to use if/for/switch/while in groovy scripting, but has more limitations compared to BTrace.
### Limitations
1. Prohibit from alternating the original logic. Like `watch` command, The major purpose of scripting is monitoring and observing.
1. Only allow to monitor at the stages of before/success/exception/finish on one method.
### Parameters
|Parameter|Explanation|
|---:|:---|
|*class-pattern*|class name pattern|
|*method-pattern*|method name pattern|
|*script-filepath*|the absolute path of the groovy script|
|[S]|match all sub classes|
|[E]|enable regex match, the default is wildcard match|
Note: the third parameter `script-filepath` must be the absolute path of the groovy script, for example `/tmp/test.groovy`. It is not recommended to use relative path, e.g. `./test.groovy`.
### Explanation on the important callbacks
```java
/**
* Listeners for script to enhance the class
*/
interface ScriptListener {
/**
* When the script is created
*
* @param output Output
*/
void create(Output output);
/**
* When the script is destroyed
*
* @param output Output
*/
void destroy(Output output);
/**
* Before the method executes
*
* @param output Output
* @param advice Advice
*/
void before(Output output, Advice advice);
/**
* After the method returns
*
* @param output Output
* @param advice Advice
*/
void afterReturning(Output output, Advice advice);
/**
* After the method throws exceptions
*
* @param output Output
* @param advice Advice
*/
void afterThrowing(Output output, Advice advice);
}
```
### `Advice` parameter
`Advice` contains all information necessary for notification. Refer to [expression core parameters](advice-class.md) for more details.
### `Output` parameter
There are three methods in `Output`, used for outputting the corresponding text.
```java
/**
* Output
*/
interface Output {
/**
* Output text without line break
*
* @param string Text to output
* @return this
*/
Output print(String string);
/**
* Output text with line break
*
* @param string Text to output
* @return this
*/
Output println(String string);
/**
* Finish outputting from the script
*
* @return this
*/
Output finish();
}
```
### A groovy sample script to output logs
```groovy
import com.taobao.arthas.core.command.ScriptSupportCommand
import com.taobao.arthas.core.util.Advice
import static java.lang.String.format
/**
* Output method logs
*/
public class Logger implements ScriptSupportCommand.ScriptListener {
@Override
void create(ScriptSupportCommand.Output output) {
output.println("script create.");
}
@Override
void destroy(ScriptSupportCommand.Output output) {
output.println("script destroy.");
}
@Override
void before(ScriptSupportCommand.Output output, Advice advice) {
output.println(format("before:class=%s;method=%s;paramslen=%d;%s;",
advice.getClazz().getSimpleName(),
advice.getMethod().getName(),
advice.getParams().length, advice.getParams()))
}
@Override
void afterReturning(ScriptSupportCommand.Output output, Advice advice) {
output.println(format("returning:class=%s;method=%s;",
advice.getClazz().getSimpleName(),
advice.getMethod().getName()))
}
@Override
void afterThrowing(ScriptSupportCommand.Output output, Advice advice) {
output.println(format("throwing:class=%s;method=%s;",
advice.getClazz().getSimpleName(),
advice.getMethod().getName()))
}
}
```
Run the script like this:
```bash
$ groovy com.alibaba.sample.petstore.dal.dao.ProductDao getProductById /Users/zhuyong/middleware/arthas/scripts/Logger.groovy -S
script create.
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 102 ms.
before:class=IbatisProductDao;method=getProductById;paramslen=1;[Ljava.lang.Object;@45df64fc;
returning:class=IbatisProductDao;method=getProductById;
before:class=IbatisProductDao;method=getProductById;paramslen=1;[Ljava.lang.Object;@5b0e2d00;
returning:class=IbatisProductDao;method=getProductById;
```

@ -1,49 +1,46 @@
Arthas Documentation Arthas Documentation
=== ===
**[中文文档/Chinese Docs](https://alibaba.github.io/arthas/)** **[中文文档](https://alibaba.github.io/arthas/)**
![arthas](arthas.png) ![arthas](arthas.png)
`Arthas` is a Java Diagnostic tool open sourced by Alibaba. Arthas is a Java diagnostic tool open-sourced by Alibaba middleware team. It is widely adopted and popular among the developers inside Alibaba. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers.
Arthas help developers in trouble-shooting production issues for Java applications without modifying code or restarting servers.
### Background ### Background
Often times, the production system network is inaccessible from local development environment. If issues are encountered in production systems, it is impossible to use IDE to debug the application remotely. More importantly, debugging in production environment is unacceptable, as it will suspend all the threads, which leads to blocking of business services. Oftentimes the production system network is inaccessible from local development environment. If issues are encountered in production systems, it is impossible to use IDE to debug the application remotely. What's even worse, debugging in production environment is unacceptable, as it will suspend all the threads, leading to services downtime.
Developers could always try to reproduce the same issue on the test/staging environment. However, this is tricky as some issues cannot be be reproduced easily on a different environment, or even disappear once restarted. Developers could always try to reproduce the same issue on the test/staging environment. However, this is tricky as some issues cannot be reproduced easily in a different environment, or even disappear once restarted.
And if you're thinking of adding some logs to your code to help trouble-shoot the issue, you will have to go through the following lifecycle; test, staging, and then to production. Time is money! This approach is inefficient! Besides, the issue may not be reproducible once the JVM is restarted, as described above. And if you're thinking of adding some logs to your code to help trouble-shoot the issue, you will have to go through the following lifecycle: test, staging, and then to production. Time is money! This approach is inefficient! Worse still, the issue may not be fixed since it might be irreproducible once the JVM is restarted, as described above.
Arthas was built to solve these issues. A developer can trouble-shoot your production issues on-the-fly. No JVM restart, no additional code changes. Arthas works as an observer, which will never suspend your existing threads. Arthas is built to solve these issues. A developer can troubleshoot production issues on the fly. No JVM restart, no additional code changes. Arthas works as an observer, that is, it will never suspend your running threads.
### Key features ### Key features
* Check whether a class is loaded? Or where the class is loaded from? (Useful for trouble-shooting jar file conflicts) * Check whether a class is loaded? Or where the class is loaded from? (Useful for trouble-shooting jar file conflicts)
* Decompile a class to ensure the code is running as expected. * Decompile a class to ensure the code is running as expected.
* View classloader statistics, e.g. the number of classloaders, the number of classes loaded per classloader, the classloader hierarchy, possible classloader leaks, etc. * Check classloader statistics, e.g. the number of classloaders, the number of classes loaded per classloader, the classloader hierarchy, possible classloader leaks, etc.
* View the method invocation details, e.g. method parameter, return object, thrown exception, and etc. * Check the method invocation details, e.g. method parameter, returned values, exceptions and etc.
* Check the stack trace of specified method invocation. This is useful when a developers wants to know the caller of the said method. * Check the stack trace of specified method invocation. This is useful when a developer wants to know the caller of the method.
* Trace the method invocation to find slow sub-invocations. * Trace the method invocation to find slow sub-invocations.
* Monitor method invocation statistics, e.g. qps, rt, success rate and etc. * Monitor method invocation statistics, e.g. QPS (Query Per Second), RT (Return Time), success rate and etc.
* Monitor system metrics, thread states and cpu usage, gc statistics, and etc. * Monitor system metrics, thread states and CPU usage, GC statistics and etc.
* Supports command line interactive mode, with auto-complete feature enabled. * Supports command line interactive mode, with auto-complete feature enabled.
* Supports telnet and websocket, which enables both local and remote diagnostics with command line and browsers. * Supports telnet and WebSocket, which enables both local and remote diagnostics with command line and browsers.
Contents Contents
-------- --------
English version has just been finished. If you would like to make it better, please check [here](https://github.com/alibaba/arthas/issues/51) and submit your PM. English version has just been finished. If you would like to make it better, please check [here](https://github.com/alibaba/arthas/issues/51) and submit your pull request.
* [Installation](install-detail.md) * [Installation](install-detail.md)
* [Quick start](quick-start.md) * [Quick start](quick-start.md)
* [Advanced usage](advanced-use.md) * [Advanced usage](advanced-use.md)
* [Commands](commands.md) * [Commands](commands.md)
* [User cases](https://github.com/alibaba/arthas/issues?q=label%3Auser-case) * [User cases](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
* [Release Notes](release-notes.md)
* [Questions and answers](https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered) * [Questions and answers](https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered)
* [Fork me at GitHub](https://github.com/alibaba/arthas) * [Fork me at GitHub](https://github.com/alibaba/arthas)
* [CONTRIBUTING](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md) * [CONTRIBUTING](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)
* [Release Notes](release-notes.md)

@ -1,51 +1,45 @@
Arthas Install Install Arthas
============== ==============
## Linux/Unix/Mac ## Linux/Unix/Mac
You can install Arthas in one single line as: You can install Arthas with one single line command on Linux, Unix, and Mac. Pls. copy the following command and paste it into the command line, then press *Enter* to run:
```bash ```bash
curl -L https://alibaba.github.io/arthas/install.sh | sh curl -L https://alibaba.github.io/arthas/install.sh | sh
``` ```
The command line above will download the booting script `as.sh` to the current directory and you can then start Arthas by `./as.sh`, for more help info you can use `./as.sh -h` to check the details. The command above will download the bootstrap script `as.sh` to the current directory. You can move it the any other place you want, or put its location in `$PATH`.
By the way, you can also add the absolute path of the script `as.sh` to `$PATH` to make it available globally. You can enter its interactive interface by executing `as.sh`, or execute `as.sh -h` for more help information.
## Windows ## Windows
Latest Version: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22) Latest Version: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22)
Download the latest `bin.zip`, unzip the package and you can find the `as.bat`. For now this script will only take one argument `pid` which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:) Download the latest `bin.zip`, unzip the package, and find `as.bat` from 'bin' directory. For now this script will only take one argument `pid`, which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:)
```bash ```bash
as.bat <pid> as.bat <pid>
``` ```
A small tip: To have a better experience, you can start the Arthas Server locally by executing `as.bat <pid>`, then run `./as.sh <pid>@<ip>:<por>` in another Linux/Unix/Mac machine.
If you are asking for better UX, you can start the Arthas Server locally by `as.bat <pid>` and then use `./as.sh <pid>@<ip>:<por>`in another Linux/Unix/Mac machine. > If the color is not working as expect on windows, you can use [conemu](https://sourceforge.net/projects/conemu) to get it to work.
Another tip:
If in Windows, the color is not working as expect. You can try [conemu](https://sourceforge.net/projects/conemu) to get it to work.
## Manual Installation ## Manual Installation
[Manual Installation](manual-install.md) [Manual Installation](manual-install.md)
## Advanced Manual Boot If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.
If you cannot boot Arthas, try to pass in all the critical options manually as the following steps:
1. locate the java for JVM: 1. Locate java in the target JVM:
- Linux/Unix/Mac: `ps aux | grep java` - Linux/Unix/Mac: `ps aux | grep java`
- Windows: open the Process Monitor to search java - Windows: open the Process Monitor to search java
2. Concatenate the command 2. Assemble bootstrap command:
Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be: Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be:
@ -58,21 +52,20 @@ If you cannot boot Arthas, try to pass in all the critical options manually as t
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar
``` ```
* `-Xbootclasspath` add tools.jar Note:
* `-jar /tmp/arthas-packaging/arthas-core.jar` specify main entry
* `-pid 15146` specify the target java process pid * `-Xbootclasspath` adds tools.jar
* `-target-ip 127.0.0.1` specify the IP * `-jar /tmp/arthas-packaging/arthas-core.jar` specifies main entry
* `-telnet-port 3658 -http-port 8563` specify telnet and http ports * `-pid 15146` specifies the target java process PID
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` specify core/agent jar package * `-target-ip 127.0.0.1` specifies the IP
* `-telnet-port 3658 -http-port 8563` specifies telnet and HTTP ports for remote access
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` specifies core/agent jar package
But if you are using JDK 1.9 or abovethen you do not need to add `tools.jar` in option `-Xbootclasspath`.
If you are running on JDK 1.9 or abovethen it's unncessary to add `tools.jar` in option `-Xbootclasspath`.
F.Y.I the booting log will be printed to `~/logs/arthas/arthas.log`.
You can find the logs from `~/logs/arthas/arthas.log`.
3. Connect via telnet
When attached successfully, you can connect it with 3. Use telnet to connect once attaching to the target JVM (in step 2) succeeds
```bash ```bash
telnet localhost 3658 telnet localhost 3658
@ -86,12 +79,10 @@ Download the latest `doc.zip`.
## Uninstall ## Uninstall
### Linux/Unix/Mac * On Linux/Unix/Mac, delete the files with the following command:
```bash ```bash
rm -rf ~/.arthas/ ~/.arthas_history rm -rf ~/.arthas/ ~/.arthas_history
``` ```
### Windows
Directly delete the `zip` and unzipped files. * On Windows, simply delete the zip file and unzipped files.

@ -1,27 +1,24 @@
jad jad
=== ===
De-compile specified loaded classes. > De-compile the specified classes.
`jad` helps to *de-compile* the byte code in JVM to the source code to assist you to better understand the logic behind. `jad` helps to de-compile the byte code running in JVM to the source code to assist you to understand the logic behind better.
F.Y.I * The de-compiled code is syntax highlighted for better readability in Arthas console.
* the de-compiled code will be grammatically highlighted for readability in Arthas console; * It is possible that there's grammar error in the de-compiled code, but it should not affect your interpretation.
* there might be some trivial grammar errors but it won't affect the logic understanding.
### Options ### Options
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|*class-pattern*|pattern for the class name| |*class-pattern*|pattern for the class name|
|[c:]|hashcode of the class loader that loaded the class| |`[c:]`|hashcode of the class loader that loads the class|
|[E]|turn on regex matching while the default is wildcard matching| |`[E]`|turn on regex match while the default is wildcard match|
### Usage ### Usage
When several class loaders loaded the same class: > If the target class is loaded by multiple classloaders, `jad` outputs the `hashcode` of the corresponding classloaders, then you can re-run `jad` and specify `-c <hashcode>` to de-compile the target class from the specified classloader.
1. `jad` to get the hashcode of the class loader;
2. `jad -c <hashcode>` to get the de-compiled class loaded by the specified class loader.
```java ```java
$ jad org.apache.log4j.Logger $ jad org.apache.log4j.Logger
@ -156,7 +153,3 @@ private Map<String, Object> directMetrics(String ip, String[] metrics) {
Affect(row-cnt:1) cost in 1508 ms. Affect(row-cnt:1) cost in 1508 ms.
``` ```
F.Y.I
Inner class is not yet supported, you can just check the *outer* class to further check the inner class.

@ -1,7 +1,7 @@
jvm jvm
=== ===
Check the JVM profile > Check the current JVM's info
### Usage ### Usage
@ -95,16 +95,16 @@ $ jvm
Affect cost in 2 ms. Affect cost in 2 ms.
``` ```
### thread-related ### Thread related
* COUNT: the count of active threads * COUNT: the count of active threads
* DAEMON-COUNT: the count of active daemon threads * DAEMON-COUNT: the count of active daemon threads
* PEAK-COUNT: the maximum count of the live threads since JVM starts * PEAK-COUNT: the maximum count of the live threads since JVM starts
* STARTED-COUNT: the total count of the created threads since JVM starts * STARTED-COUNT: the total count of the created threads since JVM starts
* DEADLOCK-COUNT: the count of deadlock threads * DEADLOCK-COUNT: the count of deadlocked threads
### fileDescriptor-related ### File descriptor related
* MAX-FILE-DESCRIPTOR-COUNTthe count of max file descriptor JVM process can open * MAX-FILE-DESCRIPTOR-COUNTthe count of max file descriptor JVM process can open
* OPEN-FILE-DESCRIPTOR-COUNTthe current count of file descriptor JVM process open * OPEN-FILE-DESCRIPTOR-COUNTthe current count of file descriptor JVM process open

@ -1,11 +1,10 @@
Arthas Console Keymap Arthas Console Keymap
=== ===
`keymap` command print current keymap. Use `keymap` command to print the current keymap:
The default keymap is: The default keymap is:
| Shortcut | Shortcut Description | Command Name | Command Description | | Shortcut | Shortcut Description | Command Name | Command Description |
| ------------- | ---------------- | -------------------- | ---------------- | | ------------- | ---------------- | -------------------- | ---------------- |
| `"\C-a"` | ctrl + a | beginning-of-line | go to the beginning of the line | | `"\C-a"` | ctrl + a | beginning-of-line | go to the beginning of the line |
@ -28,16 +27,14 @@ The default keymap is:
| `"\C-x\e[3~"` | | backward-kill-line | | | `"\C-x\e[3~"` | | backward-kill-line | |
| `"\e\C-?"` | | backward-kill-word | | | `"\e\C-?"` | | backward-kill-word | |
* Press `tab` to enable auto-completion prompt at any time.
* You can enter `Tab` to get automatic prompts at any time. * Enter command and `-` or `--`, then press `tab` to display the concrete options for the current command.
* After typing the command, type `-` or `--`, then press `tab` to display the specific options of this command.
#### Custom shortcuts #### Custom shortcuts
Create a new `$USER_HOME/.arthas/conf/inputrc` file in the current user home directory and add a custom configuration. Specify customization in `$USER_HOME/.arthas/conf/inputrc` file in the current user home directory.
Suppose I am a heavy user of vim. I want to set `ctrl+h` to the cursor forward character. Set it as follows, first copy the default configuration. Vim user may want to map `ctrl+h` to moving the cursor forward one character. To achieve this, copy the default configuration first,
``` ```
"\C-a": beginning-of-line "\C-a": beginning-of-line
@ -61,14 +58,14 @@ Suppose I am a heavy user of vim. I want to set `ctrl+h` to the cursor forward c
"\e\C-?": backward-kill-word "\e\C-?": backward-kill-word
``` ```
Then replace `"\C-h": backward-delete-char` with `"\C-h": backward-char`, then reconnect. then replace `"\C-h": backward-delete-char` with `"\C-h": backward-char`, then reconnect to Arthas console to take effect.
#### Shortcuts about async #### Shortcuts for jobs
* ctrl + c: Terminate current command * `ctrl + c`: Terminate current command
* ctrl + z: Suspend the current command, you can restore this command with bg/fg, or kill it. * `ctrl + z`: Suspend the current command, you can restore this command with `bg`/`fg`, or `kill` it.
* ctrl + a: Go to the beginning the line * `ctrl + a`: Go to the beginning the line
* ctrl + e: Go to the end of the line * `ctrl + e`: Go to the end of the line

@ -1,31 +1,33 @@
Manual Installation Manually Install Arthas
=================== ===================
### Download 1. Download the latest version
**Latest `bin.zip`**: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22) **Latest version**: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22)
If the download speed is slow, try to use [Ali cloud mirror repository](https://maven.aliyun.com/), for example, to download version `3.x.x` (you can replace `3.x.x` in the example URL if you want to download other version), the download URL is: https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.x.x/arthas-packaging-3.x.x-bin.zip
If the download is slow, try to download from the [repository in AliYun](https://maven.aliyun.com/); the downloading URL template is (remember to fill up the version `3.x.x` template to your needs) 2. Unzip zip file
`https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.x.x/arthas-packaging-3.x.x-bin.zip` ```bash
### Unzip unzip arthas-packaging-bin.zip
```
```bash 3. Install Arthas
unzip arthas-packaging-bin.zip
```
### Install It is recommended to completely remove all old versions of Arthas before installation.
```bash ```bash
sudo su admin sudo su admin
rm -rf /home/admin/.arthas/lib/* # remove all the leftover of the old outdated Arthas rm -rf /home/admin/.arthas/lib/* # remove all the leftover of the old outdated Arthas
cd arthas cd arthas
./install-local.sh # switch the user based on the owner of the target Java process. ./install-local.sh # switch the user based on the owner of the target Java process.
``` ```
### Start 4. Start Arthas
```bash Make sure `shutdown` the old Arthas server before start.
./as.sh # make sure the old Arthas has been shutdown (using command shutdown);
``` ```bash
./as.sh
```

@ -1,22 +1,23 @@
monitor monitor
======= =======
Monitor methods calling stack traces. > Monitor method invocation.
F.Y.I Monitor invocation for the method matched with `class-pattern` and `method-pattern`.
1. `monitor` is a persistent command, it never returns until you press `Ctrl+C` to manually stop it; `monitor` is not a command returning immediately.
2. the server runs the jobs in the background;
3. injected monitoring code will become invalid automatically once the monitoring jobs being terminated;
4. in theory, Arthas will not change any original behaviors but if it does, please do not hesitate to start an [issue](https://github.com/alibaba/arthas/issues).
### Properties monitored A command returning immediately is a command immediately returns with the result after the command is input, while a non-immediate returning command will keep outputting the information from the target JVM process until user presses `Ctrl+C`.
|Property|Specification| On Arthas's server side, the command is running as a background job, but the weaved code will not take further effect once the job is terminated, therefore, it will not impact the performance after the job quits. Furthermore, Arthas is designed to have no side effect to the business logic.
### Items to monitor
|Item|Specification|
|---:|:---| |---:|:---|
|timestamp|timestamp| |timestamp|timestamp|
|class|Java class| |class|Java class|
|method|constructor and regular methods| |method|method (constructor and regular methods)|
|total|calling times| |total|calling times|
|success|success count| |success|success count|
|fail|failure count| |fail|failure count|
@ -25,12 +26,14 @@ F.Y.I
### Parameters ### Parameters
Parameter `[c:]` stands for cycles of statistics. Its value is an integer value in seconds.
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|*class-pattern*|pattern for the class name| |*class-pattern*|pattern for the class name|
|*method-pattern*|pattern for the method name| |*method-pattern*|pattern for the method name|
|[E]|turn on regex matching while the default is wildcard matching| |`[E]`|turn on regex matching while the default is wildcard matching|
|[c:]|cycle of output with default value: `60 s`| |`[c:]`|cycle of statistics, the default value: `120`s|
### Usage ### Usage

@ -1,22 +1,22 @@
options options
=== ===
### Global options > Global options
|Name| Default Value | Description | |Name| Default Value | Description |
| ------------------------- | ----- | ---------------------------------------- | | ------------------------- | ----- | ---------------------------------------- |
| unsafe | false | Enable system-level class enhancement; JVM might crash, if you turn it on (use with great caution :exclamation:) | | unsafe | false | whether to enhance to system-level class. Use it with caution since JVM may hang|
| dump | false | Enable support for dumping enhanced class to external files; if turned on, class file will be dumped to`/${application dir}/arthas-class-dump/`please check console output for specific location | | dump | false | whether to dump enhanced class to the external files. If it's on, enhanced class will be dumped into `/${application dir}/arthas-class-dump/`, the specific output path will be output in the console |
| batch-re-transform | true | re-transform matched classes in batch | | batch-re-transform | true | whether to re-transform matched classes in batch|
| json-format | false | Enable output in JSON format | | json-format | false | whether to output in JSON format|
| disable-sub-class | false | Disabling child class matching: by default child class will be matched while matching target class; if you wish exact matching, you should turn it off | | disable-sub-class | false | whether to enable matching child classes. The default value is `true`. If exact match is desire, turn off this flag|
| debug-for-asm | false | Print ASM-related debug message | | debug-for-asm | false | whether to enable ASM debugging log|
| save-result | false | Enable saving logs for task results: when true, all command results will be saved to `/home/admin/logs/arthas/arthas.log` | | save-result | false | whether to save execution result. All execution results will be saved to `/home/admin/logs/arthas/arthas.log` when it's turned on|
| job-timeout | 1d | Default timeout for background jobs: jobs will be stopped once timed out (i.e. 1d, 2h, 3m, 25s)| | job-timeout | 1d | default timeout for background jobs. Background job will be terminated once it's timed out (i.e. 1d, 2h, 3m, 25s)|
### Usage ### Usage
Saving logs for command outputs, you can: For example, to enable saving command execution result, input the command below:
``` ```
$ options save-result true $ options save-result true

@ -1,7 +1,7 @@
Quick Start Quick Start
=========== ===========
## 1. Start A Demo ## 1. Start Demo Application
Save the following code to a `Demo.java` and run the commands in shell as Save the following code to a `Demo.java` and run the commands in shell as
@ -39,68 +39,67 @@ public class Demo {
} }
``` ```
## 2. Start Arthas Save the contents above into `Demo.java`, then compile it under the command line:
### Linux/Unix/Mac
```bash ```bash
./as.sh javac Demo.java
java Demo
``` ```
You can also save and start the code in IDE.
1. the user to run the *command* should have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user `admin`: ## 2. Start Arthas
```bash ### Linux/Unix/Mac
sudo su admin && ./as.sh
# Or
sudo -u admin -EH ./as.sh
```
2. For more details of the booting script, please refer to [Start Arthas](start-arthas.md). Execute the following command in the command line:
3. If you cannot *attach* the target process, please check the logs under `~/logs/arthas` for troubleshooting.
4. Selecting the target process as: ```bash
./as.sh
```
``` > The user to run this script *MUST* have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user `admin`: `sudo su admin && ./as.sh` or `sudo -u admin -EH ./as.sh`. For more details on the bootstrap script, please refer to [Start Arthas](start-arthas.md). If you cannot be able to attach to the target process, please check the logs under `~/logs/arthas` for troubleshooting.
$ ./as.sh
Arthas script version: 3.0.2
Found existing java process, please choose one and hit RETURN.
* [1]: 95428
[2]: 22647 org.jetbrains.jps.cmdline.Launcher
[3]: 21736
[4]: 13560 Demo
```
We select `4` to check our Demo process and we then have Select the target Java process to attach:
``` ```bash
Connecting to arthas server... current timestamp is 1536656867 $ ./as.sh
Trying 127.0.0.1... Arthas script version: 3.0.2
Connected to 127.0.0.1. Found existing java process, please choose one and hit RETURN.
Escape character is '^]'. * [1]: 95428
,---. ,------. ,--------.,--. ,--. ,---. ,---. [2]: 22647 org.jetbrains.jps.cmdline.Launcher
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-' [3]: 21736
| .-. || '--'.' | | | .--. || .-. |`. `-. [4]: 13560 Demo
| | | || |\ \ | | | | | || | | |.-' | ```
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
The 'Demo' process is the fourth as shown above, press '4' then 'Enter'. Arthas will attach to the target process, and start to output:
wiki: https://alibaba.github.io/arthas ```bash
version: 3.0.1-RC-SNAPSHOT Connecting to arthas server... current timestamp is 1536656867
pid: 13560 Trying 127.0.0.1...
timestamp: 1536656867894 Connected to 127.0.0.1.
Escape character is '^]'.
$ ,---. ,------. ,--------.,--. ,--. ,---. ,---.
``` / O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki: https://alibaba.github.io/arthas
version: 3.0.1-RC-SNAPSHOT
pid: 13560
timestamp: 1536656867894
```
### Windows ### Windows
Open the *DOS* console, under the unzipped arthas folder execute `as.bat <pid>` Open 'Command' window, execute `as.bat <pid>` from where the Arthas package file is unzipped.
## 3. Check the Dashboard ## 3. Check the Dashboard
Type in [dashboard](dashboard.md) and hit the *ENTER*, you will see it as (`Ctrl+C` to stop) Type '[dashboard](dashboard.md)' and hit 'ENTER', a brief report on the current process will be shown as below, pls. `Ctrl+C` to stop:
``` ```
$ dashboard $ dashboard
@ -138,7 +137,7 @@ java.home /Library/Java/JavaVir
## 4. watch ## 4. watch
Input [watch](watch.md) to check the returned value of `Counter.value()`: Use '[watch](watch.md)' to check the returned value of `Counter.value()`:
``` ```
$ watch Demo$Counter value returnObj $ watch Demo$Counter value returnObj
@ -151,9 +150,10 @@ ts=2018-09-10 17:53:14;result=@Integer[624]
ts=2018-09-10 17:53:15;result=@Integer[625] ts=2018-09-10 17:53:15;result=@Integer[625]
``` ```
[more advanced usages](advanced-use.md) Pls. refer to [advanced usages](advanced-use.md) for more information.
## 5. Exit Arthas ## 5. Exit Arthas
- `quit` or `exit` will just disconnect the current console connection while Arthas still running in the target process Use `quit` or `exit` to disconnect from the current process. The Arthas instance attached to the target process continues to live inside the process, and its port is standby for further connection.
- `shutdown` will terminate the Arthas completely
Use `shutdown` to have Arthas completely quit from the target process.

@ -1,21 +1,18 @@
redefine redefine
======== ========
Load the external `*.class` files to **re-define** the JVM-loaded classes. > Load the external `*.class` files to re-define the loaded peer class in JVM.
Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-) Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-)
F.Y.I > Notes: Re-defined classes cannot be restored. There are chances that redefining may fail due to some reasons, for example: there's new field introduced in the new version of the class, pls. refer to JDK's documentation for the limitations.
1. Re-defined classes cannot be restores any more;
2. Re-definition can fail (like adding a new field/method); for more information, please refer to JDK documentation
### Options ### Options
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|[c:]|hashcode of the class loader| |`[c:]`|hashcode of the class loader|
|[p:]|absolute path of the external `*.class` (multiple paths supported)| |`[p:]`|absolute path of the external `*.class`, multiple paths are separated with 'space'|
### Usage ### Usage

@ -1,7 +1,7 @@
reset reset
=== ===
> Reset all classes that have been enhanced by Arthas, and all enhanced classes will be reset when Arthas server `shutdown`. > Reset all classes that have been enhanced by Arthas. These enhanced classes will also be reset when Arthas server is `shutdown`.
### Usage ### Usage
@ -51,4 +51,4 @@ Affect(class-cnt:1 , method-cnt:1) cost in 15 ms.
$ reset $ reset
Affect(class-cnt:1 , method-cnt:0) cost in 9 ms. Affect(class-cnt:1 , method-cnt:0) cost in 9 ms.
``` ```

@ -1,27 +1,25 @@
Log command outputs Log command outputs
=================== ===================
Log command outputs for later analysis, turned off by default. > Log command outputs for later analysis
To turn it on, using [options](options.md) as: * By default, this behavior is turned off. To enable it, execute the command below:
```bash ```bash
$ options save-result true $ options save-result true
NAME BEFORE-VALUE AFTER-VALUE NAME BEFORE-VALUE AFTER-VALUE
---------------------------------------- ----------------------------------------
save-result false true save-result false true
Affect(row-cnt:1) cost in 3 ms. Affect(row-cnt:1) cost in 3 ms.
``` ```
F.Y.I
1. logging file lies in: `{user.home}/logs/arthas-cache/result.log`; If the message above is output on the console, then this behavior is enabled successfully.
2. remember to clean up the file to save disk space.
* Log file path
### Asynchronous log The command execution result will be save in `{user.home}/logs/arthas-cache/result.log`. Pls. clean it up regularly to save disk space.
:notes: :notes: ### Use asynchronous job to log
With the latest Arthas, you can log the outputs asynchronously in the background:
```bash ```bash
$ trace Test t >> & $ trace Test t >> &
@ -29,9 +27,8 @@ job id : 2
cache location : /Users/zhuyong/logs/arthas-cache/28198/2 cache location : /Users/zhuyong/logs/arthas-cache/28198/2
``` ```
F.Y.I By doing this, the command will run at background asynchronously, and output the execution result into `~/logs/arthas-cache/{PID}/{JobId}`:
1. `quit/exit` or `Ctrl+C` will not affect the asynchronous jobs :sparkles:; * The background job will continue to run even if the current session is disconnected. The default job timeout value is 1 day, use global '[options](options.md)' command to alternate it.
2. default timeout for the background job is 1 day (you can set it via [options](options.md)); * The execution result will be output into the file asynchronously. Pls. note the behavior of this command is not controlled by `save-result` option from global [options](options.md). No matter `save-result` is set to `true` or not, this command will write into `~/logs/arthas-cache/{PID}/{JobId}` anyway, instead of into `~/logs/arthas-cache/result.log`.
3. outputs will be save to the `cache location` now (no matter what `save-result` is - not `~/logs/arthas-cache/result.log` any more).

@ -1,31 +1,27 @@
sc sc
== ==
Check the profiles of the loaded classes. > Search classes loaded by JVM.
Abbreviated from *Search-Class*; with the help of this command, you can search out all the loaded classes in JVM. Supported options are: `[d]`、`[E]`、`[f]` and `[x:]`. `sc` stands for search class. This command can search all possible classes loaded by JVM and show their information. The supported options are: `[d]`、`[E]`、`[f]` and `[x:]`.
Options ### Supported Options
-------
### Specification
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|*class-pattern*|pattern for the class name| |*class-pattern*|pattern for the class name|
|*method-pattern*|pattern for the method name| |*method-pattern*|pattern for the method name|
|[d]|print the details of the current class including the source file, class declaration, the class loaders and the like.<br/>F.Y.I if a class is loaded by several class loaders, then the class will be printed several times| |`[d]`|print the details of the current class, including its code source, class specification, its class loader and so on.<br/>If a class is loaded by more than one class loader, then the class details will be printed several times|
|[E]|turn on regx matching while the default is wildcards matching| |`[E]`|turn on regex match, the default behavior is wildcards match|
|[f]|print the fields info of the current class, which ***must*** be used with `-d`| |`[f]`|print the fields info of the current class, MUST be used with `-d` together|
|[x:]|the depth to print the static fields, whose default is `0` - directly invoke the `toString()`| |`[x:]`|specify the depth of recursive traverse the static fields, the default value is '0' - equivalent to use `toString` to output|
Tip: > *class-patten* supports full qualified class name, e.g. com.taobao.test.AAA and com/taobao/test/AAA. It also supports the format of 'com/taobao/test/AAA', so that it is convenient to directly copy class name from the exception stack trace without replacing '/' to '.'. <br/><br/>
1. *class-patten* supports full qualified class name (e.g. com.taobao.test.AAA and com/taobao/test/AAA) > `sc` turns on matching sub-class match by default, that is, `sc` will also search the sub classes of the target class too. If exact-match is desired, pls. use `options disable-sub-class true`.
2. `sc` turned on the `sub-class` matching in default mode; if you do want to hide `sub-class`, you can just turn it off with [options](options.md) as `options disable-sub-class true`.
### Usage ### Usage
Check the static fields of a class using `sc -df class-name` For example, use `sc -df class-name` to view class's static fields:
```shell ```shell
$ sc -df org.apache.commons.lang.StringUtils $ sc -df org.apache.commons.lang.StringUtils

@ -1,12 +1,10 @@
sm sm
== ==
Check the method profile of the loaded classes; > Search method from the loaded classes.
Abbreviated from *Search-Method*, with which you can check all methods profiles of the loaded classes. `sm` stands for search method. This command can search and show method information from all loaded classes. `sm` can only view the methods declared on the target class, that is, methods from its parent classes are invisible.
F.Y.I
`sm` only shows the methods declared in the current class; methods declared in ancestors will not be presented.
### Options ### Options
@ -14,12 +12,14 @@ F.Y.I
|---:|:---| |---:|:---|
|*class-pattern*|pattern for class name| |*class-pattern*|pattern for class name|
|*method-pattern*|pattern for method name| |*method-pattern*|pattern for method name|
|[d]|print the details of the method| |`[d]`|print the details of the method|
|[E]|turn on regex matching while the default mode is wildcard matching| |`[E]`|turn on regex matching while the default mode is wildcard matching|
### Usage ### Usage
``` Show methods from `org.apache.catalina.connector.Connector`:
```bash
$ sm org.apache.catalina.connector.Connector $ sm org.apache.catalina.connector.Connector
org.apache.catalina.connector.Connector-><init> org.apache.catalina.connector.Connector-><init>
org.apache.catalina.connector.Connector->setProperty org.apache.catalina.connector.Connector->setProperty
@ -61,6 +61,8 @@ org.apache.catalina.connector.Connector->getMaxCookieCount
``` ```
Show methods' details from `org.apache.catalina.connector.Connector`:
```bash ```bash
$ sm org.apache.catalina.connector.Connector -d $ sm org.apache.catalina.connector.Connector -d
declaring-class org.apache.catalina.connector.Connector declaring-class org.apache.catalina.connector.Connector

@ -1,9 +1,9 @@
stack stack
===== =====
Print out the full call stack trace *till* the current method. > Print out the full call stack of the current method.
Most of the time, we know the method being invoked but not always we know **HOW being invoked**; `stack` can be a great help to locate the *source* for you. Most often we know one method gets called, but we have no idea on which code path gets executed or when the method gets called since there are so many code paths to the target method. The command `stack` comes to rescue in this difficult situation.
### Parameters ### Parameters
@ -12,29 +12,24 @@ Most of the time, we know the method being invoked but not always we know **HOW
|*class-pattern*|pattern for the class name| |*class-pattern*|pattern for the class name|
|*method-pattern*|pattern for the method name| |*method-pattern*|pattern for the method name|
|*condition-expression*|condition expression| |*condition-expression*|condition expression|
|[E]|turn on regex matching while the default is wildcard matching| |`[E]`|turn on regex match, the default behavior is wildcard match|
|[n:]|calling times| |`[n:]`|execution times|
F.Y.I There's one thing worthy noting here is observation expression. The observation expression supports OGNL grammar, for example, you can come up a expression like this `"{params,returnObj}"`. All OGNL expressions are supported as long as they are legal to the grammar.
1. any valid OGNL expression as `"{params,returnObj}"` supported;
2. filter by time cost as `trace *StringUtils isBlank '#cost>100'`; calling stack with only time cost higher than `100ms` will be printed.
Attention: Thanks for `advice`'s data structure, it is possible to observe from varieties of different angles. Inside `advice` parameter, all necessary information for notification can be found.
1. `#cost` can be used in `watch/stack/trace`;
2. using `#cost` in Arthas 3.0 instead of `$cost`.
Advanced:
* [Critical fields in expression](advice-class.md)
* [Special usage](https://github.com/alibaba/arthas/issues/71)
* [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html)
Pls. refer to [core parameters in expression](advice-class.md) for more details.
* Pls. also refer to [https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71) for more advanced usage
* OGNL official site: [https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)
### Usage ### Usage
The quoting rules: if there are quotes within the expression, use another type of quotes to quote the whole expression (single `''` or double `""` quotes). > Notes: if there's quotes character (say, `'`) in the expression, then the whole expression must be wrapped by quotes but with the other type (in this case, `"`) too. On contrary, it's no need to quote the expression itself if there's no quotes character found in it, but it is strongly recommended.
``` Print out calling stack when the first method parameter is "K9-BD-01" for 'getProductById()' method:
```bash
$ stack com.alibaba.sample.petstore.dal.dao.ProductDao getProductById 'params[0]=="K9-BD-01"' $ stack com.alibaba.sample.petstore.dal.dao.ProductDao getProductById 'params[0]=="K9-BD-01"'
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 51 ms. Affect(class-cnt:1 , method-cnt:1) cost in 51 ms.
@ -71,9 +66,9 @@ thread_name="http-bio-8080-exec-2" thread_id=0x48;is_daemon=true;priority=5;
... ...
``` ```
Filtering by time cost: Print out the calling stack when method 'execute()' takes more than 30ms to finish:
``` ```bash
$ stack com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost>30 $ stack com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost>30
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 123 ms. Affect(class-cnt:1 , method-cnt:1) cost in 123 ms.

@ -30,19 +30,15 @@ Startup script is as follows:
./as.sh <PID>[@IP:PORT] ./as.sh <PID>[@IP:PORT]
``` ```
### Parameter Description ### Parameter Description
* PID: Target Java process ID(Make sure that the user executing the command has sufficient permissions to operate the target Java process.) * *PID*: Target Java process ID (Make sure that the user executing the command has sufficient permissions to operate the target Java process.)
* *IP*: The address that Arthas Server listens on, the default value is `127.0.0.1`. Arthas allows multiple users to access simultaneously without interfering with each other.
* IP: The address that Arthas Server listens on, the default value is `127.0.0.1`. Arthas allows multiple users to access simultaneously without interfering with each other. * *PORT*: Arthas Server portthe default value is 3658
* PORT: Arthas Server portthe default value is 3658
### Sample ### Sample
* If you do not specify IP and PORT, the default is 127.0.0.1 and 3658 * If IP and PORT are not specified, then the default values are 127.0.0.1 and 3658
> ./as.sh 12345 > ./as.sh 12345
@ -52,7 +48,7 @@ Startup script is as follows:
### Remote Diagnosis ### Remote Diagnosis
After starting Arthas Server, users can use `telnet` connect to the remote Arthas Server, for example After starting Arthas Server on the target Java process, users can use `telnet` connect to the remote Arthas Server, for example
```bash ```bash
telnet 192.168.1.119 3658 telnet 192.168.1.119 3658
@ -60,7 +56,7 @@ telnet 192.168.1.119 3658
### sudo Support ### sudo Support
If you need to switch users, such as `admin`, you need to add the -H parameter. Usually online environment will only grant users privilege as low as possible, instead, all advanced operations are through sudo-list. Since `as.sh` script takes into account the current effective user, it is possible to run the script in the other rule, by specifying `-H` option like this:
```bash ```bash
sudo -u admin -H ./as.sh 12345 sudo -u admin -H ./as.sh 12345
@ -69,8 +65,8 @@ sudo -u admin -H ./as.sh 12345
### Windows Support ### Windows Support
`as.bat` script only supports one parameter: pid Right now `as.bat` script supports one parameter only, which is: pid
```bash ```bash
as.bat <pid> as.bat <pid>
``` ```

@ -1,7 +1,7 @@
sysprop sysprop
======= =======
Check the JVM system properties. > Examine the system properties from the target JVM
### Usage ### Usage
@ -102,16 +102,16 @@ $ sysprop
sun.cpu.isalist sun.cpu.isalist
``` ```
#### Check a single property #### Check One Single Property
Tip: `tab` auto-completion supported > Use `tab` for auto-completion
``` ```bash
$ sysprop java.version $ sysprop java.version
java.version=1.8.0_51 java.version=1.8.0_51
``` ```
#### Modify a single property #### Modify Single Property
``` ```
$ sysprop user.country $ sysprop user.country

@ -1,31 +1,25 @@
thread thread
====== ======
Check the basic profile and stack trace of the threads. > Check the basic info and stack trace of the target thread.
### Parameters ### Parameters
|Name|Specification| |Name|Specification|
|---:|:---| |---:|:---|
|*id*|thread id in JVM| |*id*|thread id in JVM|
|[n:]|the top n busiest with stack traces| |`[n:]`|the top n busiest threads with stack traces printed|
|[b]|locate the threads blocking others| |`[b]`|locate the thread blocking the others|
|[i `<value>`]|specify the interval to collect data to compute CPU ratios (ms)| |[i `<value>`]|specify the interval to collect data to compute CPU ratios (ms)|
How to get the CPU ratios? > How the CPU ratios are calculated? <br/><br/>
> CPU ratio for a given thread is the CPU time it takes divided by the total CPU time within a specified interval period. It is calculated in the following way: sample CPU times for all the thread by calling `java.lang.management.ThreadMXBean#getThreadCpuTime` first, then sleep for a period (the default value is 100ms, which can be specified by `-i`), then sample CPU times again. By this, we can get the time cost for this period for each thread, then come up with the ratio. <br/><br/>
> Within an *specified* interval, the time cost by the thread compared to the total CPU time. > Note: this operation consumes CPU time too (`getThreadCpuTime` is time-consuming), therefore it is possible to observe Arthas's thread appears in the list. To avoid this, try to increase sample interval, for example: 5000 ms.<br/><br/>
> Take a sample (using `java.lang.management.ThreadMXBean#getThreadCpuTime`) to get the CPU time cost for all the threads and after a *specified* interval (default *100 ms*, which can be specified by `-i`), take another sample and we have the CPU time cost and the ratios naturally. > If you'd like to check the CPU ratios from the very beginning of the Java process, [show-busy-java-threads](https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads) can come to help.
> Attention: this kind of operation will take time, to decrease the extra cost, you'd better expand the interval to like `5000 ms` for less performance overhead.
F.Y.I
If you'd like to check the CPU ratios from the very start of the Java process, [show-busy-java-threads](https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads) can be a help.
### Usage ### Usage
#### List the top n busiest with detailed stack trace #### List the top n busiest threads with detailed stack trace
```shell ```shell
$ thread -n 3 $ thread -n 3
@ -58,7 +52,7 @@ $ thread -n 3
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
``` ```
#### List all info when no options provided #### List all threads' info when no options provided
```shell ```shell
$ thread $ thread
@ -82,7 +76,7 @@ ID NAME GROUP PRIORITY STA
21 Thread-8 main 5 RUNNABLE 0 0:0 false true 21 Thread-8 main 5 RUNNABLE 0 0:0 false true
``` ```
#### thread <thread_id> present the specified thread profile #### thread id, show the running stack for the target thread
```shell ```shell
$ thread 1 $ thread 1
@ -96,9 +90,9 @@ $ thread 1
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231) at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
``` ```
#### thread -b locate the blocking threads #### thread -b, locate the thread bocking the others
Using `-b`, we can effectively locate the threads holding locks blocking other threads resulting in a frozen system. In some occasions, we experience the whole application is stuck because there's one particular thread hold one lock that other threads are relying on. To diagnose such an issue, Arthas provides `thread -b` to find the problematic thread in one single command.
```bash ```bash
$ thread -b $ thread -b
@ -139,10 +133,10 @@ $ thread -b
- java.util.concurrent.ThreadPoolExecutor$Worker@31a6493e - java.util.concurrent.ThreadPoolExecutor$Worker@31a6493e
``` ```
Attention: only `synchronized` blocked threads can be located for now, while `java.util.concurrent.Lock` not supported yet. > Note: By now Arthas only supports to locate the thread blocked by `synchronzied`, while `java.util.concurrent.Lock` is not supported yet.
#### thread -i specify the collecting interval #### thread -i, specify the sampling interval
```bash ```bash
$ thread -n 3 -i 1000 $ thread -n 3 -i 1000

@ -1,7 +1,9 @@
trace trace
===== =====
Track methods calling stack trace and print the time cost in each call. > Trace method calling path, and output the time cost for each node in the path.
`trace` can track the calling path specified by `class-pattern` / `method-pattern`, and calculate the time cost on the whole path.
### Parameters ### Parameters
@ -10,27 +12,31 @@ Track methods calling stack trace and print the time cost in each call.
|*class-pattern*|pattern for the class name| |*class-pattern*|pattern for the class name|
|*method-pattern*|pattern for the method name| |*method-pattern*|pattern for the method name|
|*condition-express*|condition expression| |*condition-express*|condition expression|
|[E]|turn on regx matching while the default is wildcards matching| |`[E]`|enable regex match, the default behavior is wildcards match|
|[n:]|calling times| |`[n:]`|execution times|
|#cost|time cost| |#cost|time cost|
F.Y.I There's one thing worthy noting here is observation expression. The observation expression supports OGNL grammar, for example, you can come up a expression like this `"{params,returnObj}"`. All OGNL expressions are supported as long as they are legal to the grammar.
1. any valid OGNL expression as `"{params,returnObj}"` supported;
2. filter by time cost as `trace *StringUtils isBlank '#cost>100'`; calling stack with only time cost higher than `100ms` will be printed. Thanks for `advice`'s data structure, it is possible to observe from varieties of different angles. Inside `advice` parameter, all necessary information for notification can be found.
Pls. refer to [core parameters in expression](advice-class.md) for more details.
* Pls. also refer to [https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71) for more advanced usage
* OGNL official site: [https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)
Many times what we are interested is the exact trace result when the method call takes time over one particular period. It is possible to achieve this in Arthas, for example: `trace *StringUtils isBlank '$cost>100'` means trace result will only be output when the executing time exceeds 100ms.
> Notes:
> 1. `watch`/`stack`/`trace`, these three commands all support `$cost`.
> 2. On version `3.0`, pls. use `#cost` instead of `$cost`.
Attention: ### Notice
1. `#cost` can be used in `watch/stack/trace`;
2. using `#cost` in Arthas 3.0 instead of `$cost`.
3. `trace` can help to locate the performance lurking issue but only `level-one` method invoking considered.
Advanced: `trace` is handy to help discovering and locating the performance flaws in your system, but pls. note Arthas can only trace the first level method call each time.
* [Critical fields in expression](advice-class.md)
* [Special usage](https://github.com/alibaba/arthas/issues/71)
* [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html)
### Usage ### Usage
A demo: Sample code:
```java ```java
public static void main(String[] args) { public static void main(String[] args) {
@ -67,7 +73,7 @@ A demo:
} }
``` ```
Tracing down method `add`: Trace down method `add`:
```shell ```shell
$ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList add params.length==2 $ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList add params.length==2
@ -81,7 +87,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 144 ms.
`---[0ms]java.util.List:size() `---[0ms]java.util.List:size()
``` ```
Filtering by time cost: Filter by time cost:
```shell ```shell
$ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost>4 $ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost>4
@ -97,11 +103,10 @@ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost
`---[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] com.alibaba.citrus.turbine.Context:put() `---[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] com.alibaba.citrus.turbine.Context:put()
``` ```
Only the calling trace of the time cost higher than `4ms` presented now. > Only the call path which's time cost is higher than `4ms` will be shown. This feature is handy to focus on what's needed to focus when troubleshoot.
F.Y.I * Here Arthas provides the similar functionality JProfile and other commercial software provide. Compared to these professional softwares, Arthas doesn't deduce the time cost `trace` itself takes, therefore it is not as accurate as these softwares offer. More classes and methods on the calling path, more inaccurate `trace` output is, but it is still helpful for diagnostics where the bottleneck is.
1. like JProfile and other similar commercial software, you can `trace` down the specified method calling stack with time cost in Arthas; * "[2.847106ms] com.alibaba.sample.petstore.biz.StoreManager:getAllProductItems()" means "getAllProductItem()" method from "com.alibaba.sample.petstore.biz.StoreManager" takes `2.847106` ms.
2. there will be some overhead using `trace` but not much; * "[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] com.alibaba.citrus.turbine.Context:put()" means aggregating all same method calls into one single line. The minimum time cost is `0.005428` ms, the maximum time cost is `0.094064` ms, and the total time cost for all method calls (`3` times in total) to "com.alibaba.citrus.turbine.Context:put()" is `0.105228ms`. If "throws Exception" appears in this line, it means some exceptions have been thrown from this method calls.
3. the time cost is an instructive clue for troubleshooting, which means it's not that accurate ignoring the cost it itself causes; the deeper or more the call is, the worse accuracy the time cost will be; * The total time cost may not equal to the sum of the time costs each sub method call takes, this is because Arthas instrumented code takes time too.
4. `[0,0,0ms,11]xxx:yyy() [throws Exception]`the same method calling aggregated into one line here while `throws Exception` indicates there is an exception.

@ -114,10 +114,10 @@
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -119,14 +119,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -120,10 +120,10 @@
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -114,10 +114,10 @@
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -188,37 +188,37 @@
<div class="section" id="batch-processing"> <div class="section" id="batch-processing">
<span id="batch-processing"></span><h1>Batch Processing<a class="headerlink" href="#batch-processing" title="Permalink to this headline"></a></h1> <span id="batch-processing"></span><h1>Batch Processing<a class="headerlink" href="#batch-processing" title="Permalink to this headline"></a></h1>
<p>With the help of <code class="docutils literal notranslate"><span class="pre">Batch</span> <span class="pre">Processing</span></code>, you can run several commands in one line and get the results.</p> <p>With the help of Batch Processing, you can run multiple commands in batch and get the final result at the end.</p>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="section" id="step-1-create-the-script"> <div class="section" id="step-1-create-the-script">
<span id="step-1-create-the-script"></span><h3>Step-1: Create the script<a class="headerlink" href="#step-1-create-the-script" title="Permalink to this headline"></a></h3> <span id="step-1-create-the-script"></span><h3>Step 1: Create the script<a class="headerlink" href="#step-1-create-the-script" title="Permalink to this headline"></a></h3>
<p>Creating a <code class="docutils literal notranslate"><span class="pre">test.as</span></code> script suffixed with <code class="docutils literal notranslate"><span class="pre">as</span></code> here for consistency (actually any suffix is acceptable).</p> <p>Create a <code class="docutils literal notranslate"><span class="pre">test.as</span></code> script suffixed with <code class="docutils literal notranslate"><span class="pre">as</span></code>. Here <code class="docutils literal notranslate"><span class="pre">as</span></code> is suggested for the suffix of the filename, but in fact any suffix is acceptable.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>➜ arthas git:(develop) cat /var/tmp/test.as <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>➜ arthas git:<span class="o">(</span>develop<span class="o">)</span> cat /var/tmp/test.as
help <span class="nb">help</span>
dashboard -b -n 1 dashboard -b -n <span class="m">1</span>
session session
thread thread
sc -d org.apache.commons.lang.StringUtils sc -d org.apache.commons.lang.StringUtils
</pre></div> </pre></div>
</div> </div>
<p>Attention:</p> <p>Note:</p>
<ul class="simple"> <ul class="simple">
<li>each command takes each independent line;</li> <li>Each command takes one line.</li>
<li><code class="docutils literal notranslate"><span class="pre">dashboard</span></code> command should include <code class="docutils literal notranslate"><span class="pre">-b</span></code> to turn on batch mode and <code class="docutils literal notranslate"><span class="pre">-n</span></code> to ensure the script ends;</li> <li>Batch mode (via <code class="docutils literal notranslate"><span class="pre">-b</span></code>) and execution times (via <code class="docutils literal notranslate"><span class="pre">-n</span></code>) must be explicitly specified for <code class="docutils literal notranslate"><span class="pre">dashboard</span></code>, otherwise batch script cannot terminate.</li>
<li>commands as <code class="docutils literal notranslate"><span class="pre">watch/tt/trace/monitor/stack</span></code> should include <code class="docutils literal notranslate"><span class="pre">-n</span></code> option to ensure the script ends;</li> <li>Commands such as <code class="docutils literal notranslate"><span class="pre">watch</span></code>/<code class="docutils literal notranslate"><span class="pre">tt</span></code>/<code class="docutils literal notranslate"><span class="pre">trace</span></code>/<code class="docutils literal notranslate"><span class="pre">monitor</span></code>/<code class="docutils literal notranslate"><span class="pre">stack</span></code> should include <code class="docutils literal notranslate"><span class="pre">-n</span></code> option to ensure the script can be able to quit.</li>
<li><a class="reference internal" href="async.html"><span class="doc">asynchronous</span></a> can also be used as <code class="docutils literal notranslate"><span class="pre">watch</span> <span class="pre">c.t.X</span> <span class="pre">test</span> <span class="pre">returnObj</span> <span class="pre">&gt;</span> <span class="pre">&amp;</span></code>;</li> <li>Also consider to use <code class="docutils literal notranslate"><span class="pre">async</span></code> (for example: <code class="docutils literal notranslate"><span class="pre">watch</span> <span class="pre">c.t.X</span> <span class="pre">test</span> <span class="pre">returnObj</span> <span class="pre">&gt;</span> <span class="pre">&amp;</span></code>) to put commands run at background and get the output from the log file, see more from <a class="reference internal" href="async.html"><span class="doc">asynchronous job</span></a></li>
</ul> </ul>
</div> </div>
<div class="section" id="step-2-run-the-script"> <div class="section" id="step-2-run-the-script">
<span id="step-2-run-the-script"></span><h3>Step-2: Run the script<a class="headerlink" href="#step-2-run-the-script" title="Permalink to this headline"></a></h3> <span id="step-2-run-the-script"></span><h3>Step 2: Run the script<a class="headerlink" href="#step-2-run-the-script" title="Permalink to this headline"></a></h3>
<p>Using <code class="docutils literal notranslate"><span class="pre">-b</span></code> to turn on script mode, and <code class="docutils literal notranslate"><span class="pre">-f</span></code> to run it and you can also <em>redirect</em> the output as:</p> <p>Use <code class="docutils literal notranslate"><span class="pre">-b</span></code> to turn on batch mode, and use <code class="docutils literal notranslate"><span class="pre">-f</span></code> to specify the script file. By default the result will be output to the standard output, but you can redirect the output to the file like this:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./as.sh -b -f /var/tmp/test.as <span class="m">56328</span> &gt; test.out <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./as.sh -b -f /var/tmp/test.as <span class="m">56328</span> &gt; test.out
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="step-3-check-the-outputs"> <div class="section" id="step-3-check-the-outputs">
<span id="step-3-check-the-outputs"></span><h3>Step-3: Check the outputs<a class="headerlink" href="#step-3-check-the-outputs" title="Permalink to this headline"></a></h3> <span id="step-3-check-the-outputs"></span><h3>Step 3: Check the outputs<a class="headerlink" href="#step-3-check-the-outputs" title="Permalink to this headline"></a></h3>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat test.out <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat test.out
</pre></div> </pre></div>
</div> </div>

@ -114,14 +114,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -192,8 +192,8 @@
<div class="section" id="classloader"> <div class="section" id="classloader">
<span id="classloader"></span><h1>classloader<a class="headerlink" href="#classloader" title="Permalink to this headline"></a></h1> <span id="classloader"></span><h1>classloader<a class="headerlink" href="#classloader" title="Permalink to this headline"></a></h1>
<p>Check the inheritance tree, urls and classes loading profiles of the class loaders.</p> <p>View hierarchy, urls and classes-loading info for the class-loaders.</p>
<p>It can be a great help for <code class="docutils literal notranslate"><span class="pre">ResourceNotFoundException</span></code> when you can use command <code class="docutils literal notranslate"><span class="pre">classloader</span></code> to specify a class loader to <code class="docutils literal notranslate"><span class="pre">getResources</span></code> and print all the urls of the valid resources.</p> <p><code class="docutils literal notranslate"><span class="pre">classloader</span></code> can search and print out the URLs for a specified resource from one particular classloader. It is quite handy when analyze <code class="docutils literal notranslate"><span class="pre">ResourceNotFoundException</span></code>.</p>
<div class="section" id="options"> <div class="section" id="options">
<span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2> <span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -206,11 +206,11 @@
<tbody> <tbody>
<tr> <tr>
<td align="right">[l]</td> <td align="right">[l]</td>
<td align="left">list all class loader instances based on thread count</td> <td align="left">list all class loader instances</td>
</tr> </tr>
<tr> <tr>
<td align="right">[t]</td> <td align="right">[t]</td>
<td align="left">print the inheritance structure of the class loaders</td> <td align="left">print classloader's hierarchy</td>
</tr> </tr>
<tr> <tr>
<td align="right">[a]</td> <td align="right">[a]</td>
@ -218,7 +218,7 @@
</tr> </tr>
<tr> <tr>
<td align="right">[c:]</td> <td align="right">[c:]</td>
<td align="left">get the hashcode of the class loader</td> <td align="left">print classloader's hashcode</td>
</tr> </tr>
<tr> <tr>
<td align="right">[c: r:]</td> <td align="right">[c: r:]</td>
@ -229,7 +229,7 @@
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>Categorised by class loader</li> <li>View statistics categorized by class type</li>
</ul> </ul>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ classloader <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ classloader
name numberOfInstances loadedCountTotal name numberOfInstances loadedCountTotal
@ -248,7 +248,7 @@ Affect<span class="o">(</span>row-cnt:11<span class="o">)</span> cost in <span c
</pre></div> </pre></div>
</div> </div>
<ul class="simple"> <ul class="simple">
<li>Categorized by class loader instance</li> <li>View statistics categorized by loaded classes number</li>
</ul> </ul>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ classloader -l <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ classloader -l
name loadedCount hash parent name loadedCount hash parent
@ -298,7 +298,7 @@ Affect<span class="o">(</span>row-cnt:11<span class="o">)</span> cost in <span c
</pre></div> </pre></div>
</div> </div>
<ul class="simple"> <ul class="simple">
<li>Check inheritance tree of the class loaders</li> <li>View class-loaders hierarchy</li>
</ul> </ul>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -t <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -t
+-BootstrapClassLoader +-BootstrapClassLoader
@ -312,7 +312,7 @@ Affect<span class="o">(</span>row-cnt:11<span class="o">)</span> cost in <span c
</pre></div> </pre></div>
</div> </div>
<ul class="simple"> <ul class="simple">
<li>Check URL of the class loader</li> <li>Show the URLs from which to load classes and resources for one particular URLClassLoader</li>
</ul> </ul>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -c 5ffe9775 <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -c 5ffe9775
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/commons-lang-2.6.jar file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/commons-lang-2.6.jar
@ -325,7 +325,7 @@ file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/picocontai
</pre></div> </pre></div>
</div> </div>
<ul class="simple"> <ul class="simple">
<li>Using class loader to search for resource</li> <li>Use one class loader to search one particular resource</li>
</ul> </ul>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -c 226b143b -r META-INF/MANIFEST.MF <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -c 226b143b -r META-INF/MANIFEST.MF
jar:file:/Users/hello/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar!/META-INF/MANIFEST.MF jar:file:/Users/hello/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar!/META-INF/MANIFEST.MF
@ -333,7 +333,7 @@ file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/picocontai
</pre></div> </pre></div>
</div> </div>
<ul class="simple"> <ul class="simple">
<li>Using class loader to look for <code class="docutils literal notranslate"><span class="pre">*.class</span></code> file</li> <li>Use one class loader to search one particular class</li>
</ul> </ul>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -c 1b6d3586 -r java/lang/String.class <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ classloader -c 1b6d3586 -r java/lang/String.class
jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class

@ -110,14 +110,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -207,17 +207,17 @@
<li class="toctree-l1"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l1"><a class="reference internal" href="options.html">options</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="basic-commands"> <div class="section" id="basic-arthas-commands">
<span id="basic-commands"></span><h2>Basic Commands<a class="headerlink" href="#basic-commands" title="Permalink to this headline"></a></h2> <span id="basic-arthas-commands"></span><h2>Basic Arthas Commands<a class="headerlink" href="#basic-arthas-commands" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>help - check the assistant info for the command</li> <li>help - examine help information</li>
<li>cls - clear out the current screen area</li> <li>cls - clear out the screen</li>
<li>session - check the current session profile</li> <li>session - examine the current session</li>
<li><a class="reference internal" href="reset.html"><span class="doc">reset</span></a> - clear the injected code from the classes (B.T.W when Arthas server closed, all the injected will also be cleared)</li> <li><a class="reference internal" href="reset.html"><span class="doc">reset</span></a> - reset enhanced classes. All enhanced classes will be reset to their original states. When Arthas server closes, all these enhanced classes will be reset too</li>
<li>version - the version of the working Arthas</li> <li>version - print out Arthass version</li>
<li>quit - exit the current Arthas client without affecting other clients</li> <li>quit - exit the current Arthas client without affecting other clients</li>
<li>shutdown - terminate the Arthas server and all clients</li> <li>shutdown - terminate the Arthas server, all the Arthas clients connecting to this server will be disconnected</li>
<li><a class="reference internal" href="keymap.html"><span class="doc">keymap</span></a> - shortcuts for Arthas and also you can define your own</li> <li><a class="reference internal" href="keymap.html"><span class="doc">keymap</span></a> - list all Arthas keyboard shortcuts and shortcut customizations.</li>
</ul> </ul>
</div> </div>
</div> </div>

@ -94,9 +94,9 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="commands.html">Commands</a><ul class="current"> <li class="toctree-l1 current"><a class="reference internal" href="commands.html">Commands</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">dashboard</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">dashboard</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#a-demo">A Demo</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l3"><a class="reference internal" href="#specification">Specification</a></li> <li class="toctree-l3"><a class="reference internal" href="#notes-on-column-headers">Notes on column headers</a></li>
<li class="toctree-l3"><a class="reference internal" href="#screenshots">Screenshots</a></li> <li class="toctree-l3"><a class="reference internal" href="#screenshot">Screenshot</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="thread.html">thread</a></li> <li class="toctree-l2"><a class="reference internal" href="thread.html">thread</a></li>
@ -115,14 +115,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -193,10 +193,11 @@
<div class="section" id="dashboard"> <div class="section" id="dashboard">
<span id="dashboard"></span><h1>dashboard<a class="headerlink" href="#dashboard" title="Permalink to this headline"></a></h1> <span id="dashboard"></span><h1>dashboard<a class="headerlink" href="#dashboard" title="Permalink to this headline"></a></h1>
<p>This is the realtime dashboard for the system; press <code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code> to exit.</p> <blockquote>
<p>When running in <em>Ali-tomcat</em>, the dashboard will present the realtime statistics of the tomcat including <a class="reference external" href="https://en.wikipedia.org/wiki/Queries_per_second">QPS</a>, RT, error counts, thread profile and the like.</p> <div>This is the real time statistics dashboard for the current system, press <code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code> to exit.</div></blockquote>
<div class="section" id="a-demo"> <p>When running in Apache Tomcat Alibaba edition, the dashboard will also present the real time statistics of the tomcat, including <a class="reference external" href="https://en.wikipedia.org/wiki/Queries_per_second">QPS</a>, RT, error counts, and thread pool, etc.</p>
<span id="a-demo"></span><h2>A Demo<a class="headerlink" href="#a-demo" title="Permalink to this headline"></a></h2> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ dashboard <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ dashboard
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON
889 RMI TCP Connection(15)-30.10.166. RMI Runtime 9 RUNNABLE 48 0:5 false true 889 RMI TCP Connection(15)-30.10.166. RMI Runtime 9 RUNNABLE 48 0:5 false true
@ -234,22 +235,22 @@ uptime 16020s busy
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="specification"> <div class="section" id="notes-on-column-headers">
<span id="specification"></span><h2>Specification<a class="headerlink" href="#specification" title="Permalink to this headline"></a></h2> <span id="notes-on-column-headers"></span><h2>Notes on column headers<a class="headerlink" href="#notes-on-column-headers" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>ID: thread ID in JVM (this is different from the nativeID in thread dump)</li> <li>ID: JVM thread ID, pls. note this ID is different from the nativeID in jstack</li>
<li>NAME: thread name</li> <li>NAME: thread name</li>
<li>GROUP: group the thread is in</li> <li>GROUP: thread group name</li>
<li>STATE: the current state of the thread</li> <li>PRIORITY: thread priority, ranged from 1 to 10. The greater number, the higher priority</li>
<li>PRIORITY: within 1 ~ 10 (the higher the number, the higher the priority)</li> <li>STATE: thread state</li>
<li>CPU%: CPU usage ratio within 100ms</li> <li>CPU%: the ratio of CPU usage for the thread, sampled every 100ms</li>
<li>TIME: total running time in minute:second format</li> <li>TIME: total running time in <code class="docutils literal notranslate"><span class="pre">minute:second</span></code> format</li>
<li>INTERRUPTED: the thread interrupted state</li> <li>INTERRUPTED: the thread interruption state</li>
<li>DAEMON: is daemon thread or not</li> <li>DAEMON: daemon thread or not</li>
</ul> </ul>
</div> </div>
<div class="section" id="screenshots"> <div class="section" id="screenshot">
<span id="screenshots"></span><h2>Screenshots<a class="headerlink" href="#screenshots" title="Permalink to this headline"></a></h2> <span id="screenshot"></span><h2>Screenshot<a class="headerlink" href="#screenshot" title="Permalink to this headline"></a></h2>
<p><img alt="alt text" src="_images/dashboard.png" /></p> <p><img alt="alt text" src="_images/dashboard.png" /></p>
</div> </div>
</div> </div>

@ -114,14 +114,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -192,7 +192,8 @@
<div class="section" id="dump"> <div class="section" id="dump">
<span id="dump"></span><h1>dump<a class="headerlink" href="#dump" title="Permalink to this headline"></a></h1> <span id="dump"></span><h1>dump<a class="headerlink" href="#dump" title="Permalink to this headline"></a></h1>
<p>Dump the bytecode the loaded classes to a specified directory.</p> <blockquote>
<div>Dump the bytecode for the particular classes to the specified directory.</div></blockquote>
<div class="section" id="options"> <div class="section" id="options">
<span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2> <span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -205,15 +206,15 @@
<tbody> <tbody>
<tr> <tr>
<td align="right"><em>class-pattern</em></td> <td align="right"><em>class-pattern</em></td>
<td align="left">pattern for the class name</td> <td align="left">class name pattern</td>
</tr> </tr>
<tr> <tr>
<td align="right">[c:]</td> <td align="right"><code>[c:]</code></td>
<td align="left">hashcode of the <a href="classloader.md">class loader</a> that loaded the class</td> <td align="left">hashcode of the <a href="classloader.md">class loader</a> that loaded the target class</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regex matching while the default is wildcard matching</td> <td align="left">turn on regex match, the default behavior is wild card match</td>
</tr> </tr>
</tbody> </tbody>
</table></div> </table></div>

@ -93,10 +93,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -110,14 +110,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -188,21 +188,21 @@
<div class="section" id="getstatic"> <div class="section" id="getstatic">
<span id="getstatic"></span><h1>getstatic<a class="headerlink" href="#getstatic" title="Permalink to this headline"></a></h1> <span id="getstatic"></span><h1>getstatic<a class="headerlink" href="#getstatic" title="Permalink to this headline"></a></h1>
<p>Check the static fields of classes conveniently as <code class="docutils literal notranslate"><span class="pre">getstatic</span> <span class="pre">class_name</span> <span class="pre">field_name</span></code></p> <p>Check the static fields of classes conveniently, the usage is <code class="docutils literal notranslate"><span class="pre">getstatic</span> <span class="pre">class_name</span> <span class="pre">field_name</span></code>.</p>
<p>Tip: if the <em>field</em> is a composite object, you can even use <a class="reference external" href="https://en.wikipedia.org/wiki/OGNL"><code class="docutils literal notranslate"><span class="pre">OGNL</span></code></a> to traverse, filter and access the internal properties of it.</p> <p>Tip: if the static field is a complex class, you can even use <a class="reference external" href="https://en.wikipedia.org/wiki/OGNL"><code class="docutils literal notranslate"><span class="pre">OGNL</span></code></a> to traverse, filter and access the inner properties of this class.</p>
<p>E.g. suppose <code class="docutils literal notranslate"><span class="pre">n</span></code> is a <code class="docutils literal notranslate"><span class="pre">Map</span></code> and the key is a <code class="docutils literal notranslate"><span class="pre">Enum</span></code> then if you want to get the key with a specific <code class="docutils literal notranslate"><span class="pre">Enum</span></code> value - <code class="docutils literal notranslate"><span class="pre">STOP</span></code> or <code class="docutils literal notranslate"><span class="pre">a</span></code>, you can achieve it as:</p> <p>E.g. suppose <code class="docutils literal notranslate"><span class="pre">n</span></code> is a <code class="docutils literal notranslate"><span class="pre">Map</span></code> and its key is a <code class="docutils literal notranslate"><span class="pre">Enum</span></code>, then you can achieve this if you want to pick the key with a specific <code class="docutils literal notranslate"><span class="pre">Enum</span></code> value:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ getstatic com.alibaba.arthas.Test n &#39;entrySet().iterator.{? #this.key.name()==&quot;STOP&quot;}&#39; <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ getstatic com.alibaba.arthas.Test n <span class="s1">&#39;entrySet().iterator.{? #this.key.name()==&quot;STOP&quot;}&#39;</span>
field: n field: n
@ArrayList[ @ArrayList<span class="o">[</span>
@Node[STOP=bbb], @Node<span class="o">[</span><span class="nv">STOP</span><span class="o">=</span>bbb<span class="o">]</span>,
] <span class="o">]</span>
Affect(row-cnt:1) cost in 68 ms. Affect<span class="o">(</span>row-cnt:1<span class="o">)</span> cost in <span class="m">68</span> ms.
$ getstatic com.alibaba.arthas.Test m &#39;entrySet().iterator.{? #this.key==&quot;a&quot;}&#39; $ getstatic com.alibaba.arthas.Test m <span class="s1">&#39;entrySet().iterator.{? #this.key==&quot;a&quot;}&#39;</span>
field: m field: m
@ArrayList[ @ArrayList<span class="o">[</span>
@Node[a=aaa], @Node<span class="o">[</span><span class="nv">a</span><span class="o">=</span>aaa<span class="o">]</span>,
] <span class="o">]</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>

@ -0,0 +1,433 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>groovy &mdash; Arthas 3.0.5-SNAPSHOT documentation</title>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/overrides.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<script src="_static/center_page.js"></script>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> Arthas
</a>
<div class="version">
3.0.5-SNAPSHOT
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="install-detail.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">Quick start</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Arthas</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>groovy</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/en/groovy.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="groovy">
<span id="groovy"></span><h1>groovy<a class="headerlink" href="#groovy" title="Permalink to this headline"></a></h1>
<blockquote>
<div>Arthas support groovy scripting to allow user to use script like BTrace. It is possible to use if/for/switch/while in groovy scripting, but has more limitations compared to BTrace.</div></blockquote>
<div class="section" id="limitations">
<span id="limitations"></span><h2>Limitations<a class="headerlink" href="#limitations" title="Permalink to this headline"></a></h2>
<ol class="simple">
<li>Prohibit from alternating the original logic. Like <code class="docutils literal notranslate"><span class="pre">watch</span></code> command, The major purpose of scripting is monitoring and observing.</li>
<li>Only allow to monitor at the stages of before/success/exception/finish on one method.</li>
</ol>
</div>
<div class="section" id="parameters">
<span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils">
<thead>
<tr>
<th align="right">Parameter</th>
<th align="left">Explanation</th>
</tr>
</thead>
<tbody>
<tr>
<td align="right"><em>class-pattern</em></td>
<td align="left">class name pattern</td>
</tr>
<tr>
<td align="right"><em>method-pattern</em></td>
<td align="left">method name pattern</td>
</tr>
<tr>
<td align="right"><em>script-filepath</em></td>
<td align="left">the absolute path of the groovy script</td>
</tr>
<tr>
<td align="right">[S]</td>
<td align="left">match all sub classes</td>
</tr>
<tr>
<td align="right">[E]</td>
<td align="left">enable regex match, the default is wildcard match</td>
</tr>
</tbody>
</table><p>Note: the third parameter <code class="docutils literal notranslate"><span class="pre">script-filepath</span></code> must be the absolute path of the groovy script, for example <code class="docutils literal notranslate"><span class="pre">/tmp/test.groovy</span></code>. It is not recommended to use relative path, e.g. <code class="docutils literal notranslate"><span class="pre">./test.groovy</span></code>.</p>
</div>
<div class="section" id="explanation-on-the-important-callbacks">
<span id="explanation-on-the-important-callbacks"></span><h2>Explanation on the important callbacks<a class="headerlink" href="#explanation-on-the-important-callbacks" title="Permalink to this headline"></a></h2>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="cm">/**</span>
<span class="cm"> * Listeners for script to enhance the class</span>
<span class="cm"> */</span>
<span class="kd">interface</span> <span class="nc">ScriptListener</span> <span class="o">{</span>
<span class="cm">/**</span>
<span class="cm"> * When the script is created</span>
<span class="cm"> *</span>
<span class="cm"> * @param output Output</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">create</span><span class="o">(</span><span class="n">Output</span> <span class="n">output</span><span class="o">);</span>
<span class="cm">/**</span>
<span class="cm"> * When the script is destroyed</span>
<span class="cm"> *</span>
<span class="cm"> * @param output Output</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">destroy</span><span class="o">(</span><span class="n">Output</span> <span class="n">output</span><span class="o">);</span>
<span class="cm">/**</span>
<span class="cm"> * Before the method executes</span>
<span class="cm"> *</span>
<span class="cm"> * @param output Output</span>
<span class="cm"> * @param advice Advice</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">before</span><span class="o">(</span><span class="n">Output</span> <span class="n">output</span><span class="o">,</span> <span class="n">Advice</span> <span class="n">advice</span><span class="o">);</span>
<span class="cm">/**</span>
<span class="cm"> * After the method returns</span>
<span class="cm"> *</span>
<span class="cm"> * @param output Output</span>
<span class="cm"> * @param advice Advice</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">afterReturning</span><span class="o">(</span><span class="n">Output</span> <span class="n">output</span><span class="o">,</span> <span class="n">Advice</span> <span class="n">advice</span><span class="o">);</span>
<span class="cm">/**</span>
<span class="cm"> * After the method throws exceptions</span>
<span class="cm"> *</span>
<span class="cm"> * @param output Output</span>
<span class="cm"> * @param advice Advice</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">afterThrowing</span><span class="o">(</span><span class="n">Output</span> <span class="n">output</span><span class="o">,</span> <span class="n">Advice</span> <span class="n">advice</span><span class="o">);</span>
<span class="o">}</span>
</pre></div>
</div>
</div>
<div class="section" id="advice-parameter">
<span id="advice-parameter"></span><h2><code class="docutils literal notranslate"><span class="pre">Advice</span></code> parameter<a class="headerlink" href="#advice-parameter" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Advice</span></code> contains all information necessary for notification. Refer to <a class="reference internal" href="advice-class.html"><span class="doc">expression core parameters</span></a> for more details.</p>
</div>
<div class="section" id="output-parameter">
<span id="output-parameter"></span><h2><code class="docutils literal notranslate"><span class="pre">Output</span></code> parameter<a class="headerlink" href="#output-parameter" title="Permalink to this headline"></a></h2>
<p>There are three methods in <code class="docutils literal notranslate"><span class="pre">Output</span></code>, used for outputting the corresponding text.</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="cm">/**</span>
<span class="cm"> * Output</span>
<span class="cm"> */</span>
<span class="kd">interface</span> <span class="nc">Output</span> <span class="o">{</span>
<span class="cm">/**</span>
<span class="cm"> * Output text without line break</span>
<span class="cm"> *</span>
<span class="cm"> * @param string Text to output</span>
<span class="cm"> * @return this</span>
<span class="cm"> */</span>
<span class="n">Output</span> <span class="nf">print</span><span class="o">(</span><span class="n">String</span> <span class="n">string</span><span class="o">);</span>
<span class="cm">/**</span>
<span class="cm"> * Output text with line break</span>
<span class="cm"> *</span>
<span class="cm"> * @param string Text to output</span>
<span class="cm"> * @return this</span>
<span class="cm"> */</span>
<span class="n">Output</span> <span class="nf">println</span><span class="o">(</span><span class="n">String</span> <span class="n">string</span><span class="o">);</span>
<span class="cm">/**</span>
<span class="cm"> * Finish outputting from the script</span>
<span class="cm"> *</span>
<span class="cm"> * @return this</span>
<span class="cm"> */</span>
<span class="n">Output</span> <span class="nf">finish</span><span class="o">();</span>
<span class="o">}</span>
</pre></div>
</div>
</div>
<div class="section" id="a-groovy-sample-script-to-output-logs">
<span id="a-groovy-sample-script-to-output-logs"></span><h2>A groovy sample script to output logs<a class="headerlink" href="#a-groovy-sample-script-to-output-logs" title="Permalink to this headline"></a></h2>
<div class="highlight-groovy notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">com.taobao.arthas.core.command.ScriptSupportCommand</span>
<span class="kn">import</span> <span class="nn">com.taobao.arthas.core.util.Advice</span>
<span class="kn">import</span> <span class="nn">static</span> <span class="n">java</span><span class="o">.</span><span class="na">lang</span><span class="o">.</span><span class="na">String</span><span class="o">.</span><span class="na">format</span>
<span class="cm">/**</span>
<span class="cm"> * Output method logs</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Logger</span> <span class="kd">implements</span> <span class="n">ScriptSupportCommand</span><span class="o">.</span><span class="na">ScriptListener</span> <span class="o">{</span>
<span class="nd">@Override</span>
<span class="kt">void</span> <span class="nf">create</span><span class="o">(</span><span class="n">ScriptSupportCommand</span><span class="o">.</span><span class="na">Output</span> <span class="n">output</span><span class="o">)</span> <span class="o">{</span>
<span class="n">output</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s2">&quot;script create.&quot;</span><span class="o">);</span>
<span class="o">}</span>
<span class="nd">@Override</span>
<span class="kt">void</span> <span class="nf">destroy</span><span class="o">(</span><span class="n">ScriptSupportCommand</span><span class="o">.</span><span class="na">Output</span> <span class="n">output</span><span class="o">)</span> <span class="o">{</span>
<span class="n">output</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s2">&quot;script destroy.&quot;</span><span class="o">);</span>
<span class="o">}</span>
<span class="nd">@Override</span>
<span class="kt">void</span> <span class="nf">before</span><span class="o">(</span><span class="n">ScriptSupportCommand</span><span class="o">.</span><span class="na">Output</span> <span class="n">output</span><span class="o">,</span> <span class="n">Advice</span> <span class="n">advice</span><span class="o">)</span> <span class="o">{</span>
<span class="n">output</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">format</span><span class="o">(</span><span class="s2">&quot;before:class=%s;method=%s;paramslen=%d;%s;&quot;</span><span class="o">,</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getClazz</span><span class="o">().</span><span class="na">getSimpleName</span><span class="o">(),</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getMethod</span><span class="o">().</span><span class="na">getName</span><span class="o">(),</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getParams</span><span class="o">().</span><span class="na">length</span><span class="o">,</span> <span class="n">advice</span><span class="o">.</span><span class="na">getParams</span><span class="o">()))</span>
<span class="o">}</span>
<span class="nd">@Override</span>
<span class="kt">void</span> <span class="nf">afterReturning</span><span class="o">(</span><span class="n">ScriptSupportCommand</span><span class="o">.</span><span class="na">Output</span> <span class="n">output</span><span class="o">,</span> <span class="n">Advice</span> <span class="n">advice</span><span class="o">)</span> <span class="o">{</span>
<span class="n">output</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">format</span><span class="o">(</span><span class="s2">&quot;returning:class=%s;method=%s;&quot;</span><span class="o">,</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getClazz</span><span class="o">().</span><span class="na">getSimpleName</span><span class="o">(),</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getMethod</span><span class="o">().</span><span class="na">getName</span><span class="o">()))</span>
<span class="o">}</span>
<span class="nd">@Override</span>
<span class="kt">void</span> <span class="nf">afterThrowing</span><span class="o">(</span><span class="n">ScriptSupportCommand</span><span class="o">.</span><span class="na">Output</span> <span class="n">output</span><span class="o">,</span> <span class="n">Advice</span> <span class="n">advice</span><span class="o">)</span> <span class="o">{</span>
<span class="n">output</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">format</span><span class="o">(</span><span class="s2">&quot;throwing:class=%s;method=%s;&quot;</span><span class="o">,</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getClazz</span><span class="o">().</span><span class="na">getSimpleName</span><span class="o">(),</span>
<span class="n">advice</span><span class="o">.</span><span class="na">getMethod</span><span class="o">().</span><span class="na">getName</span><span class="o">()))</span>
<span class="o">}</span>
<span class="o">}</span>
</pre></div>
</div>
<p>Run the script like this:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ groovy com.alibaba.sample.petstore.dal.dao.ProductDao getProductById /Users/zhuyong/middleware/arthas/scripts/Logger.groovy -S
script create.
Press Ctrl+C to abort.
Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">102</span> ms.
before:class<span class="o">=</span>IbatisProductDao<span class="p">;</span><span class="nv">method</span><span class="o">=</span>getProductById<span class="p">;</span><span class="nv">paramslen</span><span class="o">=</span><span class="m">1</span><span class="p">;</span><span class="o">[</span>Ljava.lang.Object<span class="p">;</span>@45df64fc<span class="p">;</span>
returning:class<span class="o">=</span>IbatisProductDao<span class="p">;</span><span class="nv">method</span><span class="o">=</span>getProductById<span class="p">;</span>
before:class<span class="o">=</span>IbatisProductDao<span class="p">;</span><span class="nv">method</span><span class="o">=</span>getProductById<span class="p">;</span><span class="nv">paramslen</span><span class="o">=</span><span class="m">1</span><span class="p">;</span><span class="o">[</span>Ljava.lang.Object<span class="p">;</span>@5b0e2d00<span class="p">;</span>
returning:class<span class="o">=</span>IbatisProductDao<span class="p">;</span><span class="nv">method</span><span class="o">=</span>getProductById<span class="p">;</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018, Alibaba Middleware Group, and contributors.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'3.0.5-SNAPSHOT',
LANGUAGE:'en',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a href="https://github.com/alibaba/arthas">Fork me at GitHub</a>
</div>
</div>
<script type="text/javascript" src="_static/add_badges.js"></script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?d5c5e25b100f0eb51a4c35c8a86ea9b4";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -31,7 +31,7 @@
<link rel="stylesheet" href="_static/overrides.css" type="text/css" /> <link rel="stylesheet" href="_static/overrides.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
<link rel="next" title="Arthas Install" href="install-detail.html" /> <link rel="next" title="Install Arthas" href="install-detail.html" />
<script src="_static/center_page.js"></script> <script src="_static/center_page.js"></script>
@ -93,10 +93,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -165,35 +165,34 @@
<div class="section" id="arthas-documentation"> <div class="section" id="arthas-documentation">
<span id="arthas-documentation"></span><h1>Arthas Documentation<a class="headerlink" href="#arthas-documentation" title="Permalink to this headline"></a></h1> <span id="arthas-documentation"></span><h1>Arthas Documentation<a class="headerlink" href="#arthas-documentation" title="Permalink to this headline"></a></h1>
<p><strong><a class="reference external" href="https://alibaba.github.io/arthas/">中文文档/Chinese Docs</a></strong></p> <p><strong><a class="reference external" href="https://alibaba.github.io/arthas/">中文文档</a></strong></p>
<p><img alt="arthas" src="_images/arthas.png" /></p> <p><img alt="arthas" src="_images/arthas.png" /></p>
<p><code class="docutils literal notranslate"><span class="pre">Arthas</span></code> is a Java Diagnostic tool open sourced by Alibaba.</p> <p>Arthas is a Java diagnostic tool open-sourced by Alibaba middleware team. It is widely adopted and popular among the developers inside Alibaba. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers.</p>
<p>Arthas help developers in trouble-shooting production issues for Java applications without modifying code or restarting servers.</p>
<div class="section" id="background"> <div class="section" id="background">
<span id="background"></span><h2>Background<a class="headerlink" href="#background" title="Permalink to this headline"></a></h2> <span id="background"></span><h2>Background<a class="headerlink" href="#background" title="Permalink to this headline"></a></h2>
<p>Often times, the production system network is inaccessible from local development environment. If issues are encountered in production systems, it is impossible to use IDE to debug the application remotely. More importantly, debugging in production environment is unacceptable, as it will suspend all the threads, which leads to blocking of business services.</p> <p>Oftentimes the production system network is inaccessible from local development environment. If issues are encountered in production systems, it is impossible to use IDE to debug the application remotely. Whats even worse, debugging in production environment is unacceptable, as it will suspend all the threads, leading to services downtime.</p>
<p>Developers could always try to reproduce the same issue on the test/staging environment. However, this is tricky as some issues cannot be be reproduced easily on a different environment, or even disappear once restarted.</p> <p>Developers could always try to reproduce the same issue on the test/staging environment. However, this is tricky as some issues cannot be reproduced easily in a different environment, or even disappear once restarted.</p>
<p>And if youre thinking of adding some logs to your code to help trouble-shoot the issue, you will have to go through the following lifecycle; test, staging, and then to production. Time is money! This approach is inefficient! Besides, the issue may not be reproducible once the JVM is restarted, as described above.</p> <p>And if youre thinking of adding some logs to your code to help trouble-shoot the issue, you will have to go through the following lifecycle: test, staging, and then to production. Time is money! This approach is inefficient! Worse still, the issue may not be fixed since it might be irreproducible once the JVM is restarted, as described above.</p>
<p>Arthas was built to solve these issues. A developer can trouble-shoot your production issues on-the-fly. No JVM restart, no additional code changes. Arthas works as an observer, which will never suspend your existing threads.</p> <p>Arthas is built to solve these issues. A developer can troubleshoot production issues on the fly. No JVM restart, no additional code changes. Arthas works as an observer, that is, it will never suspend your running threads.</p>
</div> </div>
<div class="section" id="key-features"> <div class="section" id="key-features">
<span id="key-features"></span><h2>Key features<a class="headerlink" href="#key-features" title="Permalink to this headline"></a></h2> <span id="key-features"></span><h2>Key features<a class="headerlink" href="#key-features" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>Check whether a class is loaded? Or where the class is loaded from? (Useful for trouble-shooting jar file conflicts)</li> <li>Check whether a class is loaded? Or where the class is loaded from? (Useful for trouble-shooting jar file conflicts)</li>
<li>Decompile a class to ensure the code is running as expected.</li> <li>Decompile a class to ensure the code is running as expected.</li>
<li>View classloader statistics, e.g. the number of classloaders, the number of classes loaded per classloader, the classloader hierarchy, possible classloader leaks, etc.</li> <li>Check classloader statistics, e.g. the number of classloaders, the number of classes loaded per classloader, the classloader hierarchy, possible classloader leaks, etc.</li>
<li>View the method invocation details, e.g. method parameter, return object, thrown exception, and etc.</li> <li>Check the method invocation details, e.g. method parameter, returned values, exceptions and etc.</li>
<li>Check the stack trace of specified method invocation. This is useful when a developers wants to know the caller of the said method.</li> <li>Check the stack trace of specified method invocation. This is useful when a developer wants to know the caller of the method.</li>
<li>Trace the method invocation to find slow sub-invocations.</li> <li>Trace the method invocation to find slow sub-invocations.</li>
<li>Monitor method invocation statistics, e.g. qps, rt, success rate and etc.</li> <li>Monitor method invocation statistics, e.g. QPS (Query Per Second), RT (Return Time), success rate and etc.</li>
<li>Monitor system metrics, thread states and cpu usage, gc statistics, and etc.</li> <li>Monitor system metrics, thread states and CPU usage, GC statistics and etc.</li>
<li>Supports command line interactive mode, with auto-complete feature enabled.</li> <li>Supports command line interactive mode, with auto-complete feature enabled.</li>
<li>Supports telnet and websocket, which enables both local and remote diagnostics with command line and browsers.</li> <li>Supports telnet and WebSocket, which enables both local and remote diagnostics with command line and browsers.</li>
</ul> </ul>
</div> </div>
<div class="section" id="contents"> <div class="section" id="contents">
<span id="contents"></span><h2>Contents<a class="headerlink" href="#contents" title="Permalink to this headline"></a></h2> <span id="contents"></span><h2>Contents<a class="headerlink" href="#contents" title="Permalink to this headline"></a></h2>
<p>English version has just been finished. If you would like to make it better, please check <a class="reference external" href="https://github.com/alibaba/arthas/issues/51">here</a> and submit your PM.</p> <p>English version has just been finished. If you would like to make it better, please check <a class="reference external" href="https://github.com/alibaba/arthas/issues/51">here</a> and submit your pull request.</p>
<div class="toctree-wrapper compound"> <div class="toctree-wrapper compound">
<ul> <ul>
<li class="toctree-l1"><a class="reference internal" href="install-detail.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="install-detail.html">Installation</a></li>
@ -201,10 +200,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -218,7 +217,7 @@
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="install-detail.html" class="btn btn-neutral float-right" title="Arthas Install" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="install-detail.html" class="btn btn-neutral float-right" title="Install Arthas" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
</div> </div>

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arthas Install &mdash; Arthas 3.0.5-SNAPSHOT documentation</title> <title>Install Arthas &mdash; Arthas 3.0.5-SNAPSHOT documentation</title>
@ -93,23 +93,18 @@
<li class="toctree-l2"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li> <li class="toctree-l2"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li>
<li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li> <li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#manual-installation">Manual Installation</a></li> <li class="toctree-l2"><a class="reference internal" href="#manual-installation">Manual Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#advanced-manual-boot">Advanced Manual Boot</a></li>
<li class="toctree-l2"><a class="reference internal" href="#offline-help-documentation">Offline Help Documentation</a></li> <li class="toctree-l2"><a class="reference internal" href="#offline-help-documentation">Offline Help Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#uninstall">Uninstall</a><ul> <li class="toctree-l2"><a class="reference internal" href="#uninstall">Uninstall</a></li>
<li class="toctree-l3"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li>
<li class="toctree-l3"><a class="reference internal" href="#windows">Windows</a></li>
</ul>
</li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">Quick start</a></li> <li class="toctree-l1"><a class="reference internal" href="quick-start.html">Quick start</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -155,7 +150,7 @@
<li><a href="index.html">Docs</a> &raquo;</li> <li><a href="index.html">Docs</a> &raquo;</li>
<li>Arthas Install</li> <li>Install Arthas</li>
<li class="wy-breadcrumbs-aside"> <li class="wy-breadcrumbs-aside">
@ -176,44 +171,40 @@
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody"> <div itemprop="articleBody">
<div class="section" id="arthas-install"> <div class="section" id="install-arthas">
<span id="arthas-install"></span><h1>Arthas Install<a class="headerlink" href="#arthas-install" title="Permalink to this headline"></a></h1> <span id="install-arthas"></span><h1>Install Arthas<a class="headerlink" href="#install-arthas" title="Permalink to this headline"></a></h1>
<div class="section" id="linux-unix-mac"> <div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h2>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h2> <span id="linux-unix-mac"></span><h2>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h2>
<p>You can install Arthas in one single line as:</p> <p>You can install Arthas with one single line command on Linux, Unix, and Mac. Pls. copy the following command and paste it into the command line, then press <em>Enter</em> to run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <span class="p">|</span> sh <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <span class="p">|</span> sh
</pre></div> </pre></div>
</div> </div>
<p>The command line above will download the booting script <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> to the current directory and you can then start Arthas by <code class="docutils literal notranslate"><span class="pre">./as.sh</span></code>, for more help info you can use <code class="docutils literal notranslate"><span class="pre">./as.sh</span> <span class="pre">-h</span></code> to check the details.</p> <p>The command above will download the bootstrap script <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> to the current directory. You can move it the any other place you want, or put its location in <code class="docutils literal notranslate"><span class="pre">$PATH</span></code>.</p>
<p>By the way, you can also add the absolute path of the script <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> to <code class="docutils literal notranslate"><span class="pre">$PATH</span></code> to make it available globally.</p> <p>You can enter its interactive interface by executing <code class="docutils literal notranslate"><span class="pre">as.sh</span></code>, or execute <code class="docutils literal notranslate"><span class="pre">as.sh</span> <span class="pre">-h</span></code> for more help information.</p>
</div> </div>
<div class="section" id="windows"> <div class="section" id="windows">
<span id="windows"></span><h2>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h2> <span id="windows"></span><h2>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h2>
<p>Latest Version: <a class="reference external" href="http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p> <p>Latest Version: <a class="reference external" href="http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>Download the latest <code class="docutils literal notranslate"><span class="pre">bin.zip</span></code>, unzip the package and you can find the <code class="docutils literal notranslate"><span class="pre">as.bat</span></code>. For now this script will only take one argument <code class="docutils literal notranslate"><span class="pre">pid</span></code> which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:)</p> <p>Download the latest <code class="docutils literal notranslate"><span class="pre">bin.zip</span></code>, unzip the package, and find <code class="docutils literal notranslate"><span class="pre">as.bat</span></code> from bin directory. For now this script will only take one argument <code class="docutils literal notranslate"><span class="pre">pid</span></code>, which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:)</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>as.bat &lt;pid&gt; <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>as.bat &lt;pid&gt;
</pre></div> </pre></div>
</div> </div>
<p>A small tip:</p> <p>To have a better experience, you can start the Arthas Server locally by executing <code class="docutils literal notranslate"><span class="pre">as.bat</span> <span class="pre">&lt;pid&gt;</span></code>, then run <code class="docutils literal notranslate"><span class="pre">./as.sh</span> <span class="pre">&lt;pid&gt;&#64;&lt;ip&gt;:&lt;por&gt;</span></code> in another Linux/Unix/Mac machine.</p>
<p>If you are asking for better UX, you can start the Arthas Server locally by <code class="docutils literal notranslate"><span class="pre">as.bat</span> <span class="pre">&lt;pid&gt;</span></code> and then use <code class="docutils literal notranslate"><span class="pre">./as.sh</span> <span class="pre">&lt;pid&gt;&#64;&lt;ip&gt;:&lt;por&gt;</span></code>in another Linux/Unix/Mac machine.</p> <blockquote>
<p>Another tip:</p> <div>If the color is not working as expect on windows, you can use <a class="reference external" href="https://sourceforge.net/projects/conemu">conemu</a> to get it to work.</div></blockquote>
<p>If in Windows, the color is not working as expect. You can try <a class="reference external" href="https://sourceforge.net/projects/conemu">conemu</a> to get it to work.</p>
</div> </div>
<div class="section" id="manual-installation"> <div class="section" id="manual-installation">
<span id="manual-installation"></span><h2>Manual Installation<a class="headerlink" href="#manual-installation" title="Permalink to this headline"></a></h2> <span id="manual-installation"></span><h2>Manual Installation<a class="headerlink" href="#manual-installation" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="manual-install.html"><span class="doc">Manual Installation</span></a></p> <p><a class="reference internal" href="manual-install.html"><span class="doc">Manual Installation</span></a></p>
</div> <p>If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.</p>
<div class="section" id="advanced-manual-boot">
<span id="advanced-manual-boot"></span><h2>Advanced Manual Boot<a class="headerlink" href="#advanced-manual-boot" title="Permalink to this headline"></a></h2>
<p>If you cannot boot Arthas, try to pass in all the critical options manually as the following steps:</p>
<ol> <ol>
<li><p class="first">locate the java for JVM:</p> <li><p class="first">Locate java in the target JVM:</p>
<ul class="simple"> <ul class="simple">
<li>Linux/Unix/Mac: <code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code></li> <li>Linux/Unix/Mac: <code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code></li>
<li>Windows: open the Process Monitor to search java</li> <li>Windows: open the Process Monitor to search java</li>
</ul> </ul>
</li> </li>
<li><p class="first">Concatenate the command</p> <li><p class="first">Assemble bootstrap command:</p>
<p>Lets suppose we are using <code class="docutils literal notranslate"><span class="pre">/opt/jdk1.8/bin/java</span></code>, then the command should be:</p> <p>Lets suppose we are using <code class="docutils literal notranslate"><span class="pre">/opt/jdk1.8/bin/java</span></code>, then the command should be:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <span class="se">\</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <span class="se">\</span>
-jar /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span> -jar /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
@ -223,19 +214,19 @@
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar
</pre></div> </pre></div>
</div> </div>
<p>Note:</p>
<ul class="simple"> <ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> add tools.jar</li> <li><code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> adds tools.jar</li>
<li><code class="docutils literal notranslate"><span class="pre">-jar</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span></code> specify main entry</li> <li><code class="docutils literal notranslate"><span class="pre">-jar</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span></code> specifies main entry</li>
<li><code class="docutils literal notranslate"><span class="pre">-pid</span> <span class="pre">15146</span></code> specify the target java process pid</li> <li><code class="docutils literal notranslate"><span class="pre">-pid</span> <span class="pre">15146</span></code> specifies the target java process PID</li>
<li><code class="docutils literal notranslate"><span class="pre">-target-ip</span> <span class="pre">127.0.0.1</span></code> specify the IP</li> <li><code class="docutils literal notranslate"><span class="pre">-target-ip</span> <span class="pre">127.0.0.1</span></code> specifies the IP</li>
<li><code class="docutils literal notranslate"><span class="pre">-telnet-port</span> <span class="pre">3658</span> <span class="pre">-http-port</span> <span class="pre">8563</span></code> specify telnet and http ports</li> <li><code class="docutils literal notranslate"><span class="pre">-telnet-port</span> <span class="pre">3658</span> <span class="pre">-http-port</span> <span class="pre">8563</span></code> specifies telnet and HTTP ports for remote access</li>
<li><code class="docutils literal notranslate"><span class="pre">-core</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span> <span class="pre">-agent</span> <span class="pre">/tmp/arthas-packaging/arthas/arthas-agent.jar</span></code> specify core/agent jar package</li> <li><code class="docutils literal notranslate"><span class="pre">-core</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span> <span class="pre">-agent</span> <span class="pre">/tmp/arthas-packaging/arthas/arthas-agent.jar</span></code> specifies core/agent jar package</li>
</ul> </ul>
<p>But if you are using JDK 1.9 or abovethen you do not need to add <code class="docutils literal notranslate"><span class="pre">tools.jar</span></code> in option <code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code>.</p> <p>If you are running on JDK 1.9 or abovethen its unncessary to add <code class="docutils literal notranslate"><span class="pre">tools.jar</span></code> in option <code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code>.</p>
<p>F.Y.I the booting log will be printed to <code class="docutils literal notranslate"><span class="pre">~/logs/arthas/arthas.log</span></code>.</p> <p>You can find the logs from <code class="docutils literal notranslate"><span class="pre">~/logs/arthas/arthas.log</span></code>.</p>
</li> </li>
<li><p class="first">Connect via telnet</p> <li><p class="first">Use telnet to connect once attaching to the target JVM (in step 2) succeeds</p>
<p>When attached successfully, you can connect it with</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet localhost <span class="m">3658</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet localhost <span class="m">3658</span>
</pre></div> </pre></div>
</div> </div>
@ -249,16 +240,15 @@
</div> </div>
<div class="section" id="uninstall"> <div class="section" id="uninstall">
<span id="uninstall"></span><h2>Uninstall<a class="headerlink" href="#uninstall" title="Permalink to this headline"></a></h2> <span id="uninstall"></span><h2>Uninstall<a class="headerlink" href="#uninstall" title="Permalink to this headline"></a></h2>
<div class="section" id="linux-unix-mac"> <ul>
<span id="id1"></span><h3>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h3> <li><p class="first">On Linux/Unix/Mac, delete the files with the following command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>rm -rf ~/.arthas/ ~/.arthas_history <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>rm -rf ~/.arthas/ ~/.arthas_history
</pre></div> </pre></div>
</div> </div>
</div> </li>
<div class="section" id="windows"> <li><p class="first">On Windows, simply delete the zip file and unzipped files.</p>
<span id="id2"></span><h3>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h3> </li>
<p>Directly delete the <code class="docutils literal notranslate"><span class="pre">zip</span></code> and unzipped files.</p> </ul>
</div>
</div> </div>
</div> </div>

@ -114,14 +114,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -192,12 +192,12 @@
<div class="section" id="jad"> <div class="section" id="jad">
<span id="jad"></span><h1>jad<a class="headerlink" href="#jad" title="Permalink to this headline"></a></h1> <span id="jad"></span><h1>jad<a class="headerlink" href="#jad" title="Permalink to this headline"></a></h1>
<p>De-compile specified loaded classes.</p> <blockquote>
<p><code class="docutils literal notranslate"><span class="pre">jad</span></code> helps to <em>de-compile</em> the byte code in JVM to the source code to assist you to better understand the logic behind.</p> <div>De-compile the specified classes.</div></blockquote>
<p>F.Y.I</p> <p><code class="docutils literal notranslate"><span class="pre">jad</span></code> helps to de-compile the byte code running in JVM to the source code to assist you to understand the logic behind better.</p>
<ul class="simple"> <ul class="simple">
<li>the de-compiled code will be grammatically highlighted for readability in Arthas console;</li> <li>The de-compiled code is syntax highlighted for better readability in Arthas console.</li>
<li>there might be some trivial grammar errors but it wont affect the logic understanding.</li> <li>It is possible that theres grammar error in the de-compiled code, but it should not affect your interpretation.</li>
</ul> </ul>
<div class="section" id="options"> <div class="section" id="options">
<span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2> <span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
@ -214,22 +214,19 @@
<td align="left">pattern for the class name</td> <td align="left">pattern for the class name</td>
</tr> </tr>
<tr> <tr>
<td align="right">[c:]</td> <td align="right"><code>[c:]</code></td>
<td align="left">hashcode of the class loader that loaded the class</td> <td align="left">hashcode of the class loader that loads the class</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regex matching while the default is wildcard matching</td> <td align="left">turn on regex match while the default is wildcard match</td>
</tr> </tr>
</tbody> </tbody>
</table></div> </table></div>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>When several class loaders loaded the same class:</p> <blockquote>
<ol class="simple"> <div>If the target class is loaded by multiple classloaders, <code class="docutils literal notranslate"><span class="pre">jad</span></code> outputs the <code class="docutils literal notranslate"><span class="pre">hashcode</span></code> of the corresponding classloaders, then you can re-run <code class="docutils literal notranslate"><span class="pre">jad</span></code> and specify <code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">&lt;hashcode&gt;</span></code> to de-compile the target class from the specified classloader.</div></blockquote>
<li><code class="docutils literal notranslate"><span class="pre">jad</span></code> to get the hashcode of the class loader;</li>
<li><code class="docutils literal notranslate"><span class="pre">jad</span> <span class="pre">-c</span> <span class="pre">&lt;hashcode&gt;</span></code> to get the de-compiled class loaded by the specified class loader.</li>
</ol>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span>$ jad org.apache.log4j.Logger <div class="highlight-java notranslate"><div class="highlight"><pre><span></span>$ jad org.apache.log4j.Logger
Found more than one class for: org.apache.log4j.Logger, Please use jad -c hashcode org.apache.log4j.Logger Found more than one class for: org.apache.log4j.Logger, Please use jad -c hashcode org.apache.log4j.Logger
@ -361,8 +358,6 @@ private Map&lt;String, Object&gt; directMetrics<span class="o">(</span>String ip
Affect<span class="o">(</span>row-cnt:1<span class="o">)</span> cost in <span class="m">1508</span> ms. Affect<span class="o">(</span>row-cnt:1<span class="o">)</span> cost in <span class="m">1508</span> ms.
</pre></div> </pre></div>
</div> </div>
<p>F.Y.I</p>
<p>Inner class is not yet supported, you can just check the <em>outer</em> class to further check the inner class.</p>
</div> </div>
</div> </div>

@ -97,8 +97,8 @@
<li class="toctree-l2"><a class="reference internal" href="thread.html">thread</a></li> <li class="toctree-l2"><a class="reference internal" href="thread.html">thread</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">jvm</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">jvm</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l3"><a class="reference internal" href="#thread-related">thread-related</a></li> <li class="toctree-l3"><a class="reference internal" href="#thread-related">Thread related</a></li>
<li class="toctree-l3"><a class="reference internal" href="#filedescriptor-related">fileDescriptor-related</a></li> <li class="toctree-l3"><a class="reference internal" href="#file-descriptor-related">File descriptor related</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="sysprop.html">sysprop</a></li> <li class="toctree-l2"><a class="reference internal" href="sysprop.html">sysprop</a></li>
@ -115,14 +115,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -193,7 +193,8 @@
<div class="section" id="jvm"> <div class="section" id="jvm">
<span id="jvm"></span><h1>jvm<a class="headerlink" href="#jvm" title="Permalink to this headline"></a></h1> <span id="jvm"></span><h1>jvm<a class="headerlink" href="#jvm" title="Permalink to this headline"></a></h1>
<p>Check the JVM profile</p> <blockquote>
<div>Check the current JVMs info</div></blockquote>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ jvm <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ jvm
@ -286,17 +287,17 @@ Affect cost in 2 ms.
</div> </div>
</div> </div>
<div class="section" id="thread-related"> <div class="section" id="thread-related">
<span id="thread-related"></span><h2>thread-related<a class="headerlink" href="#thread-related" title="Permalink to this headline"></a></h2> <span id="thread-related"></span><h2>Thread related<a class="headerlink" href="#thread-related" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>COUNT: the count of active threads</li> <li>COUNT: the count of active threads</li>
<li>DAEMON-COUNT: the count of active daemon threads</li> <li>DAEMON-COUNT: the count of active daemon threads</li>
<li>PEAK-COUNT: the maximum count of the live threads since JVM starts</li> <li>PEAK-COUNT: the maximum count of the live threads since JVM starts</li>
<li>STARTED-COUNT: the total count of the created threads since JVM starts</li> <li>STARTED-COUNT: the total count of the created threads since JVM starts</li>
<li>DEADLOCK-COUNT: the count of deadlock threads</li> <li>DEADLOCK-COUNT: the count of deadlocked threads</li>
</ul> </ul>
</div> </div>
<div class="section" id="filedescriptor-related"> <div class="section" id="file-descriptor-related">
<span id="filedescriptor-related"></span><h2>fileDescriptor-related<a class="headerlink" href="#filedescriptor-related" title="Permalink to this headline"></a></h2> <span id="file-descriptor-related"></span><h2>File descriptor related<a class="headerlink" href="#file-descriptor-related" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>MAX-FILE-DESCRIPTOR-COUNTthe count of max file descriptor JVM process can open</li> <li>MAX-FILE-DESCRIPTOR-COUNTthe count of max file descriptor JVM process can open</li>
<li>OPEN-FILE-DESCRIPTOR-COUNTthe current count of file descriptor JVM process open</li> <li>OPEN-FILE-DESCRIPTOR-COUNTthe current count of file descriptor JVM process open</li>

@ -92,10 +92,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -164,7 +164,7 @@
<div class="section" id="arthas-console-keymap"> <div class="section" id="arthas-console-keymap">
<span id="arthas-console-keymap"></span><h1>Arthas Console Keymap<a class="headerlink" href="#arthas-console-keymap" title="Permalink to this headline"></a></h1> <span id="arthas-console-keymap"></span><h1>Arthas Console Keymap<a class="headerlink" href="#arthas-console-keymap" title="Permalink to this headline"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">keymap</span></code> command print current keymap.</p> <p>Use <code class="docutils literal notranslate"><span class="pre">keymap</span></code> command to print the current keymap:</p>
<p>The default keymap is:</p> <p>The default keymap is:</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
<thead> <thead>
@ -292,13 +292,13 @@
</tr> </tr>
</tbody> </tbody>
</table><ul class="simple"> </table><ul class="simple">
<li>You can enter <code class="docutils literal notranslate"><span class="pre">Tab</span></code> to get automatic prompts at any time.</li> <li>Press <code class="docutils literal notranslate"><span class="pre">tab</span></code> to enable auto-completion prompt at any time.</li>
<li>After typing the command, type <code class="docutils literal notranslate"><span class="pre">-</span></code> or <code class="docutils literal notranslate"><span class="pre">--</span></code>, then press <code class="docutils literal notranslate"><span class="pre">tab</span></code> to display the specific options of this command.</li> <li>Enter command and <code class="docutils literal notranslate"><span class="pre">-</span></code> or <code class="docutils literal notranslate"><span class="pre">--</span></code>, then press <code class="docutils literal notranslate"><span class="pre">tab</span></code> to display the concrete options for the current command.</li>
</ul> </ul>
<div class="section" id="custom-shortcuts"> <div class="section" id="custom-shortcuts">
<span id="custom-shortcuts"></span><h2>Custom shortcuts<a class="headerlink" href="#custom-shortcuts" title="Permalink to this headline"></a></h2> <span id="custom-shortcuts"></span><h2>Custom shortcuts<a class="headerlink" href="#custom-shortcuts" title="Permalink to this headline"></a></h2>
<p>Create a new <code class="docutils literal notranslate"><span class="pre">$USER_HOME/.arthas/conf/inputrc</span></code> file in the current user home directory and add a custom configuration.</p> <p>Specify customization in <code class="docutils literal notranslate"><span class="pre">$USER_HOME/.arthas/conf/inputrc</span></code> file in the current user home directory.</p>
<p>Suppose I am a heavy user of vim. I want to set <code class="docutils literal notranslate"><span class="pre">ctrl+h</span></code> to the cursor forward character. Set it as follows, first copy the default configuration.</p> <p>Vim user may want to map <code class="docutils literal notranslate"><span class="pre">ctrl+h</span></code> to moving the cursor forward one character. To achieve this, copy the default configuration first,</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s2">&quot;\C-a&quot;</span><span class="p">:</span> <span class="n">beginning</span><span class="o">-</span><span class="n">of</span><span class="o">-</span><span class="n">line</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s2">&quot;\C-a&quot;</span><span class="p">:</span> <span class="n">beginning</span><span class="o">-</span><span class="n">of</span><span class="o">-</span><span class="n">line</span>
<span class="s2">&quot;\C-e&quot;</span><span class="p">:</span> <span class="n">end</span><span class="o">-</span><span class="n">of</span><span class="o">-</span><span class="n">line</span> <span class="s2">&quot;\C-e&quot;</span><span class="p">:</span> <span class="n">end</span><span class="o">-</span><span class="n">of</span><span class="o">-</span><span class="n">line</span>
<span class="s2">&quot;\C-f&quot;</span><span class="p">:</span> <span class="n">forward</span><span class="o">-</span><span class="n">word</span> <span class="s2">&quot;\C-f&quot;</span><span class="p">:</span> <span class="n">forward</span><span class="o">-</span><span class="n">word</span>
@ -320,15 +320,15 @@
<span class="s2">&quot;\e\C-?&quot;</span><span class="p">:</span> <span class="n">backward</span><span class="o">-</span><span class="n">kill</span><span class="o">-</span><span class="n">word</span> <span class="s2">&quot;\e\C-?&quot;</span><span class="p">:</span> <span class="n">backward</span><span class="o">-</span><span class="n">kill</span><span class="o">-</span><span class="n">word</span>
</pre></div> </pre></div>
</div> </div>
<p>Then replace <code class="docutils literal notranslate"><span class="pre">&quot;\C-h&quot;:</span> <span class="pre">backward-delete-char</span></code> with <code class="docutils literal notranslate"><span class="pre">&quot;\C-h&quot;:</span> <span class="pre">backward-char</span></code>, then reconnect.</p> <p>then replace <code class="docutils literal notranslate"><span class="pre">&quot;\C-h&quot;:</span> <span class="pre">backward-delete-char</span></code> with <code class="docutils literal notranslate"><span class="pre">&quot;\C-h&quot;:</span> <span class="pre">backward-char</span></code>, then reconnect to Arthas console to take effect.</p>
</div> </div>
<div class="section" id="shortcuts-about-async"> <div class="section" id="shortcuts-for-jobs">
<span id="shortcuts-about-async"></span><h2>Shortcuts about async<a class="headerlink" href="#shortcuts-about-async" title="Permalink to this headline"></a></h2> <span id="shortcuts-for-jobs"></span><h2>Shortcuts for jobs<a class="headerlink" href="#shortcuts-for-jobs" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li>ctrl + c: Terminate current command</li> <li><code class="docutils literal notranslate"><span class="pre">ctrl</span> <span class="pre">+</span> <span class="pre">c</span></code>: Terminate current command</li>
<li>ctrl + z: Suspend the current command, you can restore this command with bg/fg, or kill it.</li> <li><code class="docutils literal notranslate"><span class="pre">ctrl</span> <span class="pre">+</span> <span class="pre">z</span></code>: Suspend the current command, you can restore this command with <code class="docutils literal notranslate"><span class="pre">bg</span></code>/<code class="docutils literal notranslate"><span class="pre">fg</span></code>, or <code class="docutils literal notranslate"><span class="pre">kill</span></code> it.</li>
<li>ctrl + a: Go to the beginning the line</li> <li><code class="docutils literal notranslate"><span class="pre">ctrl</span> <span class="pre">+</span> <span class="pre">a</span></code>: Go to the beginning the line</li>
<li>ctrl + e: Go to the end of the line</li> <li><code class="docutils literal notranslate"><span class="pre">ctrl</span> <span class="pre">+</span> <span class="pre">e</span></code>: Go to the end of the line</li>
</ul> </ul>
</div> </div>
</div> </div>

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Manual Installation &mdash; Arthas 3.0.5-SNAPSHOT documentation</title> <title>Manually Install Arthas &mdash; Arthas 3.0.5-SNAPSHOT documentation</title>
@ -92,10 +92,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -141,7 +141,7 @@
<li><a href="index.html">Docs</a> &raquo;</li> <li><a href="index.html">Docs</a> &raquo;</li>
<li>Manual Installation</li> <li>Manually Install Arthas</li>
<li class="wy-breadcrumbs-aside"> <li class="wy-breadcrumbs-aside">
@ -162,35 +162,34 @@
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody"> <div itemprop="articleBody">
<div class="section" id="manual-installation"> <div class="section" id="manually-install-arthas">
<span id="manual-installation"></span><h1>Manual Installation<a class="headerlink" href="#manual-installation" title="Permalink to this headline"></a></h1> <span id="manually-install-arthas"></span><h1>Manually Install Arthas<a class="headerlink" href="#manually-install-arthas" title="Permalink to this headline"></a></h1>
<div class="section" id="download"> <ol>
<span id="download"></span><h2>Download<a class="headerlink" href="#download" title="Permalink to this headline"></a></h2> <li><p class="first">Download the latest version</p>
<p><strong>Latest <code class="docutils literal notranslate"><span class="pre">bin.zip</span></code></strong>: <a class="reference external" href="http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p> <p><strong>Latest version</strong>: <a class="reference external" href="http://search.maven.org/classic/#search%7Cga%7C1%7Cg%3A%22com.taobao.arthas%22%20AND%20a%3A%22arthas-packaging%22"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>If the download is slow, try to download from the <a class="reference external" href="https://maven.aliyun.com/">repository in AliYun</a>; the downloading URL template is (remember to fill up the version <code class="docutils literal notranslate"><span class="pre">3.x.x</span></code> template to your needs)</p> <p>If the download speed is slow, try to use <a class="reference external" href="https://maven.aliyun.com/">Ali cloud mirror repository</a>, for example, to download version <code class="docutils literal notranslate"><span class="pre">3.x.x</span></code> (you can replace <code class="docutils literal notranslate"><span class="pre">3.x.x</span></code> in the example URL if you want to download other version), the download URL is: https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.x.x/arthas-packaging-3.x.x-bin.zip</p>
<p><code class="docutils literal notranslate"><span class="pre">https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.x.x/arthas-packaging-3.x.x-bin.zip</span></code></p> </li>
</div> <li><p class="first">Unzip zip file</p>
<div class="section" id="unzip">
<span id="unzip"></span><h2>Unzip<a class="headerlink" href="#unzip" title="Permalink to this headline"></a></h2>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>unzip arthas-packaging-bin.zip <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>unzip arthas-packaging-bin.zip
</pre></div> </pre></div>
</div> </div>
</div> </li>
<div class="section" id="install"> <li><p class="first">Install Arthas</p>
<span id="install"></span><h2>Install<a class="headerlink" href="#install" title="Permalink to this headline"></a></h2> <p>It is recommended to completely remove all old versions of Arthas before installation.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo su admin <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo su admin
rm -rf /home/admin/.arthas/lib/* <span class="c1"># remove all the leftover of the old outdated Arthas</span> rm -rf /home/admin/.arthas/lib/* <span class="c1"># remove all the leftover of the old outdated Arthas</span>
<span class="nb">cd</span> arthas <span class="nb">cd</span> arthas
./install-local.sh <span class="c1"># switch the user based on the owner of the target Java process.</span> ./install-local.sh <span class="c1"># switch the user based on the owner of the target Java process.</span>
</pre></div> </pre></div>
</div> </div>
</div> </li>
<div class="section" id="start"> <li><p class="first">Start Arthas</p>
<span id="start"></span><h2>Start<a class="headerlink" href="#start" title="Permalink to this headline"></a></h2> <p>Make sure <code class="docutils literal notranslate"><span class="pre">shutdown</span></code> the old Arthas server before start.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./as.sh <span class="c1"># make sure the old Arthas has been shutdown (using command shutdown);</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./as.sh
</pre></div> </pre></div>
</div> </div>
</div> </li>
</ol>
</div> </div>

@ -105,7 +105,7 @@
<li class="toctree-l2"><a class="reference internal" href="classloader.html">classloader</a></li> <li class="toctree-l2"><a class="reference internal" href="classloader.html">classloader</a></li>
<li class="toctree-l2"><a class="reference internal" href="redefine.html">redefine</a></li> <li class="toctree-l2"><a class="reference internal" href="redefine.html">redefine</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">monitor</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">monitor</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#properties-monitored">Properties monitored</a></li> <li class="toctree-l3"><a class="reference internal" href="#items-to-monitor">Items to monitor</a></li>
<li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li> <li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
</ul> </ul>
@ -115,14 +115,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -193,20 +193,18 @@
<div class="section" id="monitor"> <div class="section" id="monitor">
<span id="monitor"></span><h1>monitor<a class="headerlink" href="#monitor" title="Permalink to this headline"></a></h1> <span id="monitor"></span><h1>monitor<a class="headerlink" href="#monitor" title="Permalink to this headline"></a></h1>
<p>Monitor methods calling stack traces.</p> <blockquote>
<p>F.Y.I</p> <div>Monitor method invocation.</div></blockquote>
<ol class="simple"> <p>Monitor invocation for the method matched with <code class="docutils literal notranslate"><span class="pre">class-pattern</span></code> and <code class="docutils literal notranslate"><span class="pre">method-pattern</span></code>.</p>
<li><code class="docutils literal notranslate"><span class="pre">monitor</span></code> is a persistent command, it never returns until you press <code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code> to manually stop it;</li> <p><code class="docutils literal notranslate"><span class="pre">monitor</span></code> is not a command returning immediately.</p>
<li>the server runs the jobs in the background;</li> <p>A command returning immediately is a command immediately returns with the result after the command is input, while a non-immediate returning command will keep outputting the information from the target JVM process until user presses <code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code>.</p>
<li>injected monitoring code will become invalid automatically once the monitoring jobs being terminated;</li> <p>On Arthass server side, the command is running as a background job, but the weaved code will not take further effect once the job is terminated, therefore, it will not impact the performance after the job quits. Furthermore, Arthas is designed to have no side effect to the business logic.</p>
<li>in theory, Arthas will not change any original behaviors but if it does, please do not hesitate to start an <a class="reference external" href="https://github.com/alibaba/arthas/issues">issue</a>.</li> <div class="section" id="items-to-monitor">
</ol> <span id="items-to-monitor"></span><h2>Items to monitor<a class="headerlink" href="#items-to-monitor" title="Permalink to this headline"></a></h2>
<div class="section" id="properties-monitored">
<span id="properties-monitored"></span><h2>Properties monitored<a class="headerlink" href="#properties-monitored" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
<thead> <thead>
<tr> <tr>
<th align="right">Property</th> <th align="right">Item</th>
<th align="left">Specification</th> <th align="left">Specification</th>
</tr> </tr>
</thead> </thead>
@ -221,7 +219,7 @@
</tr> </tr>
<tr> <tr>
<td align="right">method</td> <td align="right">method</td>
<td align="left">constructor and regular methods</td> <td align="left">method (constructor and regular methods)</td>
</tr> </tr>
<tr> <tr>
<td align="right">total</td> <td align="right">total</td>
@ -247,6 +245,7 @@
</table></div> </table></div>
<div class="section" id="parameters"> <div class="section" id="parameters">
<span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2> <span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<p>Parameter <code class="docutils literal notranslate"><span class="pre">[c:]</span></code> stands for cycles of statistics. Its value is an integer value in seconds.</p>
<table border="1" class="docutils"> <table border="1" class="docutils">
<thead> <thead>
<tr> <tr>
@ -264,12 +263,12 @@
<td align="left">pattern for the method name</td> <td align="left">pattern for the method name</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regex matching while the default is wildcard matching</td> <td align="left">turn on regex matching while the default is wildcard matching</td>
</tr> </tr>
<tr> <tr>
<td align="right">[c:]</td> <td align="right"><code>[c:]</code></td>
<td align="left">cycle of output with default value: <code>60 s</code></td> <td align="left">cycle of statistics, the default value: <code>120</code>s</td>
</tr> </tr>
</tbody> </tbody>
</table></div> </table></div>

Binary file not shown.

@ -110,18 +110,17 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">options</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">options</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#global-options">Global options</a></li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -192,8 +191,8 @@
<div class="section" id="options"> <div class="section" id="options">
<span id="options"></span><h1>options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h1> <span id="options"></span><h1>options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h1>
<div class="section" id="global-options"> <blockquote>
<span id="global-options"></span><h2>Global options<a class="headerlink" href="#global-options" title="Permalink to this headline"></a></h2> <div>Global options</div></blockquote>
<table border="1" class="docutils"> <table border="1" class="docutils">
<thead> <thead>
<tr> <tr>
@ -206,48 +205,47 @@
<tr> <tr>
<td>unsafe</td> <td>unsafe</td>
<td>false</td> <td>false</td>
<td>Enable system-level class enhancement; JVM might crash, if you turn it on (use with great caution :exclamation:)</td> <td>whether to enhance to system-level class. Use it with caution since JVM may hang</td>
</tr> </tr>
<tr> <tr>
<td>dump</td> <td>dump</td>
<td>false</td> <td>false</td>
<td>Enable support for dumping enhanced class to external files; if turned on, class file will be dumped to<code>/${application dir}/arthas-class-dump/</code>please check console output for specific location</td> <td>whether to dump enhanced class to the external files. If it's on, enhanced class will be dumped into <code>/${application dir}/arthas-class-dump/</code>, the specific output path will be output in the console</td>
</tr> </tr>
<tr> <tr>
<td>batch-re-transform</td> <td>batch-re-transform</td>
<td>true</td> <td>true</td>
<td>re-transform matched classes in batch</td> <td>whether to re-transform matched classes in batch</td>
</tr> </tr>
<tr> <tr>
<td>json-format</td> <td>json-format</td>
<td>false</td> <td>false</td>
<td>Enable output in JSON format</td> <td>whether to output in JSON format</td>
</tr> </tr>
<tr> <tr>
<td>disable-sub-class</td> <td>disable-sub-class</td>
<td>false</td> <td>false</td>
<td>Disabling child class matching: by default child class will be matched while matching target class; if you wish exact matching, you should turn it off</td> <td>whether to enable matching child classes. The default value is <code>true</code>. If exact match is desire, turn off this flag</td>
</tr> </tr>
<tr> <tr>
<td>debug-for-asm</td> <td>debug-for-asm</td>
<td>false</td> <td>false</td>
<td>Print ASM-related debug message</td> <td>whether to enable ASM debugging log</td>
</tr> </tr>
<tr> <tr>
<td>save-result</td> <td>save-result</td>
<td>false</td> <td>false</td>
<td>Enable saving logs for task results: when true, all command results will be saved to <code>/home/admin/logs/arthas/arthas.log</code></td> <td>whether to save execution result. All execution results will be saved to <code>/home/admin/logs/arthas/arthas.log</code> when it's turned on</td>
</tr> </tr>
<tr> <tr>
<td>job-timeout</td> <td>job-timeout</td>
<td>1d</td> <td>1d</td>
<td>Default timeout for background jobs: jobs will be stopped once timed out (i.e. 1d, 2h, 3m, 25s)</td> <td>default timeout for background jobs. Background job will be terminated once it's timed out (i.e. 1d, 2h, 3m, 25s)</td>
</tr> </tr>
</tbody> </tbody>
</table></div> </table><div class="section" id="usage">
<div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>Saving logs for command outputs, you can:</p> <p>For example, to enable saving command execution result, input the command below:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ options save-result true <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ options save-result true
NAME BEFORE-VALUE AFTER-VALUE NAME BEFORE-VALUE AFTER-VALUE
---------------------------------------- ----------------------------------------

@ -32,7 +32,7 @@
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
<link rel="next" title="Advanced Usage" href="advanced-use.html" /> <link rel="next" title="Advanced Usage" href="advanced-use.html" />
<link rel="prev" title="Arthas Install" href="install-detail.html" /> <link rel="prev" title="Install Arthas" href="install-detail.html" />
<script src="_static/center_page.js"></script> <script src="_static/center_page.js"></script>
@ -91,7 +91,7 @@
<ul class="current"> <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install-detail.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="install-detail.html">Installation</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Quick start</a><ul> <li class="toctree-l1 current"><a class="current reference internal" href="#">Quick start</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#start-a-demo">1. Start A Demo</a></li> <li class="toctree-l2"><a class="reference internal" href="#start-demo-application">1. Start Demo Application</a></li>
<li class="toctree-l2"><a class="reference internal" href="#start-arthas">2. Start Arthas</a><ul> <li class="toctree-l2"><a class="reference internal" href="#start-arthas">2. Start Arthas</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li> <li class="toctree-l3"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li>
<li class="toctree-l3"><a class="reference internal" href="#windows">Windows</a></li> <li class="toctree-l3"><a class="reference internal" href="#windows">Windows</a></li>
@ -105,10 +105,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -177,8 +177,8 @@
<div class="section" id="quick-start"> <div class="section" id="quick-start">
<span id="quick-start"></span><h1>Quick Start<a class="headerlink" href="#quick-start" title="Permalink to this headline"></a></h1> <span id="quick-start"></span><h1>Quick Start<a class="headerlink" href="#quick-start" title="Permalink to this headline"></a></h1>
<div class="section" id="start-a-demo"> <div class="section" id="start-demo-application">
<span id="start-a-demo"></span><h2>1. Start A Demo<a class="headerlink" href="#start-a-demo" title="Permalink to this headline"></a></h2> <span id="start-demo-application"></span><h2>1. Start Demo Application<a class="headerlink" href="#start-demo-application" title="Permalink to this headline"></a></h2>
<p>Save the following code to a <code class="docutils literal notranslate"><span class="pre">Demo.java</span></code> and run the commands in shell as</p> <p>Save the following code to a <code class="docutils literal notranslate"><span class="pre">Demo.java</span></code> and run the commands in shell as</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>javac Demo.java <span class="o">&amp;&amp;</span> java Demo <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>javac Demo.java <span class="o">&amp;&amp;</span> java Demo
</pre></div> </pre></div>
@ -212,66 +212,59 @@
<span class="o">}</span> <span class="o">}</span>
</pre></div> </pre></div>
</div> </div>
<p>Save the contents above into <code class="docutils literal notranslate"><span class="pre">Demo.java</span></code>, then compile it under the command line:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>javac Demo.java
java Demo
</pre></div>
</div>
<p>You can also save and start the code in IDE.</p>
</div> </div>
<div class="section" id="start-arthas"> <div class="section" id="start-arthas">
<span id="start-arthas"></span><h2>2. Start Arthas<a class="headerlink" href="#start-arthas" title="Permalink to this headline"></a></h2> <span id="start-arthas"></span><h2>2. Start Arthas<a class="headerlink" href="#start-arthas" title="Permalink to this headline"></a></h2>
<div class="section" id="linux-unix-mac"> <div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h3>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h3> <span id="linux-unix-mac"></span><h3>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h3>
<p>Execute the following command in the command line:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./as.sh <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./as.sh
</pre></div> </pre></div>
</div> </div>
<ol> <blockquote>
<li><p class="first">the user to run the <em>command</em> should have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user <code class="docutils literal notranslate"><span class="pre">admin</span></code>:</p> <div>The user to run this script <em>MUST</em> have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user <code class="docutils literal notranslate"><span class="pre">admin</span></code>: <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">su</span> <span class="pre">admin</span> <span class="pre">&amp;&amp;</span> <span class="pre">./as.sh</span></code> or <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">-u</span> <span class="pre">admin</span> <span class="pre">-EH</span> <span class="pre">./as.sh</span></code>. For more details on the bootstrap script, please refer to <a class="reference internal" href="start-arthas.html"><span class="doc">Start Arthas</span></a>. If you cannot be able to attach to the target process, please check the logs under <code class="docutils literal notranslate"><span class="pre">~/logs/arthas</span></code> for troubleshooting.</div></blockquote>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo su admin <span class="o">&amp;&amp;</span> ./as.sh <p>Select the target Java process to attach:</p>
<span class="c1"># Or</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ ./as.sh
sudo -u admin -EH ./as.sh Arthas script version: <span class="m">3</span>.0.2
</pre></div>
</div>
</li>
<li><p class="first">For more details of the booting script, please refer to <a class="reference internal" href="start-arthas.html"><span class="doc">Start Arthas</span></a>.</p>
</li>
<li><p class="first">If you cannot <em>attach</em> the target process, please check the logs under <code class="docutils literal notranslate"><span class="pre">~/logs/arthas</span></code> for troubleshooting.</p>
</li>
<li><p class="first">Selecting the target process as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ./as.sh
Arthas script version: 3.0.2
Found existing java process, please choose one and hit RETURN. Found existing java process, please choose one and hit RETURN.
* [1]: 95428 * <span class="o">[</span><span class="m">1</span><span class="o">]</span>: <span class="m">95428</span>
[2]: 22647 org.jetbrains.jps.cmdline.Launcher <span class="o">[</span><span class="m">2</span><span class="o">]</span>: <span class="m">22647</span> org.jetbrains.jps.cmdline.Launcher
[3]: 21736 <span class="o">[</span><span class="m">3</span><span class="o">]</span>: <span class="m">21736</span>
[4]: 13560 Demo <span class="o">[</span><span class="m">4</span><span class="o">]</span>: <span class="m">13560</span> Demo
</pre></div> </pre></div>
</div> </div>
<p>We select <code class="docutils literal notranslate"><span class="pre">4</span></code> to check our Demo process and we then have</p> <p>The Demo process is the fourth as shown above, press 4 then Enter. Arthas will attach to the target process, and start to output:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Connecting to arthas server... current timestamp is 1536656867 <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>Connecting to arthas server... current timestamp is <span class="m">1536656867</span>
Trying 127.0.0.1... Trying <span class="m">127</span>.0.0.1...
Connected to 127.0.0.1. Connected to <span class="m">127</span>.0.0.1.
Escape character is &#39;^]&#39;. Escape character is <span class="s1">&#39;^]&#39;</span>.
,---. ,------. ,--------.,--. ,--. ,---. ,---. ,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. &#39;&#39;--. .--&#39;| &#39;--&#39; | / O \ &#39; .-&#39; / O <span class="se">\ </span><span class="p">|</span> .--. <span class="s1">&#39;&#39;</span>--. .--<span class="s1">&#39;| &#39;</span>--<span class="s1">&#39; | / O \ &#39;</span> .-<span class="s1">&#39;</span>
| .-. || &#39;--&#39;.&#39; | | | .--. || .-. |`. `-. <span class="s1">| .-. || &#39;</span>--<span class="s1">&#39;.&#39;</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> .--. <span class="o">||</span> .-. <span class="p">|</span><span class="sb">`</span>. <span class="sb">`</span>-.
| | | || |\ \ | | | | | || | | |.-&#39; | <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="o">||</span> <span class="p">|</span><span class="se">\ </span> <span class="se">\ </span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="o">||</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span>.-<span class="s1">&#39; |</span>
`--&#39; `--&#39;`--&#39; &#39;--&#39; `--&#39; `--&#39; `--&#39;`--&#39; `--&#39;`-----&#39; <span class="s1">`--&#39;</span> <span class="sb">`</span>--<span class="s1">&#39;`--&#39;</span> <span class="s1">&#39;--&#39;</span> <span class="sb">`</span>--<span class="s1">&#39; `--&#39;</span> <span class="sb">`</span>--<span class="s1">&#39;`--&#39;</span> <span class="sb">`</span>--<span class="s1">&#39;`-----&#39;</span>
wiki: https://alibaba.github.io/arthas wiki: https://alibaba.github.io/arthas
version: 3.0.1-RC-SNAPSHOT version: <span class="m">3</span>.0.1-RC-SNAPSHOT
pid: 13560 pid: <span class="m">13560</span>
timestamp: 1536656867894 timestamp: <span class="m">1536656867894</span>
$
</pre></div> </pre></div>
</div> </div>
</li>
</ol>
</div> </div>
<div class="section" id="windows"> <div class="section" id="windows">
<span id="windows"></span><h3>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h3> <span id="windows"></span><h3>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h3>
<p>Open the <em>DOS</em> console, under the unzipped arthas folder execute <code class="docutils literal notranslate"><span class="pre">as.bat</span> <span class="pre">&lt;pid&gt;</span></code></p> <p>Open Command window, execute <code class="docutils literal notranslate"><span class="pre">as.bat</span> <span class="pre">&lt;pid&gt;</span></code> from where the Arthas package file is unzipped.</p>
</div> </div>
</div> </div>
<div class="section" id="check-the-dashboard"> <div class="section" id="check-the-dashboard">
<span id="check-the-dashboard"></span><h2>3. Check the Dashboard<a class="headerlink" href="#check-the-dashboard" title="Permalink to this headline"></a></h2> <span id="check-the-dashboard"></span><h2>3. Check the Dashboard<a class="headerlink" href="#check-the-dashboard" title="Permalink to this headline"></a></h2>
<p>Type in <a class="reference internal" href="dashboard.html"><span class="doc">dashboard</span></a> and hit the <em>ENTER</em>, you will see it as (<code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code> to stop)</p> <p>Type <a class="reference internal" href="dashboard.html"><span class="doc">dashboard</span></a> and hit ENTER, a brief report on the current process will be shown as below, pls. <code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code> to stop:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ dashboard <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ dashboard
ID NAME GROUP PRIORI STATE %CPU TIME INTERRU DAEMON ID NAME GROUP PRIORI STATE %CPU TIME INTERRU DAEMON
17 pool-2-thread-1 system 5 WAITIN 67 0:0 false false 17 pool-2-thread-1 system 5 WAITIN 67 0:0 false false
@ -308,7 +301,7 @@ java.home /Library/Java/JavaVir
</div> </div>
<div class="section" id="watch"> <div class="section" id="watch">
<span id="watch"></span><h2>4. watch<a class="headerlink" href="#watch" title="Permalink to this headline"></a></h2> <span id="watch"></span><h2>4. watch<a class="headerlink" href="#watch" title="Permalink to this headline"></a></h2>
<p>Input <a class="reference internal" href="watch.html"><span class="doc">watch</span></a> to check the returned value of <code class="docutils literal notranslate"><span class="pre">Counter.value()</span></code>:</p> <p>Use <a class="reference internal" href="watch.html"><span class="doc">watch</span></a> to check the returned value of <code class="docutils literal notranslate"><span class="pre">Counter.value()</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ watch Demo$Counter value returnObj <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ watch Demo$Counter value returnObj
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 29 ms. Affect(class-cnt:1 , method-cnt:1) cost in 29 ms.
@ -319,14 +312,12 @@ ts=2018-09-10 17:53:14;result=@Integer[624]
ts=2018-09-10 17:53:15;result=@Integer[625] ts=2018-09-10 17:53:15;result=@Integer[625]
</pre></div> </pre></div>
</div> </div>
<p><a class="reference internal" href="advanced-use.html"><span class="doc">more advanced usages</span></a></p> <p>Pls. refer to <a class="reference internal" href="advanced-use.html"><span class="doc">advanced usages</span></a> for more information.</p>
</div> </div>
<div class="section" id="exit-arthas"> <div class="section" id="exit-arthas">
<span id="exit-arthas"></span><h2>5. Exit Arthas<a class="headerlink" href="#exit-arthas" title="Permalink to this headline"></a></h2> <span id="exit-arthas"></span><h2>5. Exit Arthas<a class="headerlink" href="#exit-arthas" title="Permalink to this headline"></a></h2>
<ul class="simple"> <p>Use <code class="docutils literal notranslate"><span class="pre">quit</span></code> or <code class="docutils literal notranslate"><span class="pre">exit</span></code> to disconnect from the current process. The Arthas instance attached to the target process continues to live inside the process, and its port is standby for further connection.</p>
<li><code class="docutils literal notranslate"><span class="pre">quit</span></code> or <code class="docutils literal notranslate"><span class="pre">exit</span></code> will just disconnect the current console connection while Arthas still running in the target process</li> <p>Use <code class="docutils literal notranslate"><span class="pre">shutdown</span></code> to have Arthas completely quit from the target process.</p>
<li><code class="docutils literal notranslate"><span class="pre">shutdown</span></code> will terminate the Arthas completely</li>
</ul>
</div> </div>
</div> </div>
@ -341,7 +332,7 @@ ts=2018-09-10 17:53:15;result=@Integer[625]
<a href="advanced-use.html" class="btn btn-neutral float-right" title="Advanced Usage" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="advanced-use.html" class="btn btn-neutral float-right" title="Advanced Usage" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="install-detail.html" class="btn btn-neutral" title="Arthas Install" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> <a href="install-detail.html" class="btn btn-neutral" title="Install Arthas" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div> </div>

@ -114,14 +114,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -192,13 +192,11 @@
<div class="section" id="redefine"> <div class="section" id="redefine">
<span id="redefine"></span><h1>redefine<a class="headerlink" href="#redefine" title="Permalink to this headline"></a></h1> <span id="redefine"></span><h1>redefine<a class="headerlink" href="#redefine" title="Permalink to this headline"></a></h1>
<p>Load the external <code class="docutils literal notranslate"><span class="pre">*.class</span></code> files to <strong>re-define</strong> the JVM-loaded classes.</p> <blockquote>
<div>Load the external <code class="docutils literal notranslate"><span class="pre">*.class</span></code> files to re-define the loaded peer class in JVM.</div></blockquote>
<p>Reference: <a class="reference external" href="https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-">Instrumentation#redefineClasses</a></p> <p>Reference: <a class="reference external" href="https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-">Instrumentation#redefineClasses</a></p>
<p>F.Y.I</p> <blockquote>
<ol class="simple"> <div>Notes: Re-defined classes cannot be restored. There are chances that redefining may fail due to some reasons, for example: theres new field introduced in the new version of the class, pls. refer to JDKs documentation for the limitations.</div></blockquote>
<li>Re-defined classes cannot be restores any more;</li>
<li>Re-definition can fail (like adding a new field/method); for more information, please refer to JDK documentation</li>
</ol>
<div class="section" id="options"> <div class="section" id="options">
<span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2> <span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -210,12 +208,12 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="right">[c:]</td> <td align="right"><code>[c:]</code></td>
<td align="left">hashcode of the class loader</td> <td align="left">hashcode of the class loader</td>
</tr> </tr>
<tr> <tr>
<td align="right">[p:]</td> <td align="right"><code>[p:]</code></td>
<td align="left">absolute path of the external <code>*.class</code> (multiple paths supported)</td> <td align="left">absolute path of the external <code>*.class</code>, multiple paths are separated with 'space'</td>
</tr> </tr>
</tbody> </tbody>
</table></div> </table></div>

@ -93,6 +93,9 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Release Notes</a><ul> <li class="toctree-l1 current"><a class="current reference internal" href="#">Release Notes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#v3-0-4">v3.0.4</a></li> <li class="toctree-l2"><a class="reference internal" href="#v3-0-4">v3.0.4</a></li>
<li class="toctree-l2"><a class="reference internal" href="#v2017-11-03">v2017-11-03</a></li> <li class="toctree-l2"><a class="reference internal" href="#v2017-11-03">v2017-11-03</a></li>
@ -109,9 +112,6 @@
<li class="toctree-l2"><a class="reference internal" href="#v2015-12-29">v2015-12-29</a></li> <li class="toctree-l2"><a class="reference internal" href="#v2015-12-29">v2015-12-29</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
</ul> </ul>

@ -92,10 +92,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -165,7 +165,7 @@
<div class="section" id="reset"> <div class="section" id="reset">
<span id="reset"></span><h1>reset<a class="headerlink" href="#reset" title="Permalink to this headline"></a></h1> <span id="reset"></span><h1>reset<a class="headerlink" href="#reset" title="Permalink to this headline"></a></h1>
<blockquote> <blockquote>
<div>Reset all classes that have been enhanced by Arthas, and all enhanced classes will be reset when Arthas server <code class="docutils literal notranslate"><span class="pre">shutdown</span></code>.</div></blockquote> <div>Reset all classes that have been enhanced by Arthas. These enhanced classes will also be reset when Arthas server is <code class="docutils literal notranslate"><span class="pre">shutdown</span></code>.</div></blockquote>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ reset -h <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ reset -h

@ -103,7 +103,7 @@
<li class="toctree-l2 current"><a class="reference internal" href="advanced-use.html#other-features">Other features</a><ul class="current"> <li class="toctree-l2 current"><a class="reference internal" href="advanced-use.html#other-features">Other features</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="async.html">Async support</a></li> <li class="toctree-l3"><a class="reference internal" href="async.html">Async support</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">log the output</a><ul> <li class="toctree-l3 current"><a class="current reference internal" href="#">log the output</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#asynchronous-log">Asynchronous log</a></li> <li class="toctree-l4"><a class="reference internal" href="#use-asynchronous-job-to-log">Use asynchronous job to log</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l3"><a class="reference internal" href="batch-support.html">batch</a></li> <li class="toctree-l3"><a class="reference internal" href="batch-support.html">batch</a></li>
@ -114,10 +114,10 @@
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -188,35 +188,35 @@
<div class="section" id="log-command-outputs"> <div class="section" id="log-command-outputs">
<span id="log-command-outputs"></span><h1>Log command outputs<a class="headerlink" href="#log-command-outputs" title="Permalink to this headline"></a></h1> <span id="log-command-outputs"></span><h1>Log command outputs<a class="headerlink" href="#log-command-outputs" title="Permalink to this headline"></a></h1>
<p>Log command outputs for later analysis, turned off by default.</p> <blockquote>
<p>To turn it on, using <a class="reference internal" href="options.html"><span class="doc">options</span></a> as:</p> <div>Log command outputs for later analysis</div></blockquote>
<ul>
<li><p class="first">By default, this behavior is turned off. To enable it, execute the command below:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ options save-result <span class="nb">true</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ options save-result <span class="nb">true</span>
NAME BEFORE-VALUE AFTER-VALUE NAME BEFORE-VALUE AFTER-VALUE
---------------------------------------- ----------------------------------------
save-result <span class="nb">false</span> <span class="nb">true</span> save-result <span class="nb">false</span> <span class="nb">true</span>
Affect<span class="o">(</span>row-cnt:1<span class="o">)</span> cost in <span class="m">3</span> ms. Affect<span class="o">(</span>row-cnt:1<span class="o">)</span> cost in <span class="m">3</span> ms.
</pre></div> </pre></div>
</div> </div>
<p>F.Y.I</p> <p>If the message above is output on the console, then this behavior is enabled successfully.</p>
<ol class="simple"> </li>
<li>logging file lies in: <code class="docutils literal notranslate"><span class="pre">{user.home}/logs/arthas-cache/result.log</span></code>;</li> <li><p class="first">Log file path</p>
<li>remember to clean up the file to save disk space.</li> <p>The command execution result will be save in <code class="docutils literal notranslate"><span class="pre">{user.home}/logs/arthas-cache/result.log</span></code>. Pls. clean it up regularly to save disk space.</p>
</ol> </li>
<div class="section" id="asynchronous-log"> </ul>
<span id="asynchronous-log"></span><h2>Asynchronous log<a class="headerlink" href="#asynchronous-log" title="Permalink to this headline"></a></h2> <div class="section" id="use-asynchronous-job-to-log">
<p>:notes: :notes: <span id="use-asynchronous-job-to-log"></span><h2>Use asynchronous job to log<a class="headerlink" href="#use-asynchronous-job-to-log" title="Permalink to this headline"></a></h2>
With the latest Arthas, you can log the outputs asynchronously in the background:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ trace Test t &gt;&gt; <span class="p">&amp;</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ trace Test t &gt;&gt; <span class="p">&amp;</span>
job id : <span class="m">2</span> job id : <span class="m">2</span>
cache location : /Users/zhuyong/logs/arthas-cache/28198/2 cache location : /Users/zhuyong/logs/arthas-cache/28198/2
</pre></div> </pre></div>
</div> </div>
<p>F.Y.I</p> <p>By doing this, the command will run at background asynchronously, and output the execution result into <code class="docutils literal notranslate"><span class="pre">~/logs/arthas-cache/{PID}/{JobId}</span></code>:</p>
<ol class="simple"> <ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">quit/exit</span></code> or <code class="docutils literal notranslate"><span class="pre">Ctrl+C</span></code> will not affect the asynchronous jobs :sparkles:;</li> <li>The background job will continue to run even if the current session is disconnected. The default job timeout value is 1 day, use global <a class="reference internal" href="options.html"><span class="doc">options</span></a> command to alternate it.</li>
<li>default timeout for the background job is 1 day (you can set it via <a class="reference internal" href="options.html"><span class="doc">options</span></a>);</li> <li>The execution result will be output into the file asynchronously. Pls. note the behavior of this command is not controlled by <code class="docutils literal notranslate"><span class="pre">save-result</span></code> option from global <a class="reference internal" href="options.html"><span class="doc">options</span></a>. No matter <code class="docutils literal notranslate"><span class="pre">save-result</span></code> is set to <code class="docutils literal notranslate"><span class="pre">true</span></code> or not, this command will write into <code class="docutils literal notranslate"><span class="pre">~/logs/arthas-cache/{PID}/{JobId}</span></code> anyway, instead of into <code class="docutils literal notranslate"><span class="pre">~/logs/arthas-cache/result.log</span></code>.</li>
<li>outputs will be save to the <code class="docutils literal notranslate"><span class="pre">cache</span> <span class="pre">location</span></code> now (no matter what <code class="docutils literal notranslate"><span class="pre">save-result</span></code> is - not <code class="docutils literal notranslate"><span class="pre">~/logs/arthas-cache/result.log</span></code> any more).</li> </ul>
</ol>
</div> </div>
</div> </div>

@ -99,11 +99,8 @@
<li class="toctree-l2"><a class="reference internal" href="sysprop.html">sysprop</a></li> <li class="toctree-l2"><a class="reference internal" href="sysprop.html">sysprop</a></li>
<li class="toctree-l2"><a class="reference internal" href="getstatic.html">getstatic</a></li> <li class="toctree-l2"><a class="reference internal" href="getstatic.html">getstatic</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">sc</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">sc</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#options">Options</a><ul> <li class="toctree-l3"><a class="reference internal" href="#supported-options">Supported Options</a></li>
<li class="toctree-l4"><a class="reference internal" href="#specification">Specification</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l4"><a class="reference internal" href="#usage">Usage</a></li>
</ul>
</li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="sm.html">sm</a></li> <li class="toctree-l2"><a class="reference internal" href="sm.html">sm</a></li>
@ -117,14 +114,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -195,12 +192,11 @@
<div class="section" id="sc"> <div class="section" id="sc">
<span id="sc"></span><h1>sc<a class="headerlink" href="#sc" title="Permalink to this headline"></a></h1> <span id="sc"></span><h1>sc<a class="headerlink" href="#sc" title="Permalink to this headline"></a></h1>
<p>Check the profiles of the loaded classes.</p> <blockquote>
<p>Abbreviated from <em>Search-Class</em>; with the help of this command, you can search out all the loaded classes in JVM. Supported options are: <code class="docutils literal notranslate"><span class="pre">[d]</span></code><code class="docutils literal notranslate"><span class="pre">[E]</span></code><code class="docutils literal notranslate"><span class="pre">[f]</span></code> and <code class="docutils literal notranslate"><span class="pre">[x:]</span></code>.</p> <div>Search classes loaded by JVM.</div></blockquote>
<div class="section" id="options"> <p><code class="docutils literal notranslate"><span class="pre">sc</span></code> stands for search class. This command can search all possible classes loaded by JVM and show their information. The supported options are: <code class="docutils literal notranslate"><span class="pre">[d]</span></code><code class="docutils literal notranslate"><span class="pre">[E]</span></code><code class="docutils literal notranslate"><span class="pre">[f]</span></code> and <code class="docutils literal notranslate"><span class="pre">[x:]</span></code>.</p>
<span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2> <div class="section" id="supported-options">
<div class="section" id="specification"> <span id="supported-options"></span><h2>Supported Options<a class="headerlink" href="#supported-options" title="Permalink to this headline"></a></h2>
<span id="specification"></span><h3>Specification<a class="headerlink" href="#specification" title="Permalink to this headline"></a></h3>
<table border="1" class="docutils"> <table border="1" class="docutils">
<thead> <thead>
<tr> <tr>
@ -218,31 +214,29 @@
<td align="left">pattern for the method name</td> <td align="left">pattern for the method name</td>
</tr> </tr>
<tr> <tr>
<td align="right">[d]</td> <td align="right"><code>[d]</code></td>
<td align="left">print the details of the current class including the source file, class declaration, the class loaders and the like.<br/>F.Y.I if a class is loaded by several class loaders, then the class will be printed several times</td> <td align="left">print the details of the current class, including its code source, class specification, its class loader and so on.<br/>If a class is loaded by more than one class loader, then the class details will be printed several times</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regx matching while the default is wildcards matching</td> <td align="left">turn on regex match, the default behavior is wildcards match</td>
</tr> </tr>
<tr> <tr>
<td align="right">[f]</td> <td align="right"><code>[f]</code></td>
<td align="left">print the fields info of the current class, which <strong><em>must</em></strong> be used with <code>-d</code></td> <td align="left">print the fields info of the current class, MUST be used with <code>-d</code> together</td>
</tr> </tr>
<tr> <tr>
<td align="right">[x:]</td> <td align="right"><code>[x:]</code></td>
<td align="left">the depth to print the static fields, whose default is <code>0</code> - directly invoke the <code>toString()</code></td> <td align="left">specify the depth of recursive traverse the static fields, the default value is '0' - equivalent to use <code>toString</code> to output</td>
</tr> </tr>
</tbody> </tbody>
</table><p>Tip:</p> </table><blockquote>
<ol class="simple"> <div><em>class-patten</em> supports full qualified class name, e.g. com.taobao.test.AAA and com/taobao/test/AAA. It also supports the format of com/taobao/test/AAA, so that it is convenient to directly copy class name from the exception stack trace without replacing / to .. <br/><br/>
<li><em>class-patten</em> supports full qualified class name (e.g. com.taobao.test.AAA and com/taobao/test/AAA)</li> <code class="docutils literal notranslate"><span class="pre">sc</span></code> turns on matching sub-class match by default, that is, <code class="docutils literal notranslate"><span class="pre">sc</span></code> will also search the sub classes of the target class too. If exact-match is desired, pls. use <code class="docutils literal notranslate"><span class="pre">options</span> <span class="pre">disable-sub-class</span> <span class="pre">true</span></code>.</div></blockquote>
<li><code class="docutils literal notranslate"><span class="pre">sc</span></code> turned on the <code class="docutils literal notranslate"><span class="pre">sub-class</span></code> matching in default mode; if you do want to hide <code class="docutils literal notranslate"><span class="pre">sub-class</span></code>, you can just turn it off with <a class="reference internal" href="options.html"><span class="doc">options</span></a> as <code class="docutils literal notranslate"><span class="pre">options</span> <span class="pre">disable-sub-class</span> <span class="pre">true</span></code>.</li>
</ol>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h3>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h3> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>Check the static fields of a class using <code class="docutils literal notranslate"><span class="pre">sc</span> <span class="pre">-df</span> <span class="pre">class-name</span></code></p> <p>For example, use <code class="docutils literal notranslate"><span class="pre">sc</span> <span class="pre">-df</span> <span class="pre">class-name</span></code> to view classs static fields:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ sc -df org.apache.commons.lang.StringUtils <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ sc -df org.apache.commons.lang.StringUtils
class-info org.apache.commons.lang.StringUtils class-info org.apache.commons.lang.StringUtils
@ -283,7 +277,6 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
</div>
</div> </div>

@ -92,10 +92,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

File diff suppressed because one or more lines are too long

@ -114,14 +114,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -192,10 +192,9 @@
<div class="section" id="sm"> <div class="section" id="sm">
<span id="sm"></span><h1>sm<a class="headerlink" href="#sm" title="Permalink to this headline"></a></h1> <span id="sm"></span><h1>sm<a class="headerlink" href="#sm" title="Permalink to this headline"></a></h1>
<p>Check the method profile of the loaded classes;</p> <blockquote>
<p>Abbreviated from <em>Search-Method</em>, with which you can check all methods profiles of the loaded classes.</p> <div>Search method from the loaded classes.</div></blockquote>
<p>F.Y.I <p><code class="docutils literal notranslate"><span class="pre">sm</span></code> stands for search method. This command can search and show method information from all loaded classes. <code class="docutils literal notranslate"><span class="pre">sm</span></code> can only view the methods declared on the target class, that is, methods from its parent classes are invisible.</p>
<code class="docutils literal notranslate"><span class="pre">sm</span></code> only shows the methods declared in the current class; methods declared in ancestors will not be presented.</p>
<div class="section" id="options"> <div class="section" id="options">
<span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2> <span id="options"></span><h2>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -215,18 +214,19 @@
<td align="left">pattern for method name</td> <td align="left">pattern for method name</td>
</tr> </tr>
<tr> <tr>
<td align="right">[d]</td> <td align="right"><code>[d]</code></td>
<td align="left">print the details of the method</td> <td align="left">print the details of the method</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regex matching while the default mode is wildcard matching</td> <td align="left">turn on regex matching while the default mode is wildcard matching</td>
</tr> </tr>
</tbody> </tbody>
</table></div> </table></div>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sm org.apache.catalina.connector.Connector <p>Show methods from <code class="docutils literal notranslate"><span class="pre">org.apache.catalina.connector.Connector</span></code>:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sm org.apache.catalina.connector.Connector
org.apache.catalina.connector.Connector-&gt;&lt;init&gt; org.apache.catalina.connector.Connector-&gt;&lt;init&gt;
org.apache.catalina.connector.Connector-&gt;setProperty org.apache.catalina.connector.Connector-&gt;setProperty
org.apache.catalina.connector.Connector-&gt;getProperty org.apache.catalina.connector.Connector-&gt;getProperty
@ -266,6 +266,7 @@ org.apache.catalina.connector.Connector-&gt;getMaxCookieCount
... ...
</pre></div> </pre></div>
</div> </div>
<p>Show methods details from <code class="docutils literal notranslate"><span class="pre">org.apache.catalina.connector.Connector</span></code>:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sm org.apache.catalina.connector.Connector -d <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sm org.apache.catalina.connector.Connector -d
declaring-class org.apache.catalina.connector.Connector declaring-class org.apache.catalina.connector.Connector
constructor-name &lt;init&gt; constructor-name &lt;init&gt;

@ -108,25 +108,20 @@
<li class="toctree-l2"><a class="reference internal" href="watch.html">watch</a></li> <li class="toctree-l2"><a class="reference internal" href="watch.html">watch</a></li>
<li class="toctree-l2"><a class="reference internal" href="trace.html">trace</a></li> <li class="toctree-l2"><a class="reference internal" href="trace.html">trace</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">stack</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">stack</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a><ul> <li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li>
<li class="toctree-l4"><a class="reference internal" href="advice-class.html">Critical fields in expression</a></li>
<li class="toctree-l4"><a class="reference external" href="https://github.com/alibaba/arthas/issues/71">Special usage</a></li>
<li class="toctree-l4"><a class="reference external" href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -197,8 +192,9 @@
<div class="section" id="stack"> <div class="section" id="stack">
<span id="stack"></span><h1>stack<a class="headerlink" href="#stack" title="Permalink to this headline"></a></h1> <span id="stack"></span><h1>stack<a class="headerlink" href="#stack" title="Permalink to this headline"></a></h1>
<p>Print out the full call stack trace <em>till</em> the current method.</p> <blockquote>
<p>Most of the time, we know the method being invoked but not always we know <strong>HOW being invoked</strong>; <code class="docutils literal notranslate"><span class="pre">stack</span></code> can be a great help to locate the <em>source</em> for you.</p> <div>Print out the full call stack of the current method.</div></blockquote>
<p>Most often we know one method gets called, but we have no idea on which code path gets executed or when the method gets called since there are so many code paths to the target method. The command <code class="docutils literal notranslate"><span class="pre">stack</span></code> comes to rescue in this difficult situation.</p>
<div class="section" id="parameters"> <div class="section" id="parameters">
<span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2> <span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -222,109 +218,100 @@
<td align="left">condition expression</td> <td align="left">condition expression</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regex matching while the default is wildcard matching</td> <td align="left">turn on regex match, the default behavior is wildcard match</td>
</tr> </tr>
<tr> <tr>
<td align="right">[n:]</td> <td align="right"><code>[n:]</code></td>
<td align="left">calling times</td> <td align="left">execution times</td>
</tr> </tr>
</tbody> </tbody>
</table><p>F.Y.I</p> </table><p>Theres one thing worthy noting here is observation expression. The observation expression supports OGNL grammar, for example, you can come up a expression like this <code class="docutils literal notranslate"><span class="pre">&quot;{params,returnObj}&quot;</span></code>. All OGNL expressions are supported as long as they are legal to the grammar.</p>
<ol class="simple"> <p>Thanks for <code class="docutils literal notranslate"><span class="pre">advice</span></code>s data structure, it is possible to observe from varieties of different angles. Inside <code class="docutils literal notranslate"><span class="pre">advice</span></code> parameter, all necessary information for notification can be found.</p>
<li>any valid OGNL expression as <code class="docutils literal notranslate"><span class="pre">&quot;{params,returnObj}&quot;</span></code> supported;</li> <p>Pls. refer to <a class="reference internal" href="advice-class.html"><span class="doc">core parameters in expression</span></a> for more details.</p>
<li>filter by time cost as <code class="docutils literal notranslate"><span class="pre">trace</span> <span class="pre">*StringUtils</span> <span class="pre">isBlank</span> <span class="pre">'#cost&gt;100'</span></code>; calling stack with only time cost higher than <code class="docutils literal notranslate"><span class="pre">100ms</span></code> will be printed.</li> <ul class="simple">
</ol> <li>Pls. also refer to <a class="reference external" href="https://github.com/alibaba/arthas/issues/71">https://github.com/alibaba/arthas/issues/71</a> for more advanced usage</li>
<p>Attention:</p> <li>OGNL official site: <a class="reference external" href="https://commons.apache.org/proper/commons-ognl/language-guide.html">https://commons.apache.org/proper/commons-ognl/language-guide.html</a></li>
<ol class="simple">
<li><code class="docutils literal notranslate"><span class="pre">#cost</span></code> can be used in <code class="docutils literal notranslate"><span class="pre">watch/stack/trace</span></code>;</li>
<li>using <code class="docutils literal notranslate"><span class="pre">#cost</span></code> in Arthas 3.0 instead of <code class="docutils literal notranslate"><span class="pre">$cost</span></code>.</li>
</ol>
<p>Advanced:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="advice-class.html">Critical fields in expression</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues/71">Special usage</a></li>
<li class="toctree-l1"><a class="reference external" href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
</ul> </ul>
</div> </div>
</div>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>The quoting rules: if there are quotes within the expression, use another type of quotes to quote the whole expression (single <code class="docutils literal notranslate"><span class="pre">''</span></code> or double <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code> quotes).</p> <blockquote>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ stack com.alibaba.sample.petstore.dal.dao.ProductDao getProductById &#39;params[0]==&quot;K9-BD-01&quot;&#39; <div>Notes: if theres quotes character (say, <code class="docutils literal notranslate"><span class="pre">'</span></code>) in the expression, then the whole expression must be wrapped by quotes but with the other type (in this case, <code class="docutils literal notranslate"><span class="pre">&quot;</span></code>) too. On contrary, its no need to quote the expression itself if theres no quotes character found in it, but it is strongly recommended.</div></blockquote>
<p>Print out calling stack when the first method parameter is “K9-BD-01” for getProductById() method:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ stack com.alibaba.sample.petstore.dal.dao.ProductDao getProductById <span class="s1">&#39;params[0]==&quot;K9-BD-01&quot;&#39;</span>
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 51 ms. Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">51</span> ms.
thread_name=&quot;http-bio-8080-exec-4&quot; thread_id=0x4a;is_daemon=true;priority=5; <span class="nv">thread_name</span><span class="o">=</span><span class="s2">&quot;http-bio-8080-exec-4&quot;</span> <span class="nv">thread_id</span><span class="o">=</span>0x4a<span class="p">;</span><span class="nv">is_daemon</span><span class="o">=</span>true<span class="p">;</span><span class="nv">priority</span><span class="o">=</span><span class="m">5</span><span class="p">;</span>
@com.alibaba.sample.petstore.dal.dao.ibatis.IbatisProductDao.getProductById() @com.alibaba.sample.petstore.dal.dao.ibatis.IbatisProductDao.getProductById<span class="o">()</span>
at com.alibaba.sample.petstore.web.store.module.screen.ItemList.execute(ItemList.java:50) at com.alibaba.sample.petstore.web.store.module.screen.ItemList.execute<span class="o">(</span>ItemList.java:50<span class="o">)</span>
at com.alibaba.sample.petstore.web.store.module.screen.ItemList$$FastClassByCGLIB$$40b2f45f.invoke(&lt;generated&gt;:-1) at com.alibaba.sample.petstore.web.store.module.screen.ItemList<span class="nv">$$</span>FastClassByCGLIB<span class="nv">$$</span>40b2f45f.invoke<span class="o">(</span>&lt;generated&gt;:-1<span class="o">)</span>
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at net.sf.cglib.reflect.FastMethod.invoke<span class="o">(</span>FastMethod.java:53<span class="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke(MethodInvoker.java:70) at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke<span class="o">(</span>MethodInvoker.java:70<span class="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.DataBindingAdapter.executeAndReturn(DataBindingAdapter.java:41) at com.alibaba.citrus.service.moduleloader.impl.adapter.DataBindingAdapter.executeAndReturn<span class="o">(</span>DataBindingAdapter.java:41<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.performScreenModule(PerformScreenValve.java:111) at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.performScreenModule<span class="o">(</span>PerformScreenValve.java:111<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.invoke(PerformScreenValve.java:74) at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.invoke<span class="o">(</span>PerformScreenValve.java:74<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke(PerformActionValve.java:73) at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke<span class="o">(</span>PerformActionValve.java:73<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invoke(PipelineImpl.java:210) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invoke<span class="o">(</span>PipelineImpl.java:210<span class="o">)</span>
...... ......
thread_name=&quot;http-bio-8080-exec-2&quot; thread_id=0x48;is_daemon=true;priority=5; <span class="nv">thread_name</span><span class="o">=</span><span class="s2">&quot;http-bio-8080-exec-2&quot;</span> <span class="nv">thread_id</span><span class="o">=</span>0x48<span class="p">;</span><span class="nv">is_daemon</span><span class="o">=</span>true<span class="p">;</span><span class="nv">priority</span><span class="o">=</span><span class="m">5</span><span class="p">;</span>
@com.alibaba.sample.petstore.dal.dao.ibatis.IbatisProductDao.getProductById() @com.alibaba.sample.petstore.dal.dao.ibatis.IbatisProductDao.getProductById<span class="o">()</span>
at com.alibaba.sample.petstore.web.store.module.screen.ItemList.execute(ItemList.java:50) at com.alibaba.sample.petstore.web.store.module.screen.ItemList.execute<span class="o">(</span>ItemList.java:50<span class="o">)</span>
at com.alibaba.sample.petstore.web.store.module.screen.ItemList$$FastClassByCGLIB$$40b2f45f.invoke(&lt;generated&gt;:-1) at com.alibaba.sample.petstore.web.store.module.screen.ItemList<span class="nv">$$</span>FastClassByCGLIB<span class="nv">$$</span>40b2f45f.invoke<span class="o">(</span>&lt;generated&gt;:-1<span class="o">)</span>
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at net.sf.cglib.reflect.FastMethod.invoke<span class="o">(</span>FastMethod.java:53<span class="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke(MethodInvoker.java:70) at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke<span class="o">(</span>MethodInvoker.java:70<span class="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.DataBindingAdapter.executeAndReturn(DataBindingAdapter.java:41) at com.alibaba.citrus.service.moduleloader.impl.adapter.DataBindingAdapter.executeAndReturn<span class="o">(</span>DataBindingAdapter.java:41<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.performScreenModule(PerformScreenValve.java:111) at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.performScreenModule<span class="o">(</span>PerformScreenValve.java:111<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.invoke(PerformScreenValve.java:74) at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.invoke<span class="o">(</span>PerformScreenValve.java:74<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke(PerformActionValve.java:73) at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke<span class="o">(</span>PerformActionValve.java:73<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invoke(PipelineImpl.java:210) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invoke<span class="o">(</span>PipelineImpl.java:210<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.ChooseValve.invoke(ChooseValve.java:98) at com.alibaba.citrus.service.pipeline.impl.valve.ChooseValve.invoke<span class="o">(</span>ChooseValve.java:98<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
... ...
</pre></div> </pre></div>
</div> </div>
<p>Filtering by time cost:</p> <p>Print out the calling stack when method execute() takes more than 30ms to finish:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ stack com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost&gt;30 <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ stack com.alibaba.sample.petstore.web.store.module.screen.ItemList execute <span class="c1">#cost&gt;30</span>
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 123 ms. Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">123</span> ms.
stack com.alibaba.sample.petstore.web.store.module.screen.ItemList execute #cost&gt;30 stack com.alibaba.sample.petstore.web.store.module.screen.ItemList execute <span class="c1">#cost&gt;30</span>
thread_name=http-nio-8080-exec-10;id=31;is_daemon=true;priority=5;TCCL=com.taobao.pandora.boot.embedded.tomcat.TomcatEmbeddedWebappClassLoader <span class="nv">thread_name</span><span class="o">=</span>http-nio-8080-exec-10<span class="p">;</span><span class="nv">id</span><span class="o">=</span><span class="m">31</span><span class="p">;</span><span class="nv">is_daemon</span><span class="o">=</span>true<span class="p">;</span><span class="nv">priority</span><span class="o">=</span><span class="m">5</span><span class="p">;</span><span class="nv">TCCL</span><span class="o">=</span>com.taobao.pandora.boot.embedded.tomcat.TomcatEmbeddedWebappClassLoader
@com.alibaba.sample.petstore.web.store.module.screen.ItemList.execute() @com.alibaba.sample.petstore.web.store.module.screen.ItemList.execute<span class="o">()</span>
at com.alibaba.sample.petstore.web.store.module.screen.ItemList$$FastClassByCGLIB$$40b2f45f.invoke(&lt;generated&gt;:-1) at com.alibaba.sample.petstore.web.store.module.screen.ItemList<span class="nv">$$</span>FastClassByCGLIB<span class="nv">$$</span>40b2f45f.invoke<span class="o">(</span>&lt;generated&gt;:-1<span class="o">)</span>
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at net.sf.cglib.reflect.FastMethod.invoke<span class="o">(</span>FastMethod.java:53<span class="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke(MethodInvoker.java:70) at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke<span class="o">(</span>MethodInvoker.java:70<span class="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.DataBindingAdapter.executeAndReturn(DataBindingAdapter.java:41) at com.alibaba.citrus.service.moduleloader.impl.adapter.DataBindingAdapter.executeAndReturn<span class="o">(</span>DataBindingAdapter.java:41<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.performScreenModule(PerformScreenValve.java:111) at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.performScreenModule<span class="o">(</span>PerformScreenValve.java:111<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.invoke(PerformScreenValve.java:74) at com.alibaba.citrus.turbine.pipeline.valve.PerformScreenValve.invoke<span class="o">(</span>PerformScreenValve.java:74<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke(PerformActionValve.java:73) at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke<span class="o">(</span>PerformActionValve.java:73<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invoke(PipelineImpl.java:210) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invoke<span class="o">(</span>PipelineImpl.java:210<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.ChooseValve.invoke(ChooseValve.java:98) at com.alibaba.citrus.service.pipeline.impl.valve.ChooseValve.invoke<span class="o">(</span>ChooseValve.java:98<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invoke(PipelineImpl.java:210) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invoke<span class="o">(</span>PipelineImpl.java:210<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invokeBody(LoopValve.java:105) at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invokeBody<span class="o">(</span>LoopValve.java:105<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invoke(LoopValve.java:83) at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invoke<span class="o">(</span>LoopValve.java:83<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PageAuthorizationValve.invoke(PageAuthorizationValve.java:105) at com.alibaba.citrus.turbine.pipeline.valve.PageAuthorizationValve.invoke<span class="o">(</span>PageAuthorizationValve.java:105<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.CheckCsrfTokenValve.invoke(CheckCsrfTokenValve.java:123) at com.alibaba.citrus.turbine.pipeline.valve.CheckCsrfTokenValve.invoke<span class="o">(</span>CheckCsrfTokenValve.java:123<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.AnalyzeURLValve.invoke(AnalyzeURLValve.java:126) at com.alibaba.citrus.turbine.pipeline.valve.AnalyzeURLValve.invoke<span class="o">(</span>AnalyzeURLValve.java:126<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.SetLoggingContextValve.invoke(SetLoggingContextValve.java:66) at com.alibaba.citrus.turbine.pipeline.valve.SetLoggingContextValve.invoke<span class="o">(</span>SetLoggingContextValve.java:66<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PrepareForTurbineValve.invoke(PrepareForTurbineValve.java:52) at com.alibaba.citrus.turbine.pipeline.valve.PrepareForTurbineValve.invoke<span class="o">(</span>PrepareForTurbineValve.java:52<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invokeNext(PipelineImpl.java:157) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invokeNext<span class="o">(</span>PipelineImpl.java:157<span class="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl$PipelineContextImpl.invoke(PipelineImpl.java:210) at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<span class="nv">$PipelineContextImpl</span>.invoke<span class="o">(</span>PipelineImpl.java:210<span class="o">)</span>
at com.alibaba.citrus.webx.impl.WebxControllerImpl.service(WebxControllerImpl.java:43) at com.alibaba.citrus.webx.impl.WebxControllerImpl.service<span class="o">(</span>WebxControllerImpl.java:43<span class="o">)</span>
at com.alibaba.citrus.webx.impl.WebxRootControllerImpl.handleRequest(WebxRootControllerImpl.java:53) at com.alibaba.citrus.webx.impl.WebxRootControllerImpl.handleRequest<span class="o">(</span>WebxRootControllerImpl.java:53<span class="o">)</span>
at com.alibaba.citrus.webx.support.AbstractWebxRootController.service(AbstractWebxRootController.java:165) at com.alibaba.citrus.webx.support.AbstractWebxRootController.service<span class="o">(</span>AbstractWebxRootController.java:165<span class="o">)</span>
... ...
</pre></div> </pre></div>
</div> </div>

@ -92,10 +92,10 @@
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li> <li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -193,15 +193,15 @@ $
<div class="section" id="parameter-description"> <div class="section" id="parameter-description">
<span id="parameter-description"></span><h3>Parameter Description<a class="headerlink" href="#parameter-description" title="Permalink to this headline"></a></h3> <span id="parameter-description"></span><h3>Parameter Description<a class="headerlink" href="#parameter-description" title="Permalink to this headline"></a></h3>
<ul class="simple"> <ul class="simple">
<li>PID: Target Java process ID(Make sure that the user executing the command has sufficient permissions to operate the target Java process.)</li> <li><em>PID</em>: Target Java process ID (Make sure that the user executing the command has sufficient permissions to operate the target Java process.)</li>
<li>IP: The address that Arthas Server listens on, the default value is <code class="docutils literal notranslate"><span class="pre">127.0.0.1</span></code>. Arthas allows multiple users to access simultaneously without interfering with each other.</li> <li><em>IP</em>: The address that Arthas Server listens on, the default value is <code class="docutils literal notranslate"><span class="pre">127.0.0.1</span></code>. Arthas allows multiple users to access simultaneously without interfering with each other.</li>
<li>PORT: Arthas Server portthe default value is 3658</li> <li><em>PORT</em>: Arthas Server portthe default value is 3658</li>
</ul> </ul>
</div> </div>
<div class="section" id="sample"> <div class="section" id="sample">
<span id="sample"></span><h3>Sample<a class="headerlink" href="#sample" title="Permalink to this headline"></a></h3> <span id="sample"></span><h3>Sample<a class="headerlink" href="#sample" title="Permalink to this headline"></a></h3>
<ul> <ul>
<li><p class="first">If you do not specify IP and PORT, the default is 127.0.0.1 and 3658</p> <li><p class="first">If IP and PORT are not specified, then the default values are 127.0.0.1 and 3658</p>
<blockquote> <blockquote>
<div><p>./as.sh 12345</p> <div><p>./as.sh 12345</p>
</div></blockquote> </div></blockquote>
@ -214,21 +214,21 @@ $
</div> </div>
<div class="section" id="remote-diagnosis"> <div class="section" id="remote-diagnosis">
<span id="remote-diagnosis"></span><h3>Remote Diagnosis<a class="headerlink" href="#remote-diagnosis" title="Permalink to this headline"></a></h3> <span id="remote-diagnosis"></span><h3>Remote Diagnosis<a class="headerlink" href="#remote-diagnosis" title="Permalink to this headline"></a></h3>
<p>After starting Arthas Server, users can use <code class="docutils literal notranslate"><span class="pre">telnet</span></code> connect to the remote Arthas Server, for example</p> <p>After starting Arthas Server on the target Java process, users can use <code class="docutils literal notranslate"><span class="pre">telnet</span></code> connect to the remote Arthas Server, for example</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet <span class="m">192</span>.168.1.119 <span class="m">3658</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet <span class="m">192</span>.168.1.119 <span class="m">3658</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="sudo-support"> <div class="section" id="sudo-support">
<span id="sudo-support"></span><h3>sudo Support<a class="headerlink" href="#sudo-support" title="Permalink to this headline"></a></h3> <span id="sudo-support"></span><h3>sudo Support<a class="headerlink" href="#sudo-support" title="Permalink to this headline"></a></h3>
<p>If you need to switch users, such as <code class="docutils literal notranslate"><span class="pre">admin</span></code>, you need to add the -H parameter.</p> <p>Usually online environment will only grant users privilege as low as possible, instead, all advanced operations are through sudo-list. Since <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> script takes into account the current effective user, it is possible to run the script in the other rule, by specifying <code class="docutils literal notranslate"><span class="pre">-H</span></code> option like this:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo -u admin -H ./as.sh <span class="m">12345</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo -u admin -H ./as.sh <span class="m">12345</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="windows-support"> <div class="section" id="windows-support">
<span id="windows-support"></span><h3>Windows Support<a class="headerlink" href="#windows-support" title="Permalink to this headline"></a></h3> <span id="windows-support"></span><h3>Windows Support<a class="headerlink" href="#windows-support" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">as.bat</span></code> script only supports one parameter: pid</p> <p>Right now <code class="docutils literal notranslate"><span class="pre">as.bat</span></code> script supports one parameter only, which is: pid</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>as.bat &lt;pid&gt; <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>as.bat &lt;pid&gt;
</pre></div> </pre></div>
</div> </div>

@ -99,8 +99,8 @@
<li class="toctree-l2 current"><a class="current reference internal" href="#">sysprop</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">sysprop</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a><ul> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#check-all-properties">Check all properties</a></li> <li class="toctree-l4"><a class="reference internal" href="#check-all-properties">Check all properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#check-a-single-property">Check a single property</a></li> <li class="toctree-l4"><a class="reference internal" href="#check-one-single-property">Check One Single Property</a></li>
<li class="toctree-l4"><a class="reference internal" href="#modify-a-single-property">Modify a single property</a></li> <li class="toctree-l4"><a class="reference internal" href="#modify-single-property">Modify Single Property</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -118,14 +118,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -196,7 +196,8 @@
<div class="section" id="sysprop"> <div class="section" id="sysprop">
<span id="sysprop"></span><h1>sysprop<a class="headerlink" href="#sysprop" title="Permalink to this headline"></a></h1> <span id="sysprop"></span><h1>sysprop<a class="headerlink" href="#sysprop" title="Permalink to this headline"></a></h1>
<p>Check the JVM system properties.</p> <blockquote>
<div>Examine the system properties from the target JVM</div></blockquote>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">USAGE</span><span class="p">:</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">USAGE</span><span class="p">:</span>
@ -294,16 +295,17 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="check-a-single-property"> <div class="section" id="check-one-single-property">
<span id="check-a-single-property"></span><h3>Check a single property<a class="headerlink" href="#check-a-single-property" title="Permalink to this headline"></a></h3> <span id="check-one-single-property"></span><h3>Check One Single Property<a class="headerlink" href="#check-one-single-property" title="Permalink to this headline"></a></h3>
<p>Tip: <code class="docutils literal notranslate"><span class="pre">tab</span></code> auto-completion supported</p> <blockquote>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sysprop java.version <div>Use <code class="docutils literal notranslate"><span class="pre">tab</span></code> for auto-completion</div></blockquote>
java.version=1.8.0_51 <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sysprop java.version
java.version<span class="o">=</span><span class="m">1</span>.8.0_51
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="modify-a-single-property"> <div class="section" id="modify-single-property">
<span id="modify-a-single-property"></span><h3>Modify a single property<a class="headerlink" href="#modify-a-single-property" title="Permalink to this headline"></a></h3> <span id="modify-single-property"></span><h3>Modify Single Property<a class="headerlink" href="#modify-single-property" title="Permalink to this headline"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sysprop user.country <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sysprop user.country
user.country=US user.country=US
$ sysprop user.country CN $ sysprop user.country CN

@ -97,11 +97,11 @@
<li class="toctree-l2 current"><a class="current reference internal" href="#">thread</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">thread</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li> <li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a><ul> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#list-the-top-n-busiest-with-detailed-stack-trace">List the top n busiest with detailed stack trace</a></li> <li class="toctree-l4"><a class="reference internal" href="#list-the-top-n-busiest-threads-with-detailed-stack-trace">List the top n busiest threads with detailed stack trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="#list-all-info-when-no-options-provided">List all info when no options provided</a></li> <li class="toctree-l4"><a class="reference internal" href="#list-all-threads-info-when-no-options-provided">List all threads info when no options provided</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-thread-id-present-the-specified-thread-profile">thread &lt;thread_id&gt; present the specified thread profile</a></li> <li class="toctree-l4"><a class="reference internal" href="#thread-id-show-the-running-stack-for-the-target-thread">thread id, show the running stack for the target thread</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-b-locate-the-blocking-threads">thread -b locate the blocking threads</a></li> <li class="toctree-l4"><a class="reference internal" href="#thread-b-locate-the-thread-bocking-the-others">thread -b, locate the thread bocking the others</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-i-specify-the-collecting-interval">thread -i specify the collecting interval</a></li> <li class="toctree-l4"><a class="reference internal" href="#thread-i-specify-the-sampling-interval">thread -i, specify the sampling interval</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -121,14 +121,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -199,7 +199,8 @@
<div class="section" id="thread"> <div class="section" id="thread">
<span id="thread"></span><h1>thread<a class="headerlink" href="#thread" title="Permalink to this headline"></a></h1> <span id="thread"></span><h1>thread<a class="headerlink" href="#thread" title="Permalink to this headline"></a></h1>
<p>Check the basic profile and stack trace of the threads.</p> <blockquote>
<div>Check the basic info and stack trace of the target thread.</div></blockquote>
<div class="section" id="parameters"> <div class="section" id="parameters">
<span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2> <span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -215,31 +216,28 @@
<td align="left">thread id in JVM</td> <td align="left">thread id in JVM</td>
</tr> </tr>
<tr> <tr>
<td align="right">[n:]</td> <td align="right"><code>[n:]</code></td>
<td align="left">the top n busiest with stack traces</td> <td align="left">the top n busiest threads with stack traces printed</td>
</tr> </tr>
<tr> <tr>
<td align="right">[b]</td> <td align="right"><code>[b]</code></td>
<td align="left">locate the threads blocking others</td> <td align="left">locate the thread blocking the others</td>
</tr> </tr>
<tr> <tr>
<td align="right">[i <code>&lt;value&gt;</code>]</td> <td align="right">[i <code>&lt;value&gt;</code>]</td>
<td align="left">specify the interval to collect data to compute CPU ratios (ms)</td> <td align="left">specify the interval to collect data to compute CPU ratios (ms)</td>
</tr> </tr>
</tbody> </tbody>
</table><p>How to get the CPU ratios?</p> </table><blockquote>
<blockquote> <div>How the CPU ratios are calculated? <br/><br/>
<div>Within an <em>specified</em> interval, the time cost by the thread compared to the total CPU time. CPU ratio for a given thread is the CPU time it takes divided by the total CPU time within a specified interval period. It is calculated in the following way: sample CPU times for all the thread by calling <code class="docutils literal notranslate"><span class="pre">java.lang.management.ThreadMXBean#getThreadCpuTime</span></code> first, then sleep for a period (the default value is 100ms, which can be specified by <code class="docutils literal notranslate"><span class="pre">-i</span></code>), then sample CPU times again. By this, we can get the time cost for this period for each thread, then come up with the ratio. <br/><br/>
Take a sample (using <code class="docutils literal notranslate"><span class="pre">java.lang.management.ThreadMXBean#getThreadCpuTime</span></code>) to get the CPU time cost for all the threads and after a <em>specified</em> interval (default <em>100 ms</em>, which can be specified by <code class="docutils literal notranslate"><span class="pre">-i</span></code>), take another sample and we have the CPU time cost and the ratios naturally.</div></blockquote> Note: this operation consumes CPU time too (<code class="docutils literal notranslate"><span class="pre">getThreadCpuTime</span></code> is time-consuming), therefore it is possible to observe Arthass thread appears in the list. To avoid this, try to increase sample interval, for example: 5000 ms.<br/><br/>
<blockquote> If youd like to check the CPU ratios from the very beginning of the Java process, <a class="reference external" href="https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads">show-busy-java-threads</a> can come to help.</div></blockquote>
<div>Attention: this kind of operation will take time, to decrease the extra cost, youd better expand the interval to like <code class="docutils literal notranslate"><span class="pre">5000</span> <span class="pre">ms</span></code> for less performance overhead.</div></blockquote>
<p>F.Y.I</p>
<p>If youd like to check the CPU ratios from the very start of the Java process, <a class="reference external" href="https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads">show-busy-java-threads</a> can be a help.</p>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="section" id="list-the-top-n-busiest-with-detailed-stack-trace"> <div class="section" id="list-the-top-n-busiest-threads-with-detailed-stack-trace">
<span id="list-the-top-n-busiest-with-detailed-stack-trace"></span><h3>List the top n busiest with detailed stack trace<a class="headerlink" href="#list-the-top-n-busiest-with-detailed-stack-trace" title="Permalink to this headline"></a></h3> <span id="list-the-top-n-busiest-threads-with-detailed-stack-trace"></span><h3>List the top n busiest threads with detailed stack trace<a class="headerlink" href="#list-the-top-n-busiest-threads-with-detailed-stack-trace" title="Permalink to this headline"></a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ thread -n <span class="m">3</span> <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ thread -n <span class="m">3</span>
<span class="s2">&quot;as-command-execute-daemon&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">29</span> <span class="nv">cpuUsage</span><span class="o">=</span><span class="m">75</span>% RUNNABLE <span class="s2">&quot;as-command-execute-daemon&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">29</span> <span class="nv">cpuUsage</span><span class="o">=</span><span class="m">75</span>% RUNNABLE
at sun.management.ThreadImpl.dumpThreads0<span class="o">(</span>Native Method<span class="o">)</span> at sun.management.ThreadImpl.dumpThreads0<span class="o">(</span>Native Method<span class="o">)</span>
@ -267,8 +265,8 @@ Take a sample (using <code class="docutils literal notranslate"><span class="pre
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="list-all-info-when-no-options-provided"> <div class="section" id="list-all-threads-info-when-no-options-provided">
<span id="list-all-info-when-no-options-provided"></span><h3>List all info when no options provided<a class="headerlink" href="#list-all-info-when-no-options-provided" title="Permalink to this headline"></a></h3> <span id="list-all-threads-info-when-no-options-provided"></span><h3>List all threads info when no options provided<a class="headerlink" href="#list-all-threads-info-when-no-options-provided" title="Permalink to this headline"></a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ thread <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ thread
Threads Total: <span class="m">16</span>, NEW: <span class="m">0</span>, RUNNABLE: <span class="m">7</span>, BLOCKED: <span class="m">0</span>, WAITING: <span class="m">5</span>, TIMED_WAITING: <span class="m">4</span>, TERMINATED: <span class="m">0</span> Threads Total: <span class="m">16</span>, NEW: <span class="m">0</span>, RUNNABLE: <span class="m">7</span>, BLOCKED: <span class="m">0</span>, WAITING: <span class="m">5</span>, TIMED_WAITING: <span class="m">4</span>, TERMINATED: <span class="m">0</span>
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTE DAEMON ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTE DAEMON
@ -291,8 +289,8 @@ ID NAME GROUP PRIORITY STA
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="thread-thread-id-present-the-specified-thread-profile"> <div class="section" id="thread-id-show-the-running-stack-for-the-target-thread">
<span id="thread-thread-id-present-the-specified-thread-profile"></span><h3>thread &lt;thread_id&gt; present the specified thread profile<a class="headerlink" href="#thread-thread-id-present-the-specified-thread-profile" title="Permalink to this headline"></a></h3> <span id="thread-id-show-the-running-stack-for-the-target-thread"></span><h3>thread id, show the running stack for the target thread<a class="headerlink" href="#thread-id-show-the-running-stack-for-the-target-thread" title="Permalink to this headline"></a></h3>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ thread <span class="m">1</span> <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ thread <span class="m">1</span>
<span class="s2">&quot;main&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">1</span> WAITING on java.util.concurrent.CountDownLatch<span class="nv">$Sync</span>@29fafb28 <span class="s2">&quot;main&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">1</span> WAITING on java.util.concurrent.CountDownLatch<span class="nv">$Sync</span>@29fafb28
at sun.misc.Unsafe.park<span class="o">(</span>Native Method<span class="o">)</span> at sun.misc.Unsafe.park<span class="o">(</span>Native Method<span class="o">)</span>
@ -305,9 +303,9 @@ ID NAME GROUP PRIORITY STA
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="thread-b-locate-the-blocking-threads"> <div class="section" id="thread-b-locate-the-thread-bocking-the-others">
<span id="thread-b-locate-the-blocking-threads"></span><h3>thread -b locate the blocking threads<a class="headerlink" href="#thread-b-locate-the-blocking-threads" title="Permalink to this headline"></a></h3> <span id="thread-b-locate-the-thread-bocking-the-others"></span><h3>thread -b, locate the thread bocking the others<a class="headerlink" href="#thread-b-locate-the-thread-bocking-the-others" title="Permalink to this headline"></a></h3>
<p>Using <code class="docutils literal notranslate"><span class="pre">-b</span></code>, we can effectively locate the threads holding locks blocking other threads resulting in a frozen system.</p> <p>In some occasions, we experience the whole application is stuck because theres one particular thread hold one lock that other threads are relying on. To diagnose such an issue, Arthas provides <code class="docutils literal notranslate"><span class="pre">thread</span> <span class="pre">-b</span></code> to find the problematic thread in one single command.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ thread -b <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ thread -b
<span class="s2">&quot;http-bio-8080-exec-4&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">27</span> TIMED_WAITING <span class="s2">&quot;http-bio-8080-exec-4&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">27</span> TIMED_WAITING
at java.lang.Thread.sleep<span class="o">(</span>Native Method<span class="o">)</span> at java.lang.Thread.sleep<span class="o">(</span>Native Method<span class="o">)</span>
@ -346,10 +344,11 @@ ID NAME GROUP PRIORITY STA
- java.util.concurrent.ThreadPoolExecutor<span class="nv">$Worker</span>@31a6493e - java.util.concurrent.ThreadPoolExecutor<span class="nv">$Worker</span>@31a6493e
</pre></div> </pre></div>
</div> </div>
<p>Attention: only <code class="docutils literal notranslate"><span class="pre">synchronized</span></code> blocked threads can be located for now, while <code class="docutils literal notranslate"><span class="pre">java.util.concurrent.Lock</span></code> not supported yet.</p> <blockquote>
<div>Note: By now Arthas only supports to locate the thread blocked by <code class="docutils literal notranslate"><span class="pre">synchronzied</span></code>, while <code class="docutils literal notranslate"><span class="pre">java.util.concurrent.Lock</span></code> is not supported yet.</div></blockquote>
</div> </div>
<div class="section" id="thread-i-specify-the-collecting-interval"> <div class="section" id="thread-i-specify-the-sampling-interval">
<span id="thread-i-specify-the-collecting-interval"></span><h3>thread -i specify the collecting interval<a class="headerlink" href="#thread-i-specify-the-collecting-interval" title="Permalink to this headline"></a></h3> <span id="thread-i-specify-the-sampling-interval"></span><h3>thread -i, specify the sampling interval<a class="headerlink" href="#thread-i-specify-the-sampling-interval" title="Permalink to this headline"></a></h3>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ thread -n <span class="m">3</span> -i <span class="m">1000</span> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ thread -n <span class="m">3</span> -i <span class="m">1000</span>
<span class="s2">&quot;as-command-execute-daemon&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">4759</span> <span class="nv">cpuUsage</span><span class="o">=</span><span class="m">23</span>% RUNNABLE <span class="s2">&quot;as-command-execute-daemon&quot;</span> <span class="nv">Id</span><span class="o">=</span><span class="m">4759</span> <span class="nv">cpuUsage</span><span class="o">=</span><span class="m">23</span>% RUNNABLE
at sun.management.ThreadImpl.dumpThreads0<span class="o">(</span>Native Method<span class="o">)</span> at sun.management.ThreadImpl.dumpThreads0<span class="o">(</span>Native Method<span class="o">)</span>

@ -107,26 +107,22 @@
<li class="toctree-l2"><a class="reference internal" href="monitor.html">monitor</a></li> <li class="toctree-l2"><a class="reference internal" href="monitor.html">monitor</a></li>
<li class="toctree-l2"><a class="reference internal" href="watch.html">watch</a></li> <li class="toctree-l2"><a class="reference internal" href="watch.html">watch</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">trace</a><ul> <li class="toctree-l2 current"><a class="current reference internal" href="#">trace</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a><ul> <li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li>
<li class="toctree-l4"><a class="reference internal" href="advice-class.html">Critical fields in expression</a></li> <li class="toctree-l3"><a class="reference internal" href="#notice">Notice</a></li>
<li class="toctree-l4"><a class="reference external" href="https://github.com/alibaba/arthas/issues/71">Special usage</a></li>
<li class="toctree-l4"><a class="reference external" href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li> <li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>
@ -197,7 +193,9 @@
<div class="section" id="trace"> <div class="section" id="trace">
<span id="trace"></span><h1>trace<a class="headerlink" href="#trace" title="Permalink to this headline"></a></h1> <span id="trace"></span><h1>trace<a class="headerlink" href="#trace" title="Permalink to this headline"></a></h1>
<p>Track methods calling stack trace and print the time cost in each call.</p> <blockquote>
<div>Trace method calling path, and output the time cost for each node in the path.</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">trace</span></code> can track the calling path specified by <code class="docutils literal notranslate"><span class="pre">class-pattern</span></code> / <code class="docutils literal notranslate"><span class="pre">method-pattern</span></code>, and calculate the time cost on the whole path.</p>
<div class="section" id="parameters"> <div class="section" id="parameters">
<span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2> <span id="parameters"></span><h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils"> <table border="1" class="docutils">
@ -221,41 +219,41 @@
<td align="left">condition expression</td> <td align="left">condition expression</td>
</tr> </tr>
<tr> <tr>
<td align="right">[E]</td> <td align="right"><code>[E]</code></td>
<td align="left">turn on regx matching while the default is wildcards matching</td> <td align="left">enable regex match, the default behavior is wildcards match</td>
</tr> </tr>
<tr> <tr>
<td align="right">[n:]</td> <td align="right"><code>[n:]</code></td>
<td align="left">calling times</td> <td align="left">execution times</td>
</tr> </tr>
<tr> <tr>
<td align="right">#cost</td> <td align="right">#cost</td>
<td align="left">time cost</td> <td align="left">time cost</td>
</tr> </tr>
</tbody> </tbody>
</table><p>F.Y.I</p> </table><p>Theres one thing worthy noting here is observation expression. The observation expression supports OGNL grammar, for example, you can come up a expression like this <code class="docutils literal notranslate"><span class="pre">&quot;{params,returnObj}&quot;</span></code>. All OGNL expressions are supported as long as they are legal to the grammar.</p>
<ol class="simple"> <p>Thanks for <code class="docutils literal notranslate"><span class="pre">advice</span></code>s data structure, it is possible to observe from varieties of different angles. Inside <code class="docutils literal notranslate"><span class="pre">advice</span></code> parameter, all necessary information for notification can be found.</p>
<li>any valid OGNL expression as <code class="docutils literal notranslate"><span class="pre">&quot;{params,returnObj}&quot;</span></code> supported;</li> <p>Pls. refer to <a class="reference internal" href="advice-class.html"><span class="doc">core parameters in expression</span></a> for more details.</p>
<li>filter by time cost as <code class="docutils literal notranslate"><span class="pre">trace</span> <span class="pre">*StringUtils</span> <span class="pre">isBlank</span> <span class="pre">'#cost&gt;100'</span></code>; calling stack with only time cost higher than <code class="docutils literal notranslate"><span class="pre">100ms</span></code> will be printed.</li> <ul class="simple">
</ol> <li>Pls. also refer to <a class="reference external" href="https://github.com/alibaba/arthas/issues/71">https://github.com/alibaba/arthas/issues/71</a> for more advanced usage</li>
<p>Attention:</p> <li>OGNL official site: <a class="reference external" href="https://commons.apache.org/proper/commons-ognl/language-guide.html">https://commons.apache.org/proper/commons-ognl/language-guide.html</a></li>
</ul>
<p>Many times what we are interested is the exact trace result when the method call takes time over one particular period. It is possible to achieve this in Arthas, for example: <code class="docutils literal notranslate"><span class="pre">trace</span> <span class="pre">*StringUtils</span> <span class="pre">isBlank</span> <span class="pre">'$cost&gt;100'</span></code> means trace result will only be output when the executing time exceeds 100ms.</p>
<blockquote>
<div><p>Notes:</p>
<ol class="simple"> <ol class="simple">
<li><code class="docutils literal notranslate"><span class="pre">#cost</span></code> can be used in <code class="docutils literal notranslate"><span class="pre">watch/stack/trace</span></code>;</li> <li><code class="docutils literal notranslate"><span class="pre">watch</span></code>/<code class="docutils literal notranslate"><span class="pre">stack</span></code>/<code class="docutils literal notranslate"><span class="pre">trace</span></code>, these three commands all support <code class="docutils literal notranslate"><span class="pre">$cost</span></code>.</li>
<li>using <code class="docutils literal notranslate"><span class="pre">#cost</span></code> in Arthas 3.0 instead of <code class="docutils literal notranslate"><span class="pre">$cost</span></code>.</li> <li>On version <code class="docutils literal notranslate"><span class="pre">3.0</span></code>, pls. use <code class="docutils literal notranslate"><span class="pre">#cost</span></code> instead of <code class="docutils literal notranslate"><span class="pre">$cost</span></code>.</li>
<li><code class="docutils literal notranslate"><span class="pre">trace</span></code> can help to locate the performance lurking issue but only <code class="docutils literal notranslate"><span class="pre">level-one</span></code> method invoking considered.</li>
</ol> </ol>
<p>Advanced:</p> </div></blockquote>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="advice-class.html">Critical fields in expression</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues/71">Special usage</a></li>
<li class="toctree-l1"><a class="reference external" href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
</ul>
</div> </div>
<div class="section" id="notice">
<span id="notice"></span><h2>Notice<a class="headerlink" href="#notice" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">trace</span></code> is handy to help discovering and locating the performance flaws in your system, but pls. note Arthas can only trace the first level method call each time.</p>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2> <span id="usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>A demo:</p> <p>Sample code:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span> <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span> <div class="highlight-java notranslate"><div class="highlight"><pre><span></span> <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
<span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">list</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;();</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">list</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;();</span>
<span class="n">list</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;a&quot;</span><span class="o">);</span> <span class="n">list</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;a&quot;</span><span class="o">);</span>
@ -290,7 +288,7 @@
<span class="o">}</span> <span class="o">}</span>
</pre></div> </pre></div>
</div> </div>
<p>Tracing down method <code class="docutils literal notranslate"><span class="pre">add</span></code>:</p> <p>Trace down method <code class="docutils literal notranslate"><span class="pre">add</span></code>:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList add params.length<span class="o">==</span><span class="m">2</span> <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList add params.length<span class="o">==</span><span class="m">2</span>
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">144</span> ms. Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">144</span> ms.
@ -302,7 +300,7 @@ Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span>
<span class="sb">`</span>---<span class="o">[</span>0ms<span class="o">]</span>java.util.List:size<span class="o">()</span> <span class="sb">`</span>---<span class="o">[</span>0ms<span class="o">]</span>java.util.List:size<span class="o">()</span>
</pre></div> </pre></div>
</div> </div>
<p>Filtering by time cost:</p> <p>Filter by time cost:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList execute <span class="c1">#cost&gt;4</span> <div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList execute <span class="c1">#cost&gt;4</span>
Press Ctrl+C to abort. Press Ctrl+C to abort.
Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">159</span> ms. Affect<span class="o">(</span>class-cnt:1 , method-cnt:1<span class="o">)</span> cost in <span class="m">159</span> ms.
@ -316,14 +314,14 @@ trace com.alibaba.sample.petstore.web.store.module.screen.ItemList execute <span
<span class="sb">`</span>---<span class="o">[</span><span class="nv">min</span><span class="o">=</span><span class="m">0</span>.005428ms,max<span class="o">=</span><span class="m">0</span>.094064ms,total<span class="o">=</span><span class="m">0</span>.105228ms,count<span class="o">=</span><span class="m">3</span><span class="o">]</span> com.alibaba.citrus.turbine.Context:put<span class="o">()</span> <span class="sb">`</span>---<span class="o">[</span><span class="nv">min</span><span class="o">=</span><span class="m">0</span>.005428ms,max<span class="o">=</span><span class="m">0</span>.094064ms,total<span class="o">=</span><span class="m">0</span>.105228ms,count<span class="o">=</span><span class="m">3</span><span class="o">]</span> com.alibaba.citrus.turbine.Context:put<span class="o">()</span>
</pre></div> </pre></div>
</div> </div>
<p>Only the calling trace of the time cost higher than <code class="docutils literal notranslate"><span class="pre">4ms</span></code> presented now.</p> <blockquote>
<p>F.Y.I</p> <div>Only the call path whichs time cost is higher than <code class="docutils literal notranslate"><span class="pre">4ms</span></code> will be shown. This feature is handy to focus on whats needed to focus when troubleshoot.</div></blockquote>
<ol class="simple"> <ul class="simple">
<li>like JProfile and other similar commercial software, you can <code class="docutils literal notranslate"><span class="pre">trace</span></code> down the specified method calling stack with time cost in Arthas;</li> <li>Here Arthas provides the similar functionality JProfile and other commercial software provide. Compared to these professional softwares, Arthas doesnt deduce the time cost <code class="docutils literal notranslate"><span class="pre">trace</span></code> itself takes, therefore it is not as accurate as these softwares offer. More classes and methods on the calling path, more inaccurate <code class="docutils literal notranslate"><span class="pre">trace</span></code> output is, but it is still helpful for diagnostics where the bottleneck is.</li>
<li>there will be some overhead using <code class="docutils literal notranslate"><span class="pre">trace</span></code> but not much;</li> <li>“[2.847106ms] com.alibaba.sample.petstore.biz.StoreManager:getAllProductItems()” means “getAllProductItem()” method from “com.alibaba.sample.petstore.biz.StoreManager” takes <code class="docutils literal notranslate"><span class="pre">2.847106</span></code> ms.</li>
<li>the time cost is an instructive clue for troubleshooting, which means its not that accurate ignoring the cost it itself causes; the deeper or more the call is, the worse accuracy the time cost will be;</li> <li>“[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] com.alibaba.citrus.turbine.Context:put()” means aggregating all same method calls into one single line. The minimum time cost is <code class="docutils literal notranslate"><span class="pre">0.005428</span></code> ms, the maximum time cost is <code class="docutils literal notranslate"><span class="pre">0.094064</span></code> ms, and the total time cost for all method calls (<code class="docutils literal notranslate"><span class="pre">3</span></code> times in total) to “com.alibaba.citrus.turbine.Context:put()” is <code class="docutils literal notranslate"><span class="pre">0.105228ms</span></code>. If “throws Exception” appears in this line, it means some exceptions have been thrown from this method calls.</li>
<li><code class="docutils literal notranslate"><span class="pre">[0,0,0ms,11]xxx:yyy()</span> <span class="pre">[throws</span> <span class="pre">Exception]</span></code>the same method calling aggregated into one line here while <code class="docutils literal notranslate"><span class="pre">throws</span> <span class="pre">Exception</span></code> indicates there is an exception.</li> <li>The total time cost may not equal to the sum of the time costs each sub method call takes, this is because Arthas instrumented code takes time too.</li>
</ol> </ul>
</div> </div>
</div> </div>

@ -125,14 +125,14 @@
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -129,14 +129,14 @@
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li> <li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li> <li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li> <li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-commands">Basic Commands</a></li> <li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

@ -108,10 +108,10 @@
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
</ul> </ul>

Loading…
Cancel
Save