* [sm](sm.md) - check methods info for the loaded classes
* [dump](dump.md) - dump the loaded classes in byte code to the specified location
* [redefine](redefine.md) - load external `*.class` files and re-define it into JVM
* [jad](jad.md) - de-compile the specified loaded classes
* [jad](jad.md) - decompile the specified loaded classes
* [classloader](classloader.md) - check the inheritance structure, urls, class loading info for the specified class; using classloader to get the url of the resource e.g. `java/lang/String.class`
* It is recommended to use the [OGNL] (ognl.md) command, which will be more flexibility.
Check the static fields of classes conveniently, the usage is `getstatic class_name field_name`.
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.
```bash
$ getstatic demo.MathGame random
field: random
@Random[
serialVersionUID=@Long[3905348978240129619],
seed=@AtomicLong[120955813885284],
multiplier=@Long[25214903917],
addend=@Long[11],
mask=@Long[281474976710655],
DOUBLE_UNIT=@Double[1.1102230246251565E-16],
BadBound=@String[bound must be positive],
BadRange=@String[bound must be greater than origin],
Tip: if the static field is a complex class, you can even use [`OGNL`](https://commons.apache.org/proper/commons-ognl/language-guide.html) to traverse, filter and access the inner properties of this class.
* [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html)
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
curl -L https://alibaba.github.io/arthas/install.sh | sh
$ curl -L https://alibaba.github.io/arthas/install.sh | sh
```
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`.
@ -40,13 +40,13 @@ Latest Version, Click To Download: [![Arthas](https://img.shields.io/maven-centr
Download and unzip, find `arthas-boot.jar` in the directory. Start with `java` command:
```bash
java -jar arthas-boot.jar
$ java -jar arthas-boot.jar
```
Print usage:
```bash
java -jar arthas-boot.jar -h
$ java -jar arthas-boot.jar -h
```
## Manual Installation
@ -64,7 +64,7 @@ Latest Version, Click To Download:[![Arthas](https://img.shields.io/maven-centra
* On Linux/Unix/Mac, delete the files with the following command:
```bash
rm -rf ~/.arthas/
$ rm -rf ~/.arthas/
```
* On Windows, delete `.arthas` directory under user home.
`jad` helps to de-compile the byte code running in JVM to the source code to assist you to understand the logic behind better.
`jad` helps to decompile the byte code running in JVM to the source code to assist you to understand the logic behind better.
* The de-compiled code is syntax highlighted for better readability in Arthas console.
* It is possible that there's grammar error in the de-compiled code, but it should not affect your interpretation.
* The decompiled code is syntax highlighted for better readability in Arthas console.
* It is possible that there's grammar error in the decompiled code, but it should not affect your interpretation.
### Options
@ -18,19 +18,78 @@ jad
### Usage
> 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.
#### Decompile `java.lang.String`
```java
$ jad java.lang.String
ClassLoader:
Location:
/*
* Decompiled with CFR 0_132.
*/
package java.lang;
import java.io.ObjectStreamField;
...
public final class String
implements Serializable,
Comparable<String>,
CharSequence {
private final char[] value;
private int hash;
private static final long serialVersionUID = -6849794470754667710L;
private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];
public static final Comparator<String> CASE_INSENSITIVE_ORDER = new CaseInsensitiveComparator();
public String(byte[] arrby, int n, int n2) {
String.checkBounds(arrby, n, n2);
this.value = StringCoding.decode(arrby, n, n2);
}
...
```
#### Decompile the specified method
```java
$ jad demo.MathGame main
ClassLoader:
+-sun.misc.Launcher$AppClassLoader@3d4eac69
+-sun.misc.Launcher$ExtClassLoader@66350f69
Location:
/private/tmp/arthas-demo.jar
public static void main(String[] args) throws InterruptedException {
MathGame game = new MathGame();
do {
game.run();
TimeUnit.SECONDS.sleep(1L);
} while (true);
}
Affect(row-cnt:1) cost in 228 ms.
```
#### Decompile with specified classLoader
> 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 decompile the target class from the specified classloader.
```java
$ jad org.apache.log4j.Logger
Found more than one class for: org.apache.log4j.Logger, Please use jad -c hashcode org.apache.log4j.Logger
* The user to run this command *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 && java -jar arthas-boot.jar` or `sudo -u admin -EH java -jar arthas-boot.jar`
Monitor methods in data aspect including `return values`, `exceptions` and `parameters`.
With the help of [OGNL](https://en.wikipedia.org/wiki/OGNL), you can easily check the details of variables when methods being invoked.
With the help of [OGNL](https://commons.apache.org/proper/commons-ognl/index.html), you can easily check the details of variables when methods being invoked.
### Parameters & Options
@ -37,264 +37,196 @@ Advanced:
### Usage
A demo:
Start `arthas-demo` in [Quick Start](quick-start.md).
```java
public void execute() {
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
List<String> list2 = new ArrayList<String>();
list2.add("c");
list2.add("d");
int len = add(list, list2);
}
private static int add(List<String> list, List<String> list2) {
list.addAll(list2);
return list.size();
}
```
#### Check the `out parameters` and `return value`
<li><aclass="reference internal"href="sm.html"><spanclass="doc">sm</span></a> - check methods info for the loaded classes</li>
<li><aclass="reference internal"href="dump.html"><spanclass="doc">dump</span></a> - dump the loaded classes in byte code to the specified location</li>
<li><aclass="reference internal"href="redefine.html"><spanclass="doc">redefine</span></a> - load external <codeclass="docutils literal notranslate"><spanclass="pre">*.class</span></code> files and re-define it into JVM</li>
<li><aclass="reference internal"href="jad.html"><spanclass="doc">jad</span></a> - de-compile the specified loaded classes</li>
<li><aclass="reference internal"href="jad.html"><spanclass="doc">jad</span></a> - decompile the specified loaded classes</li>
<li><aclass="reference internal"href="classloader.html"><spanclass="doc">classloader</span></a> - check the inheritance structure, urls, class loading info for the specified class; using classloader to get the url of the resource e.g. <codeclass="docutils literal notranslate"><spanclass="pre">java/lang/String.class</span></code></li>
<spanid="view-statistics-categorized-by-class-type"></span><h3>View statistics categorized by class type<aclass="headerlink"href="#view-statistics-categorized-by-class-type"title="Permalink to this headline">¶</a></h3>
<spanid="view-statistics-categorized-by-loaded-classes-number"></span><h3>View statistics categorized by loaded classes number<aclass="headerlink"href="#view-statistics-categorized-by-loaded-classes-number"title="Permalink to this headline">¶</a></h3>
<spanid="view-class-loaders-hierarchy"></span><h3>View class-loaders hierarchy<aclass="headerlink"href="#view-class-loaders-hierarchy"title="Permalink to this headline">¶</a></h3>
<spanid="show-the-urls-of-the-urlclassloader"></span><h3>Show the URLs of the URLClassLoader<aclass="headerlink"href="#show-the-urls-of-the-urlclassloader"title="Permalink to this headline">¶</a></h3>
<spanid="use-the-classloader-to-load-resource"></span><h3>Use the classloader to load resource<aclass="headerlink"href="#use-the-classloader-to-load-resource"title="Permalink to this headline">¶</a></h3>
<spanid="use-the-classloader-to-load-class"></span><h3>Use the classloader to load class<aclass="headerlink"href="#use-the-classloader-to-load-class"title="Permalink to this headline">¶</a></h3>
<liclass="toctree-l3"><aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
<spanid="getstatic"></span><h1>getstatic<aclass="headerlink"href="#getstatic"title="Permalink to this headline">¶</a></h1>
<ulclass="simple">
<li>It is recommended to use the [OGNL] (ognl.md) command, which will be more flexibility.</li>
</ul>
<p>Check the static fields of classes conveniently, the usage is <codeclass="docutils literal notranslate"><spanclass="pre">getstatic</span><spanclass="pre">class_name</span><spanclass="pre">field_name</span></code>.</p>
<p>Tip: if the static field is a complex class, you can even use <aclass="reference external"href="https://en.wikipedia.org/wiki/OGNL"><codeclass="docutils literal notranslate"><spanclass="pre">OGNL</span></code></a> to traverse, filter and access the inner properties of this class.</p>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>$ getstatic demo.MathGame random
<p>Tip: if the static field is a complex class, you can even use <aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/language-guide.html"><codeclass="docutils literal notranslate"><spanclass="pre">OGNL</span></code></a> to traverse, filter and access the inner properties of this class.</p>
<divclass="toctree-wrapper compound">
<ul>
<liclass="toctree-l1"><aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
<p>E.g. suppose <codeclass="docutils literal notranslate"><spanclass="pre">n</span></code> is a <codeclass="docutils literal notranslate"><spanclass="pre">Map</span></code> and its key is a <codeclass="docutils literal notranslate"><spanclass="pre">Enum</span></code>, then you can achieve this if you want to pick the key with a specific <codeclass="docutils literal notranslate"><spanclass="pre">Enum</span></code> value:</p>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>$ getstatic com.alibaba.arthas.Test n <spanclass="s1">'entrySet().iterator.{? #this.key.name()=="STOP"}'</span>
<spanid="install-arthas"></span><h1>Install Arthas<aclass="headerlink"href="#install-arthas"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="quick-installation">
<spanid="quick-installation"></span><h2>Quick installation<aclass="headerlink"href="#quick-installation"title="Permalink to this headline">¶</a></h2>
<divclass="section"id="use-arthas-boot">
<spanid="use-arthas-boot"></span><h3>Use <codeclass="docutils literal notranslate"><spanclass="pre">arthas-boot</span></code><aclass="headerlink"href="#use-arthas-boot" title="Permalink to this headline">¶</a></h3>
<spanid="use-arthas-boot-recommend"></span><h3>Use <codeclass="docutils literal notranslate"><spanclass="pre">arthas-boot</span></code>(Recommend)<aclass="headerlink"href="#use-arthas-boot-recommend" title="Permalink to this headline">¶</a></h3>
<p>Download<codeclass="docutils literal notranslate"><spanclass="pre">arthas-boot.jar</span></code>,Start with <codeclass="docutils literal notranslate"><spanclass="pre">java</span></code> command:</p>
<spanid="use-as-sh"></span><h3>Use <codeclass="docutils literal notranslate"><spanclass="pre">as.sh</span></code><aclass="headerlink"href="#use-as-sh"title="Permalink to this headline">¶</a></h3>
<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>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <spanclass="p">|</span> sh
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>$ curl -L https://alibaba.github.io/arthas/install.sh <spanclass="p">|</span> sh
</pre></div>
</div>
<p>The command above will download the bootstrap script <codeclass="docutils literal notranslate"><spanclass="pre">as.sh</span></code> to the current directory. You can move it the any other place you want, or put its location in <codeclass="docutils literal notranslate"><spanclass="pre">$PATH</span></code>.</p>
@ -205,11 +205,11 @@ java -jar arthas-boot.jar
<spanid="full-installation"></span><h2>Full installation<aclass="headerlink"href="#full-installation"title="Permalink to this headline">¶</a></h2>
<p>Latest Version, Click To Download: <aclass="reference external"href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST"><imgalt="Arthas"src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square"/></a></p>
<p>Download and unzip, find <codeclass="docutils literal notranslate"><spanclass="pre">arthas-boot.jar</span></code> in the directory. Start with <codeclass="docutils literal notranslate"><spanclass="pre">java</span></code> command:</p>
<spanid="jad"></span><h1>jad<aclass="headerlink"href="#jad"title="Permalink to this headline">¶</a></h1>
<blockquote>
<div>De-compile the specified classes.</div></blockquote>
<p><codeclass="docutils literal notranslate"><spanclass="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>
<div>Decompile the specified classes.</div></blockquote>
<p><codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code> helps to decompile the byte code running in JVM to the source code to assist you to understand the logic behind better.</p>
<ulclass="simple">
<li>The de-compiled code is syntax highlighted for better readability in Arthas console.</li>
<li>It is possible that there’s grammar error in the de-compiled code, but it should not affect your interpretation.</li>
<li>The decompiled code is syntax highlighted for better readability in Arthas console.</li>
<li>It is possible that there’s grammar error in the decompiled code, but it should not affect your interpretation.</li>
</ul>
<divclass="section"id="options">
<spanid="options"></span><h2>Options<aclass="headerlink"href="#options"title="Permalink to this headline">¶</a></h2>
@ -227,18 +232,76 @@
</table></div>
<divclass="section"id="usage">
<spanid="usage"></span><h2>Usage<aclass="headerlink"href="#usage"title="Permalink to this headline">¶</a></h2>
<spanid="decompile-java-lang-string"></span><h3>Decompile <codeclass="docutils literal notranslate"><spanclass="pre">java.lang.String</span></code><aclass="headerlink"href="#decompile-java-lang-string"title="Permalink to this headline">¶</a></h3>
<spanid="decompile-the-specified-method"></span><h3>Decompile the specified method<aclass="headerlink"href="#decompile-the-specified-method"title="Permalink to this headline">¶</a></h3>
<divclass="highlight-java notranslate"><divclass="highlight"><pre><span></span>$ jad demo.MathGame main
ClassLoader:
+-sun.misc.Launcher$AppClassLoader@3d4eac69
+-sun.misc.Launcher$ExtClassLoader@66350f69
Location:
/private/tmp/arthas-demo.jar
public static void main(String[] args) throws InterruptedException {
<spanid="decompile-with-specified-classloader"></span><h3>Decompile with specified classLoader<aclass="headerlink"href="#decompile-with-specified-classloader"title="Permalink to this headline">¶</a></h3>
<blockquote>
<div>If the target class is loaded by multiple classloaders, <codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code> outputs the <codeclass="docutils literal notranslate"><spanclass="pre">hashcode</span></code> of the corresponding classloaders, then you can re-run <codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code> and specify <codeclass="docutils literal notranslate"><spanclass="pre">-c</span><spanclass="pre"><hashcode></span></code> to de-compile the target class from the specified classloader.</div></blockquote>
<div>If the target class is loaded by multiple classloaders, <codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code> outputs the <codeclass="docutils literal notranslate"><spanclass="pre">hashcode</span></code> of the corresponding classloaders, then you can re-run <codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code> and specify <codeclass="docutils literal notranslate"><spanclass="pre">-c</span><spanclass="pre"><hashcode></span></code> to decompile the target class from the specified classloader.</div></blockquote>
HashMap<String, Object><spanclass="nv">result</span><spanclass="o">=</span> new HashMap<String, Object><spanclass="o">()</span><spanclass="p">;</span>
HashMap<String, Object><spanclass="nv">metricMap</span><spanclass="o">=</span> new HashMap<String, Object><spanclass="o">()</span><spanclass="p">;</span>
<liclass="toctree-l2"><aclass="reference internal"href="#check-the-dashboard">3. Check the Dashboard</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="#get-the-main-class-of-the-process-with-the-sysenv-command">4. Get the Main Class of the process with the sysenv command</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="#get-the-main-class-of-the-process-with-the-thread-command">4. Get the Main Class of the process with the thread command</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="#decompile-main-class-with-jad-command">5. Decompile Main Class with jad command</a></li>
<spanid="quick-start"></span><h1>Quick Start<aclass="headerlink"href="#quick-start"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="start-demo-application">
<spanid="start-demo-application"></span><h2>1. Start Demo Application<aclass="headerlink"href="#start-demo-application"title="Permalink to this headline">¶</a></h2>
<p><codeclass="docutils literal notranslate"><spanclass="pre">arthas-demo</span></code> is a simple program that generates a random number every second, then find all prime factors of the number.</p>
@ -192,8 +192,8 @@ java -jar arthas-demo.jar
<divclass="section"id="linux-unix-mac">
<spanid="linux-unix-mac"></span><h3>Linux/Unix/Mac<aclass="headerlink"href="#linux-unix-mac"title="Permalink to this headline">¶</a></h3>
<p>Execute the following command in the command line:</p>
<spanid="get-the-main-class-of-the-process-with-the-sysenv-command"></span><h2>4. Get the Main Class of the process with the sysenv command<aclass="headerlink"href="#get-the-main-class-of-the-process-with-the-sysenv-command" title="Permalink to this headline">¶</a></h2>
<divclass="highlight-default notranslate"><divclass="highlight"><pre><span></span>$ sysenv | grep MAIN
<spanid="get-the-main-class-of-the-process-with-the-thread-command"></span><h2>4. Get the Main Class of the process with the thread command<aclass="headerlink"href="#get-the-main-class-of-the-process-with-the-thread-command" title="Permalink to this headline">¶</a></h2>
<spanid="v2016-01-18"></span><h2>v2016-01-18<aclass="headerlink"href="#v2016-01-18"title="Permalink to this headline">¶</a></h2>
<ulclass="simple">
<li>[improvement] optimise <aclass="reference external"href="jad.md"><codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code></a>; dump memory byte array in real time; using <codeclass="docutils literal notranslate"><spanclass="pre">jd-core-java</span></code> to de-compile; line number presented;</li>
<li>[improvement] optimise <aclass="reference external"href="jad.md"><codeclass="docutils literal notranslate"><spanclass="pre">jad</span></code></a>; dump memory byte array in real time; using <codeclass="docutils literal notranslate"><spanclass="pre">jd-core-java</span></code> to decompile; line number presented;</li>
<li>[bug] fix checking/re-producing issues when <aclass="reference external"href="tt.md"><codeclass="docutils literal notranslate"><spanclass="pre">tt</span></code></a> is watching thread-context related methods invoking</li>
<spanid="usage"></span><h2>Usage<aclass="headerlink"href="#usage"title="Permalink to this headline">¶</a></h2>
<p>For example, use <codeclass="docutils literal notranslate"><spanclass="pre">sc</span><spanclass="pre">-df</span><spanclass="pre">class-name</span></code> to view class’s static fields:</p>
<liclass="toctree-l4"><aclass="reference internal"href="#use-x-to-check-more-details">Use <codeclass="docutils literal notranslate"><spanclass="pre">-x</span></code> to check more details</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#use-condition-expressions-to-locate-specific-call">Use condition expressions to locate specific call</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#filter-based-on-time-cost">Filter based on time cost</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#check-the-global-properties-of-the-target-object">Check the global properties of the target object</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#filter-by-time-cost">Filter by time cost</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#check-the-field-of-the-target-object">Check the field of the target object</a></li>
</ul>
</li>
</ul>
@ -210,7 +210,7 @@
<divclass="section"id="watch">
<spanid="watch"></span><h1>watch<aclass="headerlink"href="#watch"title="Permalink to this headline">¶</a></h1>
<p>Monitor methods in data aspect including <codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">values</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">exceptions</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">parameters</span></code>.</p>
<p>With the help of <aclass="reference external"href="https://en.wikipedia.org/wiki/OGNL">OGNL</a>, you can easily check the details of variables when methods being invoked.</p>
<p>With the help of <aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/index.html">OGNL</a>, you can easily check the details of variables when methods being invoked.</p>
<divclass="section"id="parameters-options">
<spanid="parameters-options"></span><h2>Parameters & Options<aclass="headerlink"href="#parameters-options"title="Permalink to this headline">¶</a></h2>
<p>There are four different scenarios for <codeclass="docutils literal notranslate"><spanclass="pre">watch</span></code> command, which makes it rather complicated.</p>
@ -282,260 +282,197 @@
</div>
<divclass="section"id="usage">
<spanid="usage"></span><h2>Usage<aclass="headerlink"href="#usage"title="Permalink to this headline">¶</a></h2>
<spanid="check-the-out-parameters-and-return-value"></span><h3>Check the <codeclass="docutils literal notranslate"><spanclass="pre">out</span><spanclass="pre">parameters</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">value</span></code><aclass="headerlink"href="#check-the-out-parameters-and-return-value"title="Permalink to this headline">¶</a></h3>
<spanid="check-in-parameters"></span><h3>Check <codeclass="docutils literal notranslate"><spanclass="pre">in</span><spanclass="pre">parameters</span></code><aclass="headerlink"href="#check-in-parameters"title="Permalink to this headline">¶</a></h3>
<p>Compared to the previous <em>check</em>, there are two differences:</p>
<olclass="simple">
<li>size of <codeclass="docutils literal notranslate"><spanclass="pre">params[0]</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code> instead of <codeclass="docutils literal notranslate"><spanclass="pre">4</span></code>;</li>
<p>Compared to the previous <em>check</em>:</p>
<ulclass="simple">
<li><codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">value</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">null</span></code> since it’s <codeclass="docutils literal notranslate"><spanclass="pre">-b</span></code>.</li>
<spanid="check-before-and-after-at-the-same-time"></span><h3>Check <em>before</em> and <em>after</em> at the same time<aclass="headerlink"href="#check-before-and-after-at-the-same-time"title="Permalink to this headline">¶</a></h3>
<li><codeclass="docutils literal notranslate"><spanclass="pre">-n</span><spanclass="pre">2</span></code>: threshold of execution times is 2.</li>
<li>the first block of output is the <em>before watching</em> point;</li>
<li>the order of the output determined by the <em>watching</em> order itself (nothing to do with the order of the options <codeclass="docutils literal notranslate"><spanclass="pre">-b</span><spanclass="pre">-s</span></code>).</li>
</ol>
<li>*the order of the output determined by the <em>watching</em> order itself (nothing to do with the order of the options <codeclass="docutils literal notranslate"><spanclass="pre">-b</span><spanclass="pre">-s</span></code>).</li>
<spanid="use-x-to-check-more-details"></span><h3>Use <codeclass="docutils literal notranslate"><spanclass="pre">-x</span></code> to check more details<aclass="headerlink"href="#use-x-to-check-more-details"title="Permalink to this headline">¶</a></h3>
<spanid="use-condition-expressions-to-locate-specific-call"></span><h3>Use condition expressions to locate specific call<aclass="headerlink"href="#use-condition-expressions-to-locate-specific-call"title="Permalink to this headline">¶</a></h3>
<spanid="check-exceptions"></span><h3>Check <codeclass="docutils literal notranslate"><spanclass="pre">exceptions</span></code><aclass="headerlink"href="#check-exceptions"title="Permalink to this headline">¶</a></h3>
at com.alibaba.sample.petstore.biz.impl.UserManagerImpl.testAdd<spanclass="o">(</span>UserManagerImpl.java:75<spanclass="o">)</span>
at com.alibaba.sample.petstore.biz.impl.UserManagerImpl.register<spanclass="o">(</span>UserManagerImpl.java:60<spanclass="o">)</span>
at com.alibaba.sample.petstore.web.user.module.action.RegisterAction.doRegister<spanclass="o">(</span>RegisterAction.java:45<spanclass="o">)</span>
at com.alibaba.sample.petstore.web.user.module.action.RegisterAction<spanclass="nv">$$</span>FastClassByCGLIB<spanclass="nv">$$</span>ad5428f1.invoke<spanclass="o">(</span><generated><spanclass="o">)</span>
at net.sf.cglib.reflect.FastMethod.invoke<spanclass="o">(</span>FastMethod.java:53<spanclass="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke<spanclass="o">(</span>MethodInvoker.java:70<spanclass="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.AbstractModuleEventAdapter.executeAndReturn<spanclass="o">(</span>AbstractModuleEventAdapter.java:100<spanclass="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.AbstractModuleEventAdapter.execute<spanclass="o">(</span>AbstractModuleEventAdapter.java:58<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke<spanclass="o">(</span>PerformActionValve.java:63<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invoke<spanclass="o">(</span>PipelineImpl.java:210<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.ChooseValve.invoke<spanclass="o">(</span>ChooseValve.java:98<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invoke<spanclass="o">(</span>PipelineImpl.java:210<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invokeBody<spanclass="o">(</span>LoopValve.java:105<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invoke<spanclass="o">(</span>LoopValve.java:83<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PageAuthorizationValve.invoke<spanclass="o">(</span>PageAuthorizationValve.java:105<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.CheckCsrfTokenValve.invoke<spanclass="o">(</span>CheckCsrfTokenValve.java:123<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.AnalyzeURLValve.invoke<spanclass="o">(</span>AnalyzeURLValve.java:126<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.SetLoggingContextValve.invoke<spanclass="o">(</span>SetLoggingContextValve.java:66<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PrepareForTurbineValve.invoke<spanclass="o">(</span>PrepareForTurbineValve.java:52<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invoke<spanclass="o">(</span>PipelineImpl.java:210<spanclass="o">)</span>
at com.alibaba.citrus.webx.impl.WebxControllerImpl.service<spanclass="o">(</span>WebxControllerImpl.java:43<spanclass="o">)</span>
at com.alibaba.citrus.webx.impl.WebxRootControllerImpl.handleRequest<spanclass="o">(</span>WebxRootControllerImpl.java:53<spanclass="o">)</span>
at com.alibaba.citrus.webx.support.AbstractWebxRootController.service<spanclass="o">(</span>AbstractWebxRootController.java:165<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.WebxFrameworkFilter.doFilter<spanclass="o">(</span>WebxFrameworkFilter.java:152<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.FilterBean.doFilter<spanclass="o">(</span>FilterBean.java:148<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter<spanclass="o">(</span>ApplicationFilterChain.java:241<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.doFilter<spanclass="o">(</span>ApplicationFilterChain.java:208<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.SetLoggingContextFilter.doFilter<spanclass="o">(</span>SetLoggingContextFilter.java:61<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.FilterBean.doFilter<spanclass="o">(</span>FilterBean.java:148<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter<spanclass="o">(</span>ApplicationFilterChain.java:241<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.doFilter<spanclass="o">(</span>ApplicationFilterChain.java:208<spanclass="o">)</span>
at org.apache.catalina.core.StandardWrapperValve.invoke<spanclass="o">(</span>StandardWrapperValve.java:220<spanclass="o">)</span>
at org.apache.catalina.core.StandardContextValve.invoke<spanclass="o">(</span>StandardContextValve.java:122<spanclass="o">)</span>
at com.taobao.tomcat.valves.ContextLoadFilterValve.invoke<spanclass="o">(</span>ContextLoadFilterValve.java:152<spanclass="o">)</span>
at org.apache.catalina.core.StandardHostValve.invoke<spanclass="o">(</span>StandardHostValve.java:170<spanclass="o">)</span>
at org.apache.catalina.valves.ErrorReportValve.invoke<spanclass="o">(</span>ErrorReportValve.java:103<spanclass="o">)</span>
at org.apache.catalina.core.StandardEngineValve.invoke<spanclass="o">(</span>StandardEngineValve.java:116<spanclass="o">)</span>
at org.apache.catalina.connector.CoyoteAdapter.service<spanclass="o">(</span>CoyoteAdapter.java:429<spanclass="o">)</span>
at org.apache.coyote.http11.AbstractHttp11Processor.process<spanclass="o">(</span>AbstractHttp11Processor.java:1085<spanclass="o">)</span>
at org.apache.coyote.AbstractProtocol<spanclass="nv">$AbstractConnectionHandler</span>.process<spanclass="o">(</span>AbstractProtocol.java:625<spanclass="o">)</span>
at org.apache.tomcat.util.net.NioEndpoint<spanclass="nv">$SocketProcessor</span>.doRun<spanclass="o">(</span>NioEndpoint.java:1760<spanclass="o">)</span>
at org.apache.tomcat.util.net.NioEndpoint<spanclass="nv">$SocketProcessor</span>.run<spanclass="o">(</span>NioEndpoint.java:1719<spanclass="o">)</span>
at java.util.concurrent.ThreadPoolExecutor.runWorker<spanclass="o">(</span>ThreadPoolExecutor.java:1142<spanclass="o">)</span>
at java.util.concurrent.ThreadPoolExecutor<spanclass="nv">$Worker</span>.run<spanclass="o">(</span>ThreadPoolExecutor.java:617<spanclass="o">)</span>
at org.apache.tomcat.util.threads.TaskThread<spanclass="nv">$WrappingRunnable</span>.run<spanclass="o">(</span>TaskThread.java:61<spanclass="o">)</span>
at java.lang.Thread.run<spanclass="o">(</span>Thread.java:745<spanclass="o">)</span>,
Affect<spanclass="o">(</span>class-cnt:1 , method-cnt:1<spanclass="o">)</span> cost in <spanclass="m">62</span> ms.
<spanid="filter-based-on-time-cost"></span><h3>Filter based on time cost<aclass="headerlink"href="#filter-based-on-time-cost"title="Permalink to this headline">¶</a></h3>
<spanid="filter-by-time-cost"></span><h3>Filter by time cost<aclass="headerlink"href="#filter-by-time-cost"title="Permalink to this headline">¶</a></h3>
<codeclass="docutils literal notranslate"><spanclass="pre">#cost>200</span></code> (<codeclass="docutils literal notranslate"><spanclass="pre">ms</span></code>) filter out all invokings that take less than <codeclass="docutils literal notranslate"><spanclass="pre">200ms</span></code>.</p>
<ulclass="simple">
<li><codeclass="docutils literal notranslate"><spanclass="pre">#cost>200</span></code> (<codeclass="docutils literal notranslate"><spanclass="pre">ms</span></code>) filter out all invokings that take less than <codeclass="docutils literal notranslate"><spanclass="pre">200ms</span></code>.</li>
<spanid="check-the-global-properties-of-the-target-object"></span><h3>Check the global properties of the target object<aclass="headerlink"href="#check-the-global-properties-of-the-target-object"title="Permalink to this headline">¶</a></h3>
<p><codeclass="docutils literal notranslate"><spanclass="pre">target</span></code> stands for the current object.</p>
<spanid="check-the-field-of-the-target-object"></span><h3>Check the field of the target object<aclass="headerlink"href="#check-the-field-of-the-target-object"title="Permalink to this headline">¶</a></h3>
<ulclass="simple">
<li><codeclass="docutils literal notranslate"><spanclass="pre">target</span></code> is the <codeclass="docutils literal notranslate"><spanclass="pre">this</span></code> object in java.</li>
HashMap<String, Object><spanclass="nv">result</span><spanclass="o">=</span> new HashMap<String, Object><spanclass="o">()</span><spanclass="p">;</span>
HashMap<String, Object><spanclass="nv">metricMap</span><spanclass="o">=</span> new HashMap<String, Object><spanclass="o">()</span><spanclass="p">;</span>
at com.alibaba.sample.petstore.biz.impl.UserManagerImpl.testAdd<spanclass="o">(</span>UserManagerImpl.java:75<spanclass="o">)</span>
at com.alibaba.sample.petstore.biz.impl.UserManagerImpl.register<spanclass="o">(</span>UserManagerImpl.java:60<spanclass="o">)</span>
at com.alibaba.sample.petstore.web.user.module.action.RegisterAction.doRegister<spanclass="o">(</span>RegisterAction.java:45<spanclass="o">)</span>
at com.alibaba.sample.petstore.web.user.module.action.RegisterAction<spanclass="nv">$$</span>FastClassByCGLIB<spanclass="nv">$$</span>ad5428f1.invoke<spanclass="o">(</span><generated><spanclass="o">)</span>
at net.sf.cglib.reflect.FastMethod.invoke<spanclass="o">(</span>FastMethod.java:53<spanclass="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.MethodInvoker.invoke<spanclass="o">(</span>MethodInvoker.java:70<spanclass="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.AbstractModuleEventAdapter.executeAndReturn<spanclass="o">(</span>AbstractModuleEventAdapter.java:100<spanclass="o">)</span>
at com.alibaba.citrus.service.moduleloader.impl.adapter.AbstractModuleEventAdapter.execute<spanclass="o">(</span>AbstractModuleEventAdapter.java:58<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PerformActionValve.invoke<spanclass="o">(</span>PerformActionValve.java:63<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invoke<spanclass="o">(</span>PipelineImpl.java:210<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.ChooseValve.invoke<spanclass="o">(</span>ChooseValve.java:98<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invoke<spanclass="o">(</span>PipelineImpl.java:210<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invokeBody<spanclass="o">(</span>LoopValve.java:105<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.valve.LoopValve.invoke<spanclass="o">(</span>LoopValve.java:83<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PageAuthorizationValve.invoke<spanclass="o">(</span>PageAuthorizationValve.java:105<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.CheckCsrfTokenValve.invoke<spanclass="o">(</span>CheckCsrfTokenValve.java:123<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.AnalyzeURLValve.invoke<spanclass="o">(</span>AnalyzeURLValve.java:126<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.SetLoggingContextValve.invoke<spanclass="o">(</span>SetLoggingContextValve.java:66<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.turbine.pipeline.valve.PrepareForTurbineValve.invoke<spanclass="o">(</span>PrepareForTurbineValve.java:52<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invokeNext<spanclass="o">(</span>PipelineImpl.java:157<spanclass="o">)</span>
at com.alibaba.citrus.service.pipeline.impl.PipelineImpl<spanclass="nv">$PipelineContextImpl</span>.invoke<spanclass="o">(</span>PipelineImpl.java:210<spanclass="o">)</span>
at com.alibaba.citrus.webx.impl.WebxControllerImpl.service<spanclass="o">(</span>WebxControllerImpl.java:43<spanclass="o">)</span>
at com.alibaba.citrus.webx.impl.WebxRootControllerImpl.handleRequest<spanclass="o">(</span>WebxRootControllerImpl.java:53<spanclass="o">)</span>
at com.alibaba.citrus.webx.support.AbstractWebxRootController.service<spanclass="o">(</span>AbstractWebxRootController.java:165<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.WebxFrameworkFilter.doFilter<spanclass="o">(</span>WebxFrameworkFilter.java:152<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.FilterBean.doFilter<spanclass="o">(</span>FilterBean.java:148<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter<spanclass="o">(</span>ApplicationFilterChain.java:241<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.doFilter<spanclass="o">(</span>ApplicationFilterChain.java:208<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.SetLoggingContextFilter.doFilter<spanclass="o">(</span>SetLoggingContextFilter.java:61<spanclass="o">)</span>
at com.alibaba.citrus.webx.servlet.FilterBean.doFilter<spanclass="o">(</span>FilterBean.java:148<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter<spanclass="o">(</span>ApplicationFilterChain.java:241<spanclass="o">)</span>
at org.apache.catalina.core.ApplicationFilterChain.doFilter<spanclass="o">(</span>ApplicationFilterChain.java:208<spanclass="o">)</span>
at org.apache.catalina.core.StandardWrapperValve.invoke<spanclass="o">(</span>StandardWrapperValve.java:220<spanclass="o">)</span>
at org.apache.catalina.core.StandardContextValve.invoke<spanclass="o">(</span>StandardContextValve.java:122<spanclass="o">)</span>
at com.taobao.tomcat.valves.ContextLoadFilterValve.invoke<spanclass="o">(</span>ContextLoadFilterValve.java:152<spanclass="o">)</span>
at org.apache.catalina.core.StandardHostValve.invoke<spanclass="o">(</span>StandardHostValve.java:170<spanclass="o">)</span>
at org.apache.catalina.valves.ErrorReportValve.invoke<spanclass="o">(</span>ErrorReportValve.java:103<spanclass="o">)</span>
at org.apache.catalina.core.StandardEngineValve.invoke<spanclass="o">(</span>StandardEngineValve.java:116<spanclass="o">)</span>
at org.apache.catalina.connector.CoyoteAdapter.service<spanclass="o">(</span>CoyoteAdapter.java:429<spanclass="o">)</span>
at org.apache.coyote.http11.AbstractHttp11Processor.process<spanclass="o">(</span>AbstractHttp11Processor.java:1085<spanclass="o">)</span>
at org.apache.coyote.AbstractProtocol<spanclass="nv">$AbstractConnectionHandler</span>.process<spanclass="o">(</span>AbstractProtocol.java:625<spanclass="o">)</span>
at org.apache.tomcat.util.net.NioEndpoint<spanclass="nv">$SocketProcessor</span>.doRun<spanclass="o">(</span>NioEndpoint.java:1760<spanclass="o">)</span>
at org.apache.tomcat.util.net.NioEndpoint<spanclass="nv">$SocketProcessor</span>.run<spanclass="o">(</span>NioEndpoint.java:1719<spanclass="o">)</span>
at java.util.concurrent.ThreadPoolExecutor.runWorker<spanclass="o">(</span>ThreadPoolExecutor.java:1142<spanclass="o">)</span>
at java.util.concurrent.ThreadPoolExecutor<spanclass="nv">$Worker</span>.run<spanclass="o">(</span>ThreadPoolExecutor.java:617<spanclass="o">)</span>
at org.apache.tomcat.util.threads.TaskThread<spanclass="nv">$WrappingRunnable</span>.run<spanclass="o">(</span>TaskThread.java:61<spanclass="o">)</span>
at java.lang.Thread.run<spanclass="o">(</span>Thread.java:745<spanclass="o">)</span>,
Affect<spanclass="o">(</span>class-cnt:1 , method-cnt:1<spanclass="o">)</span> cost in <spanclass="m">62</span> ms.