mirror of https://github.com/alibaba/arthas.git
Merge branch 'master' of https://github.com/alibaba/arthas
commit
0ade2f93c4
@ -0,0 +1,129 @@
|
|||||||
|
classloader
|
||||||
|
===========
|
||||||
|
|
||||||
|
Check the inheritance tree, urls and classes loading profiles of 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.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|[l]|count based on the class loader instance|
|
||||||
|
|[t]|print all the inheritance structure of the class loaders|
|
||||||
|
|[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: r:]`|using class loader to search resource|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
* categorised by class loader
|
||||||
|
|
||||||
|
```s
|
||||||
|
$ classloader
|
||||||
|
name numberOfInstances loadedCountTotal
|
||||||
|
com.taobao.pandora.service.loader.ModuleClassLoader 29 11659
|
||||||
|
com.taobao.pandora.boot.loader.ReLaunchURLClassLoader 1 5308
|
||||||
|
BootstrapClassLoader 1 3711
|
||||||
|
com.taobao.arthas.agent.ArthasClassloader 2 2825
|
||||||
|
sun.reflect.DelegatingClassLoader 332 332
|
||||||
|
java.net.URLClassLoader 1 285
|
||||||
|
sun.misc.Launcher$AppClassLoader 1 77
|
||||||
|
sun.misc.Launcher$ExtClassLoader 1 46
|
||||||
|
com.alibaba.fastjson.util.ASMClassLoader 2 3
|
||||||
|
org.jvnet.hk2.internal.DelegatingClassLoader 2 2
|
||||||
|
sun.reflect.misc.MethodUtil 1 1
|
||||||
|
Affect(row-cnt:11) cost in 66 ms.
|
||||||
|
```
|
||||||
|
|
||||||
|
* Categorized by class loader instance
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ classloader -l
|
||||||
|
name loadedCount hash parent
|
||||||
|
BootstrapClassLoader 3711 null null
|
||||||
|
com.alibaba.fastjson.util.ASMClassLoader@3bbaa1b8 2 3bbaa1b8 monitor's ModuleClassLoader
|
||||||
|
com.alibaba.fastjson.util.ASMClassLoader@5e255d0b 1 5e255d0b eagleeye-core's ModuleClassLoader
|
||||||
|
com.taobao.arthas.agent.ArthasClassloader@4fa2d7e6 1795 4fa2d7e6 sun.misc.Launcher$ExtClassLoader@a38d7a3
|
||||||
|
com.taobao.arthas.agent.ArthasClassloader@522400c2 1033 522400c2 sun.misc.Launcher$ExtClassLoader@a38d7a3
|
||||||
|
com.taobao.pandora.boot.loader.ReLaunchURLClassLoader@1817d444 5308 1817d444 sun.misc.Launcher$AppClassLoader@14dad5dc
|
||||||
|
tbsession's ModuleClassLoader 285 609cd4d8 null
|
||||||
|
pandora-qos-service's ModuleClassLoader 267 2f8dad04 null
|
||||||
|
pandora-framework's ModuleClassLoader 78 4009e306 null
|
||||||
|
filesync-client's ModuleClassLoader 4 4b8ee4de null
|
||||||
|
rocketmq-client's ModuleClassLoader 431 247bddad null
|
||||||
|
eagleeye-core's ModuleClassLoader 451 1ba9117e null
|
||||||
|
alimonitor-jmonitor's ModuleClassLoader 134 22fcf7ab null
|
||||||
|
metaq-client's ModuleClassLoader 35 41a2befb null
|
||||||
|
hsf-mock's ModuleClassLoader 3 2002fc1d null
|
||||||
|
monitor's ModuleClassLoader 1427 131ef10 null
|
||||||
|
spas-sdk-service's ModuleClassLoader 7 10d307f1 null
|
||||||
|
vipserver-client's ModuleClassLoader 137 7a419da4 null
|
||||||
|
metrics's ModuleClassLoader 146 696da30b null
|
||||||
|
mtop-uncenter's ModuleClassLoader 922 79d8407f null
|
||||||
|
spas-sdk-client's ModuleClassLoader 235 4944252c null
|
||||||
|
live-profiler-pandora's ModuleClassLoader 1 6913c1fb null
|
||||||
|
notify-tr-client's ModuleClassLoader 472 fba92d3 null
|
||||||
|
ons-sdk's ModuleClassLoader 70 23348b5d null
|
||||||
|
tair-plugin's ModuleClassLoader 1053 7c9d8e2 null
|
||||||
|
tddl-client's ModuleClassLoader 2354 4988d8b8 null
|
||||||
|
config-client's ModuleClassLoader 93 429bffaa null
|
||||||
|
diamond-client's ModuleClassLoader 360 3d5c822d null
|
||||||
|
pandolet's ModuleClassLoader 99 41e1e210 null
|
||||||
|
hsf's ModuleClassLoader 1796 3232a28a null
|
||||||
|
acl.plugin's ModuleClassLoader 379 67080771 null
|
||||||
|
buc.sso.client.plugin's ModuleClassLoader 195 13b6aecc null
|
||||||
|
unitrouter's ModuleClassLoader 64 7e5afaa6 null
|
||||||
|
switch's ModuleClassLoader 104 24313fcc null
|
||||||
|
hsf-notify-client's ModuleClassLoader 57 4d0f2471 null
|
||||||
|
java.net.URLClassLoader@7ec7ffd3 285 7ec7ffd3 sun.misc.Launcher$ExtClassLoader@a38d7a3
|
||||||
|
javax.management.remote.rmi.NoCallStackClassLoader@53f65459 1 53f65459 null
|
||||||
|
javax.management.remote.rmi.NoCallStackClassLoader@2833cc44 1 2833cc44 null
|
||||||
|
org.jvnet.hk2.internal.DelegatingClassLoader@72cda8ee 1 72cda8ee monitor's ModuleClassLoader
|
||||||
|
org.jvnet.hk2.internal.DelegatingClassLoader@1f57f96d 1 1f57f96d monitor's ModuleClassLoader
|
||||||
|
sun.misc.Launcher$AppClassLoader@14dad5dc 77 14dad5dc sun.misc.Launcher$ExtClassLoader@a38d7a3
|
||||||
|
sun.misc.Launcher$ExtClassLoader@a38d7a3 46 a38d7a3 null
|
||||||
|
sun.reflect.misc.MethodUtil@1201f221 1 1201f221 sun.misc.Launcher$AppClassLoader@14dad5dc
|
||||||
|
```
|
||||||
|
|
||||||
|
* Check inheritance tree of the class loaders
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ classloader -t
|
||||||
|
+-BootstrapClassLoader
|
||||||
|
+-unitrouter's ModuleClassLoader
|
||||||
|
+-diamond-client's ModuleClassLoader
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@548a102f
|
||||||
|
| +-sun.misc.Launcher$AppClassLoader@14dad5dc
|
||||||
|
| +-com.taobao.arthas.agent.AgentLauncher$1@334e6bb8
|
||||||
|
| | +-sun.reflect.DelegatingClassLoader@328b3a05
|
||||||
|
| | +-sun.reflect.DelegatingClassLoader@73f44f24
|
||||||
|
```
|
||||||
|
|
||||||
|
* Check the real urls of `URLClassLoader`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ 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/log4j-1.2.16.jar
|
||||||
|
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/logger.api-0.1.4.jar
|
||||||
|
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.api-2.0.7-SNAPSHOT.jar
|
||||||
|
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.container-2.0.7-SNAPSHOT.jar
|
||||||
|
file:/Users/hello/soft/taobao-tomcat-7.0.64/deploy/taobao-hsf.sar/lib/pandora.thirdcontainer-2.0.7-SNAPSHOT.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
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ 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/annotation/jsr250-api/1.0/jsr250-api-1.0.jar!/META-INF/MANIFEST.MF
|
||||||
|
```
|
||||||
|
|
||||||
|
* Using class loader to look for `*.class` file
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ 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
|
||||||
|
```
|
@ -0,0 +1,40 @@
|
|||||||
|
dump
|
||||||
|
===
|
||||||
|
|
||||||
|
Dump the bytecode the loaded classes to a specified directory.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|*class-pattern*|pattern for the class name|
|
||||||
|
|`[c:]`|hashcode of the class loader that loaded the class|
|
||||||
|
|[E]|turn on regx matching while the default is wildcards matching|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ dump -E org\.apache\.commons\.lang\.StringUtils
|
||||||
|
HASHCODE CLASSLOADER LOCATION
|
||||||
|
29505d69 +-tddl-client's ModuleClassLoader /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/com.taobao.pandora
|
||||||
|
.service.loader.ModuleClassLoader-29505d69/org.apache.commons.lang.StringUtils.class
|
||||||
|
6e51ad67 +-java.net.URLClassLoader@6e51ad67 /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/java.net.URLClassL
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@6951a712 oader-6e51ad67/org.apache.commons.lang.StringUtils.class
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
|
||||||
|
2bdd9114 +-pandora-qos-service's ModuleClassLoader /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/com.taobao.pandora
|
||||||
|
.service.loader.ModuleClassLoader-2bdd9114/org.apache.commons.lang.StringUtils.class
|
||||||
|
544dc9ba +-com.taobao.tomcat.container.context.loader.AliWebappClassLoader /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/com.taobao.tomcat.
|
||||||
|
+-org.apache.catalina.loader.StandardClassLoader@2302e984 container.context.loader.AliWebappClassLoader-544dc9ba/org.apache.commons.lang.String
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@6951a712 Utils.class
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
|
||||||
|
22880c2b +-java.net.URLClassLoader@22880c2b /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/java.net.URLClassL
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@6951a712 oader-22880c2b/org.apache.commons.lang.StringUtils.class
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
|
||||||
|
Affect(row-cnt:5) cost in 156 ms.
|
||||||
|
$ dump -E org\.apache\.commons\.lang\.StringUtils -c 22880c2b
|
||||||
|
HASHCODE CLASSLOADER LOCATION
|
||||||
|
22880c2b +-java.net.URLClassLoader@22880c2b /Users/zhuyong/middleware/taobao-tomcat/output/build/bin/classdump/java.net.URLClassLoader-22880c2b/org
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@6951a712 .apache.commons.lang.StringUtils.class
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
|
||||||
|
Affect(row-cnt:1) cost in 67 ms.
|
||||||
|
```
|
@ -0,0 +1,24 @@
|
|||||||
|
getstatic
|
||||||
|
=========
|
||||||
|
|
||||||
|
Check the static fields of classes conveniently as `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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ getstatic com.alibaba.arthas.Test n 'entrySet().iterator.{? #this.key.name()=="STOP"}'
|
||||||
|
field: n
|
||||||
|
@ArrayList[
|
||||||
|
@Node[STOP=bbb],
|
||||||
|
]
|
||||||
|
Affect(row-cnt:1) cost in 68 ms.
|
||||||
|
|
||||||
|
|
||||||
|
$ getstatic com.alibaba.arthas.Test m 'entrySet().iterator.{? #this.key=="a"}'
|
||||||
|
field: m
|
||||||
|
@ArrayList[
|
||||||
|
@Node[a=aaa],
|
||||||
|
]
|
||||||
|
```
|
@ -0,0 +1,158 @@
|
|||||||
|
jad
|
||||||
|
===
|
||||||
|
|
||||||
|
De-compile specified loaded classes.
|
||||||
|
|
||||||
|
`jad` helps to *de-compile* the byte code in JVM to the source code to assist you to better understand the logic behind.
|
||||||
|
|
||||||
|
F.Y.I
|
||||||
|
* the de-compiled code will be grammatically highlighted for readability in Arthas Console;
|
||||||
|
* you have to understand there might be some trivial grammar errors but it won't affect the logic understanding.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|*class-pattern*|pattern for the class name|
|
||||||
|
|`[c:]`|hashcode of the class loader that loaded the class|
|
||||||
|
|[E]|turn on regx matching while the default is wildcards matching|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
When several class loaders loaded the same class:
|
||||||
|
1. `jad` to get the hashcode of the class loader;
|
||||||
|
2. `jad -c <hashcode>` to get the de-compiled class loaded by the class loader.
|
||||||
|
|
||||||
|
```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
|
||||||
|
HASHCODE CLASSLOADER
|
||||||
|
69dcaba4 +-monitor's ModuleClassLoader
|
||||||
|
6e51ad67 +-java.net.URLClassLoader@6e51ad67
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@6951a712
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@6fafc4c2
|
||||||
|
2bdd9114 +-pandora-qos-service's ModuleClassLoader
|
||||||
|
4c0df5f8 +-pandora-framework's ModuleClassLoader
|
||||||
|
|
||||||
|
Affect(row-cnt:0) cost in 38 ms.
|
||||||
|
$ jad org.apache.log4j.Logger -c 69dcaba4
|
||||||
|
|
||||||
|
ClassLoader:
|
||||||
|
+-monitor's ModuleClassLoader
|
||||||
|
|
||||||
|
Location:
|
||||||
|
/Users/zhuyong/Downloads/taobao-hsf.sar/plugins/monitor/lib/log4j-1.2.14.jar
|
||||||
|
|
||||||
|
package org.apache.log4j;
|
||||||
|
|
||||||
|
import org.apache.log4j.spi.*;
|
||||||
|
|
||||||
|
public class Logger extends Category
|
||||||
|
{
|
||||||
|
private static final String FQCN;
|
||||||
|
|
||||||
|
protected Logger(String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getLogger(String name)
|
||||||
|
{
|
||||||
|
return LogManager.getLogger(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getLogger(Class clazz)
|
||||||
|
{
|
||||||
|
return LogManager.getLogger(clazz.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getRootLogger()
|
||||||
|
{
|
||||||
|
return LogManager.getRootLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getLogger(String name, LoggerFactory factory)
|
||||||
|
{
|
||||||
|
return LogManager.getLogger(name, factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(Object message)
|
||||||
|
{
|
||||||
|
if (repository.isDisabled(5000))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Level.TRACE.isGreaterOrEqual(getEffectiveLevel()))
|
||||||
|
{
|
||||||
|
forcedLog(Logger.FQCN, Level.TRACE, message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(Object message, Throwable t)
|
||||||
|
{
|
||||||
|
if (repository.isDisabled(5000))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Level.TRACE.isGreaterOrEqual(getEffectiveLevel()))
|
||||||
|
{
|
||||||
|
forcedLog(Logger.FQCN, Level.TRACE, message, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTraceEnabled()
|
||||||
|
{
|
||||||
|
if (repository.isDisabled(5000))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Level.TRACE.isGreaterOrEqual(getEffectiveLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
Logger.FQCN = Logger.class.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Affect(row-cnt:1) cost in 190 ms.
|
||||||
|
```
|
||||||
|
|
||||||
|
De-compile the specified method:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ jad com.taobao.container.web.arthas.rest.MetricsController directMetrics
|
||||||
|
|
||||||
|
ClassLoader:
|
||||||
|
+-com.taobao.pandora.boot.loader.ReLaunchURLClassLoader@1817d444
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@14dad5dc
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@a38d7a3
|
||||||
|
|
||||||
|
Location:
|
||||||
|
/Users/zhuyong/middleware/tomcat-web/tomcat-web-web/target/classes/
|
||||||
|
|
||||||
|
private Map<String, Object> directMetrics(String ip, String[] metrics) {
|
||||||
|
JSONObject obj;
|
||||||
|
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||||
|
result.put("success", false);
|
||||||
|
String metricUrl = "http://" + ip + ":8006/metrics/specific";
|
||||||
|
String postBody = Arrays.stream(metrics).map(metric -> "metric=" + metric).collect(Collectors.joining("&"));
|
||||||
|
HttpClientUtils.Response resp = HttpClientUtils.sendPostRequest((String)metricUrl, (String)postBody);
|
||||||
|
if (resp.isSuccess() && (obj = JSON.parseObject(resp.getContent())).containsKey("success") && obj.getBoolean("success").booleanValue() && obj.containsKey("data")) {
|
||||||
|
JSONArray dataArray = obj.getJSONArray("data");
|
||||||
|
HashMap<String, Object> metricMap = new HashMap<String, Object>();
|
||||||
|
for (Object aDataArray : dataArray) {
|
||||||
|
JSONObject o = (JSONObject)aDataArray;
|
||||||
|
metricMap.put(o.getString("metric"), o.get("value"));
|
||||||
|
}
|
||||||
|
result.put("data", metricMap);
|
||||||
|
result.put("success", true);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Affect(row-cnt:1) cost in 1508 ms.
|
||||||
|
```
|
@ -0,0 +1,52 @@
|
|||||||
|
monitor
|
||||||
|
=======
|
||||||
|
|
||||||
|
Monitor the `class-pattern` & `method-pattern` matched methods invoking traces.
|
||||||
|
|
||||||
|
F.Y.I
|
||||||
|
|
||||||
|
1. `monitor` is a persistent command, it never returns until `Ctrl+C` to manually stop it.
|
||||||
|
2. the server runs the tasks in the background;
|
||||||
|
3. injected code will become invalid automatically once the tasks being terminated;
|
||||||
|
4. in theory, Arthas commands will not change any original behaviors.
|
||||||
|
|
||||||
|
### Properties monitored
|
||||||
|
|
||||||
|
|Property|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|timestamp|timestamp|
|
||||||
|
|class|Java class|
|
||||||
|
|method|constructor and regular methods|
|
||||||
|
|total|calling times|
|
||||||
|
|success|success count|
|
||||||
|
|fail|failure count|
|
||||||
|
|rt|average RT|
|
||||||
|
|fail-rate|failure ratio|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|*class-pattern*|pattern for the class name|
|
||||||
|
|*method-pattern*|pattern for the method name|
|
||||||
|
|[E]|turn on regx matching while the default is wildcards matching|
|
||||||
|
|`[c:]`|cycle of output with default value: `120 s`|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ monitor -c 5 com.alibaba.sample.petstore.web.store.module.screen.ItemList execute
|
||||||
|
Press Ctrl+C to abort.
|
||||||
|
Affect(class-cnt:1 , method-cnt:1) cost in 36 ms.
|
||||||
|
timestamp class method total success fail rt fail-rate
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
2015-12-17 10:56:40 com.alibaba.sample.petstore.web.store.module.screen.ItemList execute 10 10 0 2.00 0.00%
|
||||||
|
|
||||||
|
timestamp class method total success fail rt fail-rate
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
2015-12-17 10:56:45 com.alibaba.sample.petstore.web.store.module.screen.ItemList execute 11 11 0 2.18 0.00%
|
||||||
|
|
||||||
|
timestamp class method total success fail rt fail-rate
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
2015-12-17 10:56:50 com.alibaba.sample.petstore.web.store.module.screen.ItemList execute 0 0 0 0.00 0.00%
|
||||||
|
```
|
@ -0,0 +1,26 @@
|
|||||||
|
redefine
|
||||||
|
========
|
||||||
|
|
||||||
|
Load the external `*.class` files and *re-define* the JVM-loaded classes.
|
||||||
|
|
||||||
|
Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-)
|
||||||
|
|
||||||
|
F.Y.I
|
||||||
|
|
||||||
|
1. Re-defined classes cannot be restores any more;
|
||||||
|
2. Re-definition can fail (like adding a new field); for more information, please refer to JDK documentation
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|[c:]|hashcode of the class loader|
|
||||||
|
|[p:]|absolute path of the external `*.class` (multiple paths supported)|
|
||||||
|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
redefine -p /tmp/Test.class
|
||||||
|
redefine -c 327a647b -p /tmp/Test.class /tmp/Test\$Inner.class
|
||||||
|
```
|
@ -0,0 +1,68 @@
|
|||||||
|
sc
|
||||||
|
==
|
||||||
|
|
||||||
|
Check the profiles of the loaded classes.
|
||||||
|
|
||||||
|
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:]`.
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
|
||||||
|
### Specification
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|*class-pattern*|pattern for the class 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|
|
||||||
|
|[E]|turn on regx matching while the default is wildcards matching|
|
||||||
|
|[f]|print the fields info of the current class, which should be used along with `-d`|
|
||||||
|
|[x:]|the depth to print the static fields, whose default is `0` - directly invoke the `toString()`|
|
||||||
|
|
||||||
|
Tip:
|
||||||
|
1. *class-patten* supports full qualified class name (e.g. com.taobao.test.AAA and com/taobao/test/AAA)
|
||||||
|
2. `sc` turned on the `sub-class` matching in default mode, if you do want to hide the `sub-class` please just turn it off via `options disable-sub-class true`.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
Check the static fields of a class using `sc -df class-name`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ sc -df org.apache.commons.lang.StringUtils
|
||||||
|
|
||||||
|
class-info org.apache.commons.lang.StringUtils
|
||||||
|
code-source /Users/zhuyong/middleware/citrus-sample/petstore/web/target/petstore/WEB-INF/lib/commons-lang-2.4.jar
|
||||||
|
name org.apache.commons.lang.StringUtils
|
||||||
|
isInterface false
|
||||||
|
isAnnotation false
|
||||||
|
isEnum false
|
||||||
|
isAnonymousClass false
|
||||||
|
isArray false
|
||||||
|
isLocalClass false
|
||||||
|
isMemberClass false
|
||||||
|
isPrimitive false
|
||||||
|
isSynthetic false
|
||||||
|
simple-name StringUtils
|
||||||
|
modifier public
|
||||||
|
annotation
|
||||||
|
interfaces
|
||||||
|
super-class +-java.lang.Object
|
||||||
|
class-loader +-com.taobao.tomcat.container.context.loader.AliWebappClassLoader
|
||||||
|
+-org.apache.catalina.loader.StandardClassLoader@1d44eef3
|
||||||
|
+-sun.misc.Launcher$AppClassLoader@57a462c9
|
||||||
|
+-sun.misc.Launcher$ExtClassLoader@6951a712
|
||||||
|
fields modifier final,public,static
|
||||||
|
type java.lang.String
|
||||||
|
name EMPTY
|
||||||
|
value
|
||||||
|
|
||||||
|
modifier final,public,static
|
||||||
|
type int
|
||||||
|
name INDEX_NOT_FOUND
|
||||||
|
value -1
|
||||||
|
|
||||||
|
modifier final,private,static
|
||||||
|
type int
|
||||||
|
name PAD_LIMIT
|
||||||
|
value 8192
|
||||||
|
```
|
@ -0,0 +1,89 @@
|
|||||||
|
sm
|
||||||
|
==
|
||||||
|
|
||||||
|
Check the method profile of the loaded classes;
|
||||||
|
|
||||||
|
Abbreviated from “Search-Method”, with which you can search out all methods profiles of the loaded classes.
|
||||||
|
|
||||||
|
F.Y.I
|
||||||
|
`sm` only shows the methods declared in the current class; methods declared in ancestors will not be presented.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
|Name|Specification|
|
||||||
|
|---:|:---|
|
||||||
|
|*class-pattern*|pattern for class name|
|
||||||
|
|*method-pattern*|pattern for method name|
|
||||||
|
|[d]|print the details of the method|
|
||||||
|
|[E]|turn the regex matching on while the default mode is wildcards matching|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sm org.apache.catalina.connector.Connector
|
||||||
|
org.apache.catalina.connector.Connector-><init>
|
||||||
|
org.apache.catalina.connector.Connector->setProperty
|
||||||
|
org.apache.catalina.connector.Connector->getProperty
|
||||||
|
org.apache.catalina.connector.Connector->toString
|
||||||
|
org.apache.catalina.connector.Connector->resume
|
||||||
|
org.apache.catalina.connector.Connector->getScheme
|
||||||
|
org.apache.catalina.connector.Connector->getProtocol
|
||||||
|
org.apache.catalina.connector.Connector->getPort
|
||||||
|
org.apache.catalina.connector.Connector->setService
|
||||||
|
org.apache.catalina.connector.Connector->setPort
|
||||||
|
org.apache.catalina.connector.Connector->getService
|
||||||
|
org.apache.catalina.connector.Connector->getAttribute
|
||||||
|
org.apache.catalina.connector.Connector->setAttribute
|
||||||
|
org.apache.catalina.connector.Connector->getLocalPort
|
||||||
|
org.apache.catalina.connector.Connector->pause
|
||||||
|
org.apache.catalina.connector.Connector->setProtocol
|
||||||
|
org.apache.catalina.connector.Connector->initInternal
|
||||||
|
org.apache.catalina.connector.Connector->setSecure
|
||||||
|
org.apache.catalina.connector.Connector->getSecure
|
||||||
|
org.apache.catalina.connector.Connector->startInternal
|
||||||
|
org.apache.catalina.connector.Connector->stopInternal
|
||||||
|
org.apache.catalina.connector.Connector->setScheme
|
||||||
|
org.apache.catalina.connector.Connector->createRequest
|
||||||
|
org.apache.catalina.connector.Connector->getDomainInternal
|
||||||
|
org.apache.catalina.connector.Connector->getProtocolHandler
|
||||||
|
org.apache.catalina.connector.Connector->setURIEncoding
|
||||||
|
org.apache.catalina.connector.Connector->findSslHostConfigs
|
||||||
|
org.apache.catalina.connector.Connector->destroyInternal
|
||||||
|
org.apache.catalina.connector.Connector->getObjectNameKeyProperties
|
||||||
|
org.apache.catalina.connector.Connector->getAllowTrace
|
||||||
|
org.apache.catalina.connector.Connector->setAllowTrace
|
||||||
|
org.apache.catalina.connector.Connector->getAsyncTimeout
|
||||||
|
org.apache.catalina.connector.Connector->setAsyncTimeout
|
||||||
|
org.apache.catalina.connector.Connector->getEnableLookups
|
||||||
|
org.apache.catalina.connector.Connector->setEnableLookups
|
||||||
|
org.apache.catalina.connector.Connector->getMaxCookieCount
|
||||||
|
...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ sm org.apache.catalina.connector.Connector -d
|
||||||
|
declaring-class org.apache.catalina.connector.Connector
|
||||||
|
constructor-name <init>
|
||||||
|
modifier public
|
||||||
|
annotation
|
||||||
|
parameters
|
||||||
|
exceptions
|
||||||
|
|
||||||
|
declaring-class org.apache.catalina.connector.Connector
|
||||||
|
constructor-name <init>
|
||||||
|
modifier public
|
||||||
|
annotation
|
||||||
|
parameters java.lang.String
|
||||||
|
exceptions
|
||||||
|
|
||||||
|
declaring-class org.apache.catalina.connector.Connector
|
||||||
|
method-name setProperty
|
||||||
|
modifier public
|
||||||
|
annotation
|
||||||
|
parameters java.lang.String
|
||||||
|
java.lang.String
|
||||||
|
return boolean
|
||||||
|
exceptions
|
||||||
|
......
|
||||||
|
```
|
@ -0,0 +1,122 @@
|
|||||||
|
sysprop
|
||||||
|
=======
|
||||||
|
|
||||||
|
Check the JVM system properties.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
USAGE:
|
||||||
|
sysprop [-h] [property-name] [property-value]
|
||||||
|
|
||||||
|
SUMMARY:
|
||||||
|
Display, and change all the system properties.
|
||||||
|
|
||||||
|
EXAMPLES:
|
||||||
|
sysprop
|
||||||
|
sysprop file.encoding
|
||||||
|
sysprop production.mode true
|
||||||
|
|
||||||
|
WIKI:
|
||||||
|
https://alibaba.github.io/arthas/sysprop
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-h, --help this help
|
||||||
|
<property-name> property name
|
||||||
|
<property-value> property value
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Check all properties
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sysprop
|
||||||
|
KEY VALUE
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
java.runtime.name Java(TM) SE Runtime Environment
|
||||||
|
sun.boot.library.path /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib
|
||||||
|
java.vm.version 25.51-b03
|
||||||
|
user.country.format CN
|
||||||
|
gopherProxySet false
|
||||||
|
java.vm.vendor Oracle Corporation
|
||||||
|
java.vendor.url http://java.oracle.com/
|
||||||
|
path.separator :
|
||||||
|
java.vm.name Java HotSpot(TM) 64-Bit Server VM
|
||||||
|
file.encoding.pkg sun.io
|
||||||
|
user.country US
|
||||||
|
sun.java.launcher SUN_STANDARD
|
||||||
|
sun.os.patch.level unknown
|
||||||
|
java.vm.specification.name Java Virtual Machine Specification
|
||||||
|
user.dir /private/var/tmp
|
||||||
|
java.runtime.version 1.8.0_51-b16
|
||||||
|
java.awt.graphicsenv sun.awt.CGraphicsEnvironment
|
||||||
|
java.endorsed.dirs /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/endors
|
||||||
|
ed
|
||||||
|
os.arch x86_64
|
||||||
|
java.io.tmpdir /var/folders/2c/tbxwzs4s4sbcvh7frbcc7n000000gn/T/
|
||||||
|
line.separator
|
||||||
|
|
||||||
|
java.vm.specification.vendor Oracle Corporation
|
||||||
|
os.name Mac OS X
|
||||||
|
sun.jnu.encoding UTF-8
|
||||||
|
java.library.path /Users/wangtao/Library/Java/Extensions:/Library/Java/Extensions:/Network/Libra
|
||||||
|
ry/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
|
||||||
|
sun.nio.ch.bugLevel
|
||||||
|
java.specification.name Java Platform API Specification
|
||||||
|
java.class.version 52.0
|
||||||
|
sun.management.compiler HotSpot 64-Bit Tiered Compilers
|
||||||
|
os.version 10.12.6
|
||||||
|
user.home /Users/wangtao
|
||||||
|
user.timezone Asia/Shanghai
|
||||||
|
java.awt.printerjob sun.lwawt.macosx.CPrinterJob
|
||||||
|
file.encoding UTF-8
|
||||||
|
java.specification.version 1.8
|
||||||
|
user.name wangtao
|
||||||
|
java.class.path .
|
||||||
|
java.vm.specification.version 1.8
|
||||||
|
sun.arch.data.model 64
|
||||||
|
java.home /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
|
||||||
|
sun.java.command Test
|
||||||
|
java.specification.vendor Oracle Corporation
|
||||||
|
user.language en
|
||||||
|
awt.toolkit sun.lwawt.macosx.LWCToolkit
|
||||||
|
java.vm.info mixed mode
|
||||||
|
java.version 1.8.0_51
|
||||||
|
java.ext.dirs /Users/wangtao/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.
|
||||||
|
8.0_51.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library
|
||||||
|
/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
|
||||||
|
sun.boot.class.path /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/resour
|
||||||
|
ces.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/li
|
||||||
|
b/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/l
|
||||||
|
ib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/H
|
||||||
|
ome/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Content
|
||||||
|
s/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Conte
|
||||||
|
nts/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jd
|
||||||
|
k/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.
|
||||||
|
jdk/Contents/Home/jre/classes
|
||||||
|
java.vendor Oracle Corporation
|
||||||
|
file.separator /
|
||||||
|
java.vendor.url.bug http://bugreport.sun.com/bugreport/
|
||||||
|
sun.cpu.endian little
|
||||||
|
sun.io.unicode.encoding UnicodeBig
|
||||||
|
sun.cpu.isalist
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Check a single property
|
||||||
|
|
||||||
|
Tip: `tab` auto-completion supported
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sysprop java.version
|
||||||
|
java.version=1.8.0_51
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Modify a single property
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sysprop user.country
|
||||||
|
user.country=US
|
||||||
|
$ sysprop user.country CN
|
||||||
|
Successfully changed the system property.
|
||||||
|
user.country=CN
|
||||||
|
```
|
Loading…
Reference in New Issue