mirror of https://github.com/alibaba/arthas.git
parent
35aa6cf686
commit
2e979ff35f
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
下载`arthas-demo.jar`,再用`java -jar`命令启动:
|
||||
|
||||
`wget https://arthas.aliyun.com/doc/arthas-demo.jar
|
||||
java -jar arthas-demo.jar`{{execute T1}}
|
||||
|
||||
`arthas-demo`是一个很简单的程序,它随机生成整数,再执行因式分解,把结果打印出来。如果生成的随机数是负数,则会打印提示信息。
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"title": "Arthas sc命令",
|
||||
"description": "Arthas sc命令",
|
||||
"difficulty": "精通者",
|
||||
"time": "10-20 分钟",
|
||||
"details": {
|
||||
"steps": [
|
||||
{
|
||||
"title": "启动arthas demo",
|
||||
"text": "arthas-demo.md"
|
||||
},
|
||||
{
|
||||
"title": "启动arthas-boot",
|
||||
"text": "arthas-boot.md"
|
||||
},
|
||||
{
|
||||
"title": "sc命令",
|
||||
"text": "sc.md"
|
||||
}
|
||||
],
|
||||
"intro": {
|
||||
"text": "intro.md"
|
||||
},
|
||||
"finish": {
|
||||
"text": "finish.md"
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"uilayout": "terminal"
|
||||
},
|
||||
"backend": {
|
||||
"imageid": "java",
|
||||
"environmentsprotocol": "http"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Download `arthas-demo.jar` and start with the `java -jar` command:
|
||||
|
||||
`wget https://arthas.aliyun.com/doc/arthas-demo.jar
|
||||
java -jar arthas-demo.jar`{{execute T1}}
|
||||
|
||||
`arthas-demo` is a very simple program that randomly generates integers, performs factorization, and prints the results.
|
||||
If the generated random number is negative, a error message will be printed.
|
@ -0,0 +1,8 @@
|
||||
|
||||
The `sc Tutorial` demonstrates the usage of sc. If you have more tips or questions, please feel free to ask in Issue.
|
||||
|
||||
* Issues: https://github.com/alibaba/arthas/issues
|
||||
* Documentation: https://arthas.aliyun.com/doc/en
|
||||
|
||||
|
||||
If you are using Arthas, please let us know. Your use is very important to us: [View](https://github.com/alibaba/arthas/issues/111)
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"title": "Arthas sc Command",
|
||||
"description": "Arthas sc Command",
|
||||
"difficulty": "master",
|
||||
"time": "10-20 minutes",
|
||||
"details": {
|
||||
"steps": [
|
||||
{
|
||||
"title": "Arthas demo",
|
||||
"text": "arthas-demo.md"
|
||||
},
|
||||
{
|
||||
"title": "Start arthas-boot",
|
||||
"text": "arthas-boot.md"
|
||||
},
|
||||
{
|
||||
"title": "sc Command",
|
||||
"text": "sc.md"
|
||||
}
|
||||
],
|
||||
"intro": {
|
||||
"text": "intro.md"
|
||||
},
|
||||
"finish": {
|
||||
"text": "finish.md"
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"uilayout": "terminal"
|
||||
},
|
||||
"backend": {
|
||||
"imageid": "java",
|
||||
"environmentsprotocol": "http"
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
|
||||
> Search classes loaded by JVM.
|
||||
|
||||
`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:]`.
|
||||
|
||||
### Supported Options
|
||||
|
||||
|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 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 regex match, the default behavior is wildcards match|
|
||||
|`[f]`|print the fields info of the current class, MUST be used with `-d` together|
|
||||
|`[x:]`|specify the depth of recursive traverse the static fields, the default value is '0' - equivalent to use `toString` to output|
|
||||
|`[c:]`|The hash code of the special class's classLoader|
|
||||
|`[n:]`|Maximum number of matching classes with details (100 by default)|
|
||||
|
||||
> *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/>
|
||||
> `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`.
|
||||
|
||||
### Usage
|
||||
|
||||
* Wildcards match search
|
||||
|
||||
`sc demo.*`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ sc demo.*
|
||||
demo.MathGame
|
||||
Affect(row-cnt:1) cost in 55 ms.
|
||||
```
|
||||
|
||||
* View class details
|
||||
|
||||
`sc -d demo.MathGame`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ sc -d demo.MathGame
|
||||
class-info demo.MathGame
|
||||
code-source /private/tmp/arthas-demo.jar
|
||||
name demo.MathGame
|
||||
isInterface false
|
||||
isAnnotation false
|
||||
isEnum false
|
||||
isAnonymousClass false
|
||||
isArray false
|
||||
isLocalClass false
|
||||
isMemberClass false
|
||||
isPrimitive false
|
||||
isSynthetic false
|
||||
simple-name MathGame
|
||||
modifier public
|
||||
annotation
|
||||
interfaces
|
||||
super-class +-java.lang.Object
|
||||
class-loader +-sun.misc.Launcher$AppClassLoader@3d4eac69
|
||||
+-sun.misc.Launcher$ExtClassLoader@66350f69
|
||||
classLoaderHash 3d4eac69
|
||||
|
||||
Affect(row-cnt:1) cost in 875 ms.
|
||||
```
|
||||
|
||||
Take a note of the classLoaderHash here:`3d4eac69`, and use it to replace `<classLoaderHash>` and execute the following command.
|
||||
|
||||
* Specify classLoader
|
||||
|
||||
`sc -c <classLoaderHash> -d demo*`
|
||||
|
||||
* View class fields
|
||||
|
||||
`sc -d -f demo.MathGame`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ sc -d -f demo.MathGame
|
||||
class-info demo.MathGame
|
||||
code-source /private/tmp/arthas-demo.jar
|
||||
name demo.MathGame
|
||||
isInterface false
|
||||
isAnnotation false
|
||||
isEnum false
|
||||
isAnonymousClass false
|
||||
isArray false
|
||||
isLocalClass false
|
||||
isMemberClass false
|
||||
isPrimitive false
|
||||
isSynthetic false
|
||||
simple-name MathGame
|
||||
modifier public
|
||||
annotation
|
||||
interfaces
|
||||
super-class +-java.lang.Object
|
||||
class-loader +-sun.misc.Launcher$AppClassLoader@3d4eac69
|
||||
+-sun.misc.Launcher$ExtClassLoader@66350f69
|
||||
classLoaderHash 3d4eac69
|
||||
fields modifierprivate,static
|
||||
type java.util.Random
|
||||
name random
|
||||
value java.util.Random@522b4
|
||||
08a
|
||||
|
||||
modifierprivate
|
||||
type int
|
||||
name illegalArgumentCount
|
||||
|
||||
|
||||
Affect(row-cnt:1) cost in 19 ms.
|
||||
```
|
Loading…
Reference in New Issue