new arthas doc by vuepress

gh-pages
hengyunabc 3 years ago
parent ecc11d5bd6
commit 87025f4bfb

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -1,384 +0,0 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="zh-CN" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh-CN" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arthas 用户文档 &mdash; Arthas 3.0.1-RC-SNAPSHOT 文档</title>
<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="索引" href="genindex.html" />
<link rel="search" title="搜索" 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.1-RC-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">安装</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">快速入门</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">进阶使用</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">命令列表</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/labels/user-case">用户案例</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/labels/question-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/CONTRIBUTING.md">参与贡献</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>Arthas 用户文档</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/Home.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="arthas">
<span id="arthas"></span><h1>Arthas 用户文档<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h1>
<div class="section" id="arthas">
<span id="id1"></span><h2>Arthas阿尔萨斯 能为你做什么?<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h2>
<p>当你遇到以下类似问题而束手无策时,你看到了这篇文档,看到了 <code class="docutils literal notranslate"><span class="pre">Arthas</span></code>,那么恭喜你,你朝正确的方向又迈了一大步。</p>
<ol class="simple">
<li>这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception</li>
<li>我改的代码为什么没有执行到?难道是我没 commit分支搞错了</li>
<li>遇到问题无法在预发 debug 一下,难道只能通过加日志再重新预发布吗?</li>
<li>线上遇到某个用户的数据处理有问题,但线上同样无法 debug线下无法重现</li>
<li>是否有一个全局视角来查看系统的运行状况?</li>
<li>有什么办法可以监控到容器和中间件AliTomcat、HSF、Notify 等)的实时运行状态?</li>
</ol>
<p><code class="docutils literal notranslate"><span class="pre">Arthas</span></code> 是全新的在线诊断工具采用命令行交互模式支持web端在线诊断同时提供丰富的 <code class="docutils literal notranslate"><span class="pre">Tab</span></code> 自动补全功能,进一步方便进行问题的定位和诊断。</p>
</div>
<div class="section" id="release-notes">
<span id="release-notes"></span><h2><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/release-notes">Release Notes</a><a class="headerlink" href="#release-notes" title="永久链接至标题"></a></h2>
</div>
<div class="section" id="arthas">
<span id="id2"></span><h2>Arthas 安装及使用<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h2>
<div class="section" id="">
<span id="id3"></span><h3>1. 在线诊断<a class="headerlink" href="#" title="永久链接至标题"></a></h3>
<p>TODO</p>
</div>
<div class="section" id="arthas">
<span id="id4"></span><h3>2. 通过脚本使用Arthas<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h3>
<ul class="simple">
<li>下载脚本</li>
</ul>
<div class="section" id="mac-linux">
<span id="mac-linux"></span><h4>MAC/Linux<a class="headerlink" href="#mac-linux" title="永久链接至标题"></a></h4>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>curl -L TODO /install.sh <span class="p">|</span> sh
</pre></div>
</div>
</div>
<div class="section" id="windows">
<span id="windows"></span><h4>Windows<a class="headerlink" href="#windows" title="永久链接至标题"></a></h4>
<p>点击 <a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/TODO">下载</a> 最新zip包</p>
<blockquote>
<div>如遇无法下载,请参考<a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/install-detail">这里</a></div></blockquote>
<ul class="simple">
<li>启动 Arthas</li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">./as.sh</span></code></p>
<p>执行该脚本的用户需要和目标进程具有相同的权限。比如以<code class="docutils literal notranslate"><span class="pre">admin</span></code>用户来执行:</p>
<p><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><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></p>
<p>详细的启动脚本说明,请参考<a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/start-arthas">这里</a></p>
<p>如果attatch不上目标进程可以查看<code class="docutils literal notranslate"><span class="pre">~/logs/arthas/</span></code> 目录下的日志。</p>
</div>
</div>
<div class="section" id="">
<span id="id5"></span><h3>3. 开启诊断之旅<a class="headerlink" href="#" title="永久链接至标题"></a></h3>
<p>为了使你快速找到适合你分析、诊断问题的命令,我们将 Arthas 的命令按问题的类型做了一个大的分类,如下:</p>
<div class="section" id="">
<span id="id6"></span><h4>想快速了解系统、应用运行状况<a class="headerlink" href="#" title="永久链接至标题"></a></h4>
<hr class="docutils" />
<ul class="simple">
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/dashboard">dashboard</a>——当前系统的实时数据面板</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/thread">thread</a>——查看当前 JVM 的线程堆栈信息</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/jvm">jvm</a>——查看当前 JVM 的信息</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/sysprop">sysprop</a>——查看和修改JVM的系统属性</li>
<li><strong>New!</strong> <a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/getstatic">getstatic</a>——查看类的静态属性</li>
</ul>
</div>
<div class="section" id="classclassloader">
<span id="classclassloader"></span><h4>类、方法冲突、class文件、classloader继承问题等<a class="headerlink" href="#classclassloader" title="永久链接至标题"></a></h4>
<hr class="docutils" />
<ul class="simple">
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/sc">sc</a>——查看JVM已加载的类信息</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/sm">sm</a>——查看已加载类的方法信息</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/dump">dump</a>——dump 已加载类的 byte code 到特定目录</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/redefine">redefine</a>——加载外部的<code class="docutils literal notranslate"><span class="pre">.class</span></code>文件redefine到JVM里</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/jad">jad</a>——反编译指定已加载类的源码</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/classloader">classloader</a>——查看classloader的继承树urls类加载信息使用classloader去getResource</li>
</ul>
</div>
<div class="section" id="">
<span id="id7"></span><h4>查看方法执行参数、异常、返回值、调用路径等<a class="headerlink" href="#" title="永久链接至标题"></a></h4>
<blockquote>
<div>非常重要,请注意,这些命令,都通过字节码增强技术来实现的,会在指定类的方法中插入一些切面来实现数据统计和观测,因此在线上、预发使用时,请尽量明确需要观测的类、方法以及条件,诊断结束要执行 <code class="docutils literal notranslate"><span class="pre">shutdown</span></code> 或将增强过的类执行 <code class="docutils literal notranslate"><span class="pre">reset</span></code> 命令。</div></blockquote>
<ul class="simple">
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/monitor">monitor</a>——方法执行监控</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/watch">watch</a>——方法执行数据观测</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/trace">trace</a>——方法内部调用路径,并输出方法路径上的每个节点上耗时</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/stack">stack</a>——输出当前方法被调用的调用路径</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/tt">tt</a>——方法执行数据的时空隧道,记录下指定方法每次调用的入参和返回信息,并能对这些不同的时间下调用进行观测</li>
</ul>
</div>
<div class="section" id="options">
<span id="options"></span><h4>options<a class="headerlink" href="#options" title="永久链接至标题"></a></h4>
<ul class="simple">
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/options">options</a>——查看或设置Arthas全局开关</li>
</ul>
</div>
<div class="section" id="arthas">
<span id="id8"></span><h4>Arthas 基础命令<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h4>
<ul class="simple">
<li>help——查看命令帮助信息</li>
<li>cls——清空当前屏幕区域</li>
<li>session——查看当前会话的信息</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/reset">reset</a>——重置增强类,将被 Arthas 增强过的类全部还原Arthas 服务端关闭时会重置所有增强过的类</li>
<li>version——输出当前目标 Java 进程所加载的 Arthas 版本号</li>
<li>quit——退出当前 Arthas 客户端,其他 Arthas 客户端不受影响</li>
<li>shutdown——关闭 Arthas 服务端,所有 Arthas 客户端全部退出</li>
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/keymap">keymap</a>——Arthas快捷键列表及自定义快捷键</li>
</ul>
</div>
<div class="section" id="">
<span id="id9"></span><h4>管道<a class="headerlink" href="#" title="永久链接至标题"></a></h4>
<p>Arthas支持使用管道对上述命令的结果进行进一步的处理<code class="docutils literal notranslate"><span class="pre">sm</span> <span class="pre">org.apache.log4j.Logger</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">&lt;init&gt;</span></code></p>
<ul class="simple">
<li>grep——搜索满足条件的结果</li>
<li>plaintext——将命令的结果去除颜色</li>
<li>wc——按行统计输出结果</li>
</ul>
</div>
<div class="section" id="">
<span id="id10"></span><h4>后台异步任务<a class="headerlink" href="#" title="永久链接至标题"></a></h4>
<p>当线上出现偶发的问题比如需要watch某个条件而这个条件一天可能才会出现一次时异步后台任务就派上用场了详情请参考<a class="reference internal" href="async.html"><span class="doc">这里</span></a></p>
<ul class="simple">
<li>使用 &gt; 将结果重写向到日志文件,使用 &amp; 指定命令是后台运行session断开不影响任务执行生命周期默认为1天</li>
<li>jobs——列出所有job</li>
<li>kill——强制终止任务</li>
<li>fg——将暂停的任务拉到前台执行</li>
<li>bg——将暂停的任务放到后台执行</li>
</ul>
</div>
</div>
<div class="section" id="faq">
<span id="faq"></span><h3>4. 常见问题及FAQ<a class="headerlink" href="#faq" title="永久链接至标题"></a></h3>
<p>TODO</p>
</div>
<div class="section" id="">
<span id="id11"></span><h3>5. 其他特性说明<a class="headerlink" href="#" title="永久链接至标题"></a></h3>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="async.html">异步命令支持</a></li>
<li class="toctree-l1"><a class="reference internal" href="options.html">执行结果存日志</a></li>
<li class="toctree-l1"><a class="reference internal" href="batch-support.html">批处理的支持</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/TODO/articles/92448">ognl表达式的用法说明</a></li>
</ul>
</div>
</div>
<div class="section" id="">
<span id="id12"></span><h3>6. 用户使用案例<a class="headerlink" href="#" title="永久链接至标题"></a></h3>
<ul class="simple">
<li><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/usercase">用户使用案例</a></li>
<li>[Arthas——码农的才思与浪漫] TODO</li>
</ul>
<p>钉钉交流群号: TODO</p>
</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.1-RC-SNAPSHOT',
LANGUAGE:'zh_CN',
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="_static/translations.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>
</body>
</html>

@ -1,261 +0,0 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="zh-CN" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh-CN" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>&lt;no title&gt; &mdash; Arthas 3.6.2 文档</title>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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="_static/language_data.js"></script>
<script type="text/javascript" src="_static/translations.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<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="索引" href="genindex.html" />
<link rel="search" title="搜索" href="search.html" />
<script>
if (window.location.href.startsWith("https://alibaba.github.io/arthas/")) {
window.location.href = "https://arthas.aliyun.com/doc/" + window.location.href.substr("https://alibaba.github.io/arthas/".length);
}
</script>
<script src="_static/center_page.js"></script>
<link rel="stylesheet" href="https://g.alicdn.com/code/lib/highlight.js/9.13.1/styles/github.min.css">
</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.6.2
</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 external" href="https://arthas.aliyun.com/">首页</a></li>
<li class="toctree-l1"><a class="reference external" href="https://arthas.aliyun.com/doc/en/">English Docs</a></li>
<li class="toctree-l1"><a class="reference external" href="https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn">在线教程(katacoda)</a></li>
<li class="toctree-l1"><a class="reference external" href="https://start.aliyun.com/handson-lab?category=arthas">在线教程(阿里云)</a></li>
<li class="toctree-l1"><a class="reference internal" href="install-detail.html">安装</a></li>
<li class="toctree-l1"><a class="reference internal" href="download.html">下载</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">快速入门</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">进阶使用</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">命令列表</a></li>
<li class="toctree-l1"><a class="reference internal" href="web-console.html">WebConsole</a></li>
<li class="toctree-l1"><a class="reference internal" href="tunnel.html">Arthas Tunnel</a></li>
<li class="toctree-l1"><a class="reference internal" href="http-api.html">Http API</a></li>
<li class="toctree-l1"><a class="reference internal" href="docker.html">Docker</a></li>
<li class="toctree-l1"><a class="reference internal" href="spring-boot-starter.html">Arthas Spring Boot Starter</a></li>
<li class="toctree-l1"><a class="reference internal" href="idea-plugin.html">IDEA 插件</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">用户案例</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ/常见问题</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Star me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md#">编译调试/参与贡献</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/releases">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="contact-us.html">QQ群/钉钉群</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>&lt;no title&gt;</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/README.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">
<p>Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息并能在不修改应用代码的情况下对业务问题进行诊断包括查看方法调用的出入参、异常监测方法执行耗时类加载信息等大大提升线上问题排查效率</p>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018-2020, 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">
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" target="_blank">Fork me at GitHub</a>
</div>
</div>
<script type="text/javascript" src="_static/add_badges.js"></script>
<script src="https://g.alicdn.com/code/lib/highlight.js/9.13.1/highlight.min.js"></script>
<script src="https://g.alicdn.com/code/lib/highlightjs-line-numbers.js/2.5.0/highlightjs-line-numbers.min.js"></script>
<script>
document.querySelectorAll('div.hljs > pre').forEach(function(block) {
hljs.highlightBlock(block);
hljs.lineNumbersBlock(block);
});
</script>
<script type="text/javascript">document.write(unescape("%3Cspan style='display:none;' id='cnzz_stat_icon_1279151497'%3E%3C/span%3E%3Cscript src='https://s4.cnzz.com/z_stat.php%3Fid%3D1279151497' type='text/javascript'%3E%3C/script%3E"));</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>

@ -1,232 +0,0 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="zh-CN" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh-CN" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>&lt;no title&gt; &mdash; Arthas 3.0.1-RC-SNAPSHOT 文档</title>
<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="索引" href="genindex.html" />
<link rel="search" title="搜索" 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.1-RC-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">安装</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">快速入门</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">进阶使用</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">命令列表</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/labels/user-case">用户案例</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/labels/question-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/CONTRIBUTING.md">参与贡献</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>&lt;no title&gt;</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/README_EN.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">
<p>This is home.</p>
</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.1-RC-SNAPSHOT',
LANGUAGE:'zh_CN',
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="_static/translations.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>
</body>
</html>

@ -1,263 +0,0 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="zh-CN" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh-CN" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>&lt;no title&gt; &mdash; Arthas 3.0.1-RC-SNAPSHOT 文档</title>
<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="索引" href="genindex.html" />
<link rel="search" title="搜索" 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.1-RC-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">安装</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">快速入门</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">进阶使用</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">命令列表</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/labels/user-case">用户案例</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/labels/question-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/CONTRIBUTING.md">参与贡献</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>&lt;no title&gt;</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/SUMMARY.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">
<ul>
<li><p class="first">命令使用</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/dashboard">系统指标</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/thread">线程堆栈</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/jvm">JVM信息</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/sc">查看类信息</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/sm">查看方法信息</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/dump">dump字节码</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/jad">反编译类</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/classloader">查看类加载信息</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/monitor">方法执行监控</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/watch">方法AOP观测</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/trace">方法内部路径耗时</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/stack">查看方法调用栈</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/tt">方法执行记录与回放</a></li>
</ul>
</div>
</li>
<li><p class="first"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/start-arthas">启动脚本说明</a></p>
</li>
<li><p class="first"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/release-notes">Release Notes</a></p>
</li>
<li><p class="first">常见问题</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/tree/master/site/src/site/sphinx/TODO">FAQ</a></li>
</ul>
</div>
</li>
</ul>
</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.1-RC-SNAPSHOT',
LANGUAGE:'zh_CN',
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="_static/translations.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>
</body>
</html>

@ -1,135 +0,0 @@
Arthas 用户文档
===
## Arthas阿尔萨斯 能为你做什么?
当你遇到以下类似问题而束手无策时,你看到了这篇文档,看到了 `Arthas`,那么恭喜你,你朝正确的方向又迈了一大步。
0. 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception
0. 我改的代码为什么没有执行到?难道是我没 commit分支搞错了
0. 遇到问题无法在预发 debug 一下,难道只能通过加日志再重新预发布吗?
0. 线上遇到某个用户的数据处理有问题,但线上同样无法 debug线下无法重现
0. 是否有一个全局视角来查看系统的运行状况?
0. 有什么办法可以监控到容器和中间件AliTomcat、HSF、Notify 等)的实时运行状态?
`Arthas` 是全新的在线诊断工具采用命令行交互模式支持web端在线诊断同时提供丰富的 `Tab` 自动补全功能,进一步方便进行问题的定位和诊断。
## [Release Notes](release-notes)
## Arthas 安装及使用
### 1. 在线诊断
TODO
### 2. 通过脚本使用Arthas
* 下载脚本
#### MAC/Linux
```sh
curl -L TODO /install.sh | sh
```
#### Windows
点击 [下载](TODO) 最新zip包
> 如遇无法下载,请参考[这里](install-detail)
* 启动 Arthas
`./as.sh`
执行该脚本的用户需要和目标进程具有相同的权限。比如以`admin`用户来执行:
`sudo su admin && ./as.sh` 或 `sudo -u admin -EH ./as.sh`
详细的启动脚本说明,请参考[这里](start-arthas)
如果attatch不上目标进程可以查看`~/logs/arthas/` 目录下的日志。
### 3. 开启诊断之旅
为了使你快速找到适合你分析、诊断问题的命令,我们将 Arthas 的命令按问题的类型做了一个大的分类,如下:
#### 想快速了解系统、应用运行状况
---
* [dashboard](dashboard)——当前系统的实时数据面板
* [thread](thread)——查看当前 JVM 的线程堆栈信息
* [jvm](jvm)——查看当前 JVM 的信息
* [sysprop](sysprop)——查看和修改JVM的系统属性
* **New!** [getstatic](getstatic)——查看类的静态属性
#### 类、方法冲突、class文件、classloader继承问题等
---
* [sc](sc)——查看JVM已加载的类信息
* [sm](sm)——查看已加载类的方法信息
* [dump](dump)——dump 已加载类的 byte code 到特定目录
* [redefine](redefine)——加载外部的`.class`文件redefine到JVM里
* [jad](jad)——反编译指定已加载类的源码
* [classloader](classloader)——查看classloader的继承树urls类加载信息使用classloader去getResource
#### 查看方法执行参数、异常、返回值、调用路径等
> 非常重要,请注意,这些命令,都通过字节码增强技术来实现的,会在指定类的方法中插入一些切面来实现数据统计和观测,因此在线上、预发使用时,请尽量明确需要观测的类、方法以及条件,诊断结束要执行 `shutdown` 或将增强过的类执行 `reset` 命令。
* [monitor](monitor)——方法执行监控
* [watch](watch)——方法执行数据观测
* [trace](trace)——方法内部调用路径,并输出方法路径上的每个节点上耗时
* [stack](stack)——输出当前方法被调用的调用路径
* [tt](tt)——方法执行数据的时空隧道,记录下指定方法每次调用的入参和返回信息,并能对这些不同的时间下调用进行观测
#### options
* [options](options)——查看或设置Arthas全局开关
#### Arthas 基础命令
* help——查看命令帮助信息
* cls——清空当前屏幕区域
* session——查看当前会话的信息
* [reset](reset)——重置增强类,将被 Arthas 增强过的类全部还原Arthas 服务端关闭时会重置所有增强过的类
* version——输出当前目标 Java 进程所加载的 Arthas 版本号
* quit——退出当前 Arthas 客户端,其他 Arthas 客户端不受影响
* shutdown——关闭 Arthas 服务端,所有 Arthas 客户端全部退出
* [keymap](keymap)——Arthas快捷键列表及自定义快捷键
#### 管道
Arthas支持使用管道对上述命令的结果进行进一步的处理如`sm org.apache.log4j.Logger | grep <init>`
* grep——搜索满足条件的结果
* plaintext——将命令的结果去除颜色
* wc——按行统计输出结果
#### 后台异步任务
当线上出现偶发的问题比如需要watch某个条件而这个条件一天可能才会出现一次时异步后台任务就派上用场了详情请参考[这里](async.md)
* 使用 > 将结果重写向到日志文件,使用 & 指定命令是后台运行session断开不影响任务执行生命周期默认为1天
* jobs——列出所有job
* kill——强制终止任务
* fg——将暂停的任务拉到前台执行
* bg——将暂停的任务放到后台执行
### 4. 常见问题及FAQ
TODO
### 5. 其他特性说明
* [异步命令支持](async.md)
* [执行结果存日志](options.md)
* [批处理的支持](batch-support.md)
* [ognl表达式的用法说明](TODO/articles/92448)
### 6. 用户使用案例
* [用户使用案例](usercase)
* [Arthas——码农的才思与浪漫] TODO
钉钉交流群号: TODO

@ -1 +0,0 @@
Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息并能在不修改应用代码的情况下对业务问题进行诊断包括查看方法调用的出入参、异常监测方法执行耗时类加载信息等大大提升线上问题排查效率

@ -1 +0,0 @@
This is home.

@ -1,18 +0,0 @@
* 命令使用
* [系统指标](dashboard)
* [线程堆栈](thread)
* [JVM信息](jvm)
* [查看类信息](sc)
* [查看方法信息](sm)
* [dump字节码](dump)
* [反编译类](jad)
* [查看类加载信息](classloader)
* [方法执行监控](monitor)
* [方法AOP观测](watch)
* [方法内部路径耗时](trace)
* [查看方法调用栈](stack)
* [方法执行记录与回放](tt)
* [启动脚本说明](start-arthas)
* [Release Notes](release-notes)
* 常见问题
* [FAQ](TODO)

@ -1,172 +0,0 @@
进阶使用
===
## 基础命令
* help——查看命令帮助信息
* [cat](cat.md)——打印文件内容和linux里的cat命令类似
* [echo](echo.md)--打印参数和linux里的echo命令类似
* [grep](grep.md)——匹配查找和linux里的grep命令类似
* [base64](base64.md)——base64编码转换和linux里的base64命令类似
* [tee](tee.md)——复制标准输入到标准输出和指定的文件和linux里的tee命令类似
* [pwd](pwd.md)——返回当前的工作目录和linux命令类似
* cls——清空当前屏幕区域
* session——查看当前会话的信息
* [reset](reset.md)——重置增强类,将被 Arthas 增强过的类全部还原Arthas 服务端关闭时会重置所有增强过的类
* version——输出当前目标 Java 进程所加载的 Arthas 版本号
* history——打印命令历史
* quit——退出当前 Arthas 客户端,其他 Arthas 客户端不受影响
* stop——关闭 Arthas 服务端,所有 Arthas 客户端全部退出
* [keymap](keymap.md)——Arthas快捷键列表及自定义快捷键
## jvm相关
* [dashboard](dashboard.md)——当前系统的实时数据面板
* [thread](thread.md)——查看当前 JVM 的线程堆栈信息
* [jvm](jvm.md)——查看当前 JVM 的信息
* [sysprop](sysprop.md)——查看和修改JVM的系统属性
* [sysenv](sysenv.md)——查看JVM的环境变量
* [vmoption](vmoption.md)——查看和修改JVM里诊断相关的option
* [perfcounter](perfcounter.md)——查看当前 JVM 的Perf Counter信息
* [logger](logger.md)——查看和修改logger
* [getstatic](getstatic.md)——查看类的静态属性
* [ognl](ognl.md)——执行ognl表达式
* [mbean](mbean.md)——查看 Mbean 的信息
* [heapdump](heapdump.md)——dump java heap, 类似jmap命令的heap dump功能
* [vmtool](vmtool.md)——从jvm里查询对象执行forceGc
## class/classloader相关
* [sc](sc.md)——查看JVM已加载的类信息
* [sm](sm.md)——查看已加载类的方法信息
* [jad](jad.md)——反编译指定已加载类的源码
* [mc](mc.md)——内存编译器,内存编译`.java`文件为`.class`文件
* [retransform](retransform.md)——加载外部的`.class`文件retransform到JVM里
* [redefine](redefine.md)——加载外部的`.class`文件redefine到JVM里
* [dump](dump.md)——dump 已加载类的 byte code 到特定目录
* [classloader](classloader.md)——查看classloader的继承树urls类加载信息使用classloader去getResource
## monitor/watch/trace相关
> 请注意,这些命令,都通过字节码增强技术来实现的,会在指定类的方法中插入一些切面来实现数据统计和观测,因此在线上、预发使用时,请尽量明确需要观测的类、方法以及条件,诊断结束要执行 `stop` 或将增强过的类执行 `reset` 命令。
* [monitor](monitor.md)——方法执行监控
* [watch](watch.md)——方法执行数据观测
* [trace](trace.md)——方法内部调用路径,并输出方法路径上的每个节点上耗时
* [stack](stack.md)——输出当前方法被调用的调用路径
* [tt](tt.md)——方法执行数据的时空隧道,记录下指定方法每次调用的入参和返回信息,并能对这些不同的时间下调用进行观测
## profiler/火焰图
* [profiler](profiler.md)--使用[async-profiler](https://github.com/jvm-profiling-tools/async-profiler)对应用采样,生成火焰图
## 鉴权
* [auth](auth.md)--鉴权
## options
* [options](options.md)——查看或设置Arthas全局开关
## 管道
Arthas支持使用管道对上述命令的结果进行进一步的处理如`sm java.lang.String * | grep 'index'`
* grep——搜索满足条件的结果
* plaintext——将命令的结果去除ANSI颜色
* wc——按行统计输出结果
## 后台异步任务
当线上出现偶发的问题比如需要watch某个条件而这个条件一天可能才会出现一次时异步后台任务就派上用场了详情请参考[这里](async.md)
* 使用 > 将结果重写向到日志文件,使用 & 指定命令是后台运行session断开不影响任务执行生命周期默认为1天
* jobs——列出所有job
* kill——强制终止任务
* fg——将暂停的任务拉到前台执行
* bg——将暂停的任务放到后台执行
## Web Console
通过websocket连接Arthas。
* [Web Console](web-console.md)
## Arthas Properties
* [Arthas Properties](arthas-properties.md)
## 以java agent方式启动
* [以java agent方式启动](agent.md)
## as.sh 和 arthas-boot 技巧
* 通过`select`功能选择attach的进程。
正常情况下,每次执行`as.sh`/`arthas-boot.jar`需要选择或者指定PID。这样会比较麻烦因为每次启动应用它的PID会变化。
比如,已经启动了`math-game.jar`,使用`jps`命令查看:
```bash
$ jps
58883 math-game.jar
58884 Jps
```
通过`select`参数可以指定进程名字,非常方便。
```bash
$ ./as.sh --select math-game
Arthas script version: 3.3.6
[INFO] JAVA_HOME: /tmp/java/8.0.222-zulu
Arthas home: /Users/admin/.arthas/lib/3.3.6/arthas
Calculating attach execution time...
Attaching to 59161 using version /Users/admin/.arthas/lib/3.3.6/arthas...
real 0m0.572s
user 0m0.281s
sys 0m0.039s
Attach success.
telnet connecting to arthas server... current timestamp is 1594280799
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki https://arthas.aliyun.com/doc
tutorials https://arthas.aliyun.com/doc/arthas-tutorials.html
version 3.3.6
pid 58883
```
## 用户数据回报
在`3.1.4`版本后,增加了用户数据回报功能,方便统一做安全或者历史数据统计。
在启动时,指定`stat-url`,就会回报执行的每一行命令,比如: `./as.sh --stat-url 'http://192.168.10.11:8080/api/stat'`
在tunnel server里有一个示例的回报代码用户可以自己在服务器上实现。
[StatController.java](https://github.com/alibaba/arthas/blob/master/tunnel-server/src/main/java/com/alibaba/arthas/tunnel/server/app/web/StatController.java)
## 其他特性
* [异步命令支持](async.md)
* [执行结果存日志](save-log.md)
* [批处理的支持](batch-support.md)
* [ognl表达式的用法说明](https://github.com/alibaba/arthas/issues/11)

@ -1,47 +0,0 @@
表达式核心变量
===
无论是匹配表达式也好、观察表达式也罢,他们核心判断变量都是围绕着一个 Arthas 中的通用通知对象 `Advice` 进行。
它的简略代码结构如下
```java
public class Advice {
private final ClassLoader loader;
private final Class<?> clazz;
private final ArthasMethod method;
private final Object target;
private final Object[] params;
private final Object returnObj;
private final Throwable throwExp;
private final boolean isBefore;
private final boolean isThrow;
private final boolean isReturn;
// getter/setter
}
```
这里列一个表格来说明不同变量的含义
|变量名|变量解释|
|---:|:---|
|loader|本次调用类所在的 ClassLoader|
|clazz|本次调用类的 Class 引用|
|method|本次调用方法反射引用|
|target|本次调用类的实例|
|params|本次调用参数列表,这是一个数组,如果方法是无参方法则为空数组|
|returnObj|本次调用返回的对象。当且仅当 `isReturn==true` 成立时候有效,表明方法调用是以正常返回的方式结束。如果当前方法无返回值 `void`,则值为 null|
|throwExp|本次调用抛出的异常。当且仅当 `isThrow==true` 成立时有效,表明方法调用是以抛出异常的方式结束。|
|isBefore|辅助判断标记,当前的通知节点有可能是在方法一开始就通知,此时 `isBefore==true` 成立,同时 `isThrow==false` 和 `isReturn==false`,因为在方法刚开始时,还无法确定方法调用将会如何结束。|
|isThrow|辅助判断标记,当前的方法调用以抛异常的形式结束。|
|isReturn|辅助判断标记,当前的方法调用以正常返回的形式结束。|
所有变量都可以在表达式中直接使用,如果在表达式中编写了不符合 OGNL 脚本语法或者引入了不在表格中的变量,则退出命令的执行;用户可以根据当前的异常信息修正`条件表达式`或`观察表达式`
* 特殊用法请参考:[https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71)
* OGNL表达式官网[https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)

@ -1,15 +0,0 @@
以Java Agent的方式启动
===
通常Arthas是以动态attach的方式来诊断应用但从`3.2.0`版本起Arthas支持直接以 java agent的方式启动。
比如下载全量的arthas zip包解压之后以 `-javaagent` 的参数指定`arthas-agent.jar`来启动:
```
java -javaagent:/tmp/test/arthas-agent.jar -jar math-game.jar
```
默认的配置项在解压目录里的`arthas.properties`文件里。参考:[Arthas Properties](arthas-properties.md)
Java Agent机制参考 https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html

@ -1,60 +0,0 @@
Arthas Properties
===
`arthas.properties`文件在arthas的目录下。
* 如果是自动下载的arthas则目录在`~/.arthas/lib/3.x.x/arthas/`下面
* 如果是下载的完整包在arthas解压目录下
## 支持的配置项
> 注意配置必须是`驼峰`的和spring boot的`-`风格不一样。spring boot应用才同时支持`驼峰` 和 `-`风格的配置。
```
#arthas.config.overrideAll=true
arthas.telnetPort=3658
arthas.httpPort=8563
arthas.ip=127.0.0.1
# seconds
arthas.sessionTimeout=1800
#arthas.appName=demoapp
#arthas.tunnelServer=ws://127.0.0.1:7777/ws
#arthas.agentId=mmmmmmyiddddd
```
* 如果配置 `arthas.telnetPort`为 -1 则不listen telnet端口。`arthas.httpPort`类似。
* 如果配置 `arthas.telnetPort`为 0 则随机telnet端口在`~/logs/arthas/arthas.log`里可以找到具体端口日志。`arthas.httpPort`类似。
> 如果是防止一个机器上启动多个 arthas端口冲突。可以配置为随机端口或者配置为 -1并且通过tunnel server来使用arthas。
### 禁止指定命令
> since 3.5.2
比如配置:
```
arthas.disabledCommands=stop,dump
```
也可以在命令行配置: `--disabled-commands stop,dump` 。
> 默认情况下arthas-spring-boot-starter会禁掉`stop`命令。
## 配置的优先级
配置的优先级是:命令行参数 > System Env > System Properties > arthas.properties 。
比如:
* `./as.sh --telnet-port 9999` 传入的配置会覆盖掉`arthas.properties`里的默认值`arthas.telnetPort=3658`。
* 如果应用自身设置了 system properties `arthas.telnetPort=8888`,则会覆盖掉`arthas.properties`里的默认值`arthas.telnetPort=3658`。
如果想要 `arthas.properties`的优先级最高,则可以配置 `arthas.config.overrideAll=true` 。

@ -1,112 +0,0 @@
### Arthas3.0的新特性
#### 在线诊断功能
Arthas3.0中最重要的特性,不需要登陆机器就可以对应用进行诊断,体验和本地诊断完全一致
##### 使用步骤
TODO
##### 动图演示
TODO
#### 管道支持
Arthas 3.0开始支持管道, 率先提供了`grep`,`wc`,`plaintext`的支持。
### 去groovy依赖
groovy表达式在arthas2.0中大量使用例如watch表达式
```bash
watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add "params + ' ' + returnObj" params.size()==2
```
其中`"params + ' ' + returnObj"`以及`params.size()==2`背后其实都使用了groovy来进行表达式求值如果反复大量的运行这些表达式groovy会创建大量的classloader打满perm区从而触发FGC。
为了避免这个问题Arthas 3.0中使用了ognl这个更加轻量的表达式求值库来代替groovy彻底解决了groovy引起的FGC风险。但由于这个替换导致原来使用groovy脚本编写的自定义脚本失效。这个问题留待后续解决。
在3.0中watch命令的表达式部分的书写有了一些改变详见[这里](https://arthas.aliyun.com/doc/watch)
#### 提升rt统计精度
Arthas 2.0中统计rt都是以`ms`为单位对于某些比较小的方法调用耗时在毫秒以下的都会被认为是0ms造成trace总时间和各方法的时间相加不一致等问题虽然这里面确实会有误差主要Arthas自身的开销。Arthas 3.0中所有rt的单位统一改为使用`ns`来统计精准捕获你的方法耗时让0ms这样无意义的统计数据不再出现
```
$ tt -l
INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD
------------------------------------------------------------------------------------------------------------------------------------------------------------
1000 2017-02-24 10:56:46 808.743525 true false 0x3bd5e918 TestTraceServlet doGet
1001 2017-02-24 10:56:55 805.799155 true false 0x3bd5e918 TestTraceServlet doGet
1002 2017-02-24 10:57:04 808.026935 true false 0x3bd5e918 TestTraceServlet doGet
1003 2017-02-24 10:57:22 805.036963 true false 0x3bd5e918 TestTraceServlet doGet
1004 2017-02-24 10:57:24 803.581886 true false 0x3bd5e918 TestTraceServlet doGet
1005 2017-02-24 10:57:39 814.657657 true false 0x3bd5e918 TestTraceServlet doGet
```
#### watch/stack/trace命令支持按耗时过滤
我们在trace的时候经常会出现某个方法间隙性的rt飙高但是我们只想知道rt高的时候是哪里慢了对于正常rt的方法我们并不关心Arthas 3.0支持了按`#cost`(方法执行耗时,单位为`ms`)进行过滤只输出符合条件的trace路径目前这三个命令的相关文档已经做了更新增加了该用法的示例。
#### sysprop命令操作SystemProperty
sysprop命令支持查看所有的系统属性以及针对特定属性进行查看和修改。
```
$ sysprop
...
os.arch x86_64
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
user.dir /Users/wangtao/work/ali-tomcat-home/ant-develop/output/build
catalina.vendor alibaba
line.separator
java.vm.name Java HotSpot(TM) 64-Bit Server VM
file.encoding UTF-8
org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUA true
LS_IN_VALUE
com.taobao.tomcat.info Apache Tomcat/7.0.70.1548
java.specification.version 1.8
$ sysprop java.version
java.version=1.8.0_51
$ sysprop production.mode true
Successfully changed the system property.
production.mode=true
```
#### thread命令支持指定采样时间
thread命令计算线程cpu占用的逻辑默认是采样100ms内各个线程的cpu使用情况并计算cpu消耗占比。有时候100ms的时间间隔太短看不出问题所在Arthas3.0中thread命令支持设置采样间隔(以`ms`为单位)可以观察任意时间段内的cpu消耗占比情况。
```
$ thread -i 1000
Threads Total: 74, NEW: 0, RUNNABLE: 17, BLOCKED: 0, WAITING: 15, TIMED_WAITING: 42, TERMINATED: 0
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON
78 com.taobao.config.client.timer main 5 TIMED_WAITING 22 0:0 false true
92 Abandoned connection cleanup thread main 5 TIMED_WAITING 15 0:2 false true
361 as-command-execute-daemon system 10 RUNNABLE 14 0:0 false true
67 HSF-Remoting-Timer-10-thread-1 main 10 TIMED_WAITING 12 0:2 false true
113 JamScheduleThread system 9 TIMED_WAITING 2 0:0 false true
14 Thread-3 main 5 RUNNABLE 2 0:0 false false
81 com.taobao.remoting.TimerThread main 5 TIMED_WAITING 2 0:0 false true
104 http-bio-7001-AsyncTimeout main 5 TIMED_WAITING 2 0:0 false true
123 nioEventLoopGroup-2-1 system 10 RUNNABLE 2 0:0 false false
127 nioEventLoopGroup-3-2 system 10 RUNNABLE 2 0:0 false false
345 nioEventLoopGroup-3-3 system 10 RUNNABLE 2 0:0 false false
358 nioEventLoopGroup-3-4 system 10 RUNNABLE 2 0:0 false false
27 qos-boss-1-1 main 5 RUNNABLE 2 0:0 false true
22 EagleEye-AsyncAppender-Thread-BizLog main 5 TIMED_WAITING 1 0:0 false true
```
#### trace命令自动高亮显示最耗时方法调用
trace命令现在会自动显示
![Untitled2](TODO /Untitled2.gif)

@ -1,109 +0,0 @@
Arthas 3.0使用说明
===
## 命令行诊断
1. 安装Arthas 3.0启动脚本
```
curl -sLk http://TODO/arthas/install.sh | sh
```
2. 可以直接运行`./as.sh`,启动脚本会自动更新到最新版本
```
➜ tmp ./as.sh
Found existing java process, please choose one and hit RETURN.
* [1]: 53090 org.apache.catalina.startup.Bootstrap
[2]: 50020
[3]: 69893 org.jetbrains.idea.maven.server.RemoteMavenServer
[4]: 93320 org.jetbrains.jps.cmdline.Launcher
updating version 3.0.20170224142641 ...
######################################################################## 100.0%
Archive: /var/tmp/temp_3.0.20170224142641_35932/arthas-3.0.20170224142641-bin.zip
creating: /var/tmp/temp_3.0.20170224142641_35932/arthas/
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/arthas-agent.jar
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/arthas-client.jar
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/arthas-core.jar
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/arthas-spy.jar
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/as.bat
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/as.sh
inflating: /var/tmp/temp_3.0.20170224142641_35932/arthas/install-local.sh
update completed.
Calculating attach excecution time...
Attaching to 53090...
real 0m0.336s
user 0m0.498s
sys 0m0.075s
Attach success.
Connecting to arthas server... current timestamp is 1488178414
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki: https://github.com/alibaba/arthas/wiki/
version: 3.0.20170227131708
pid: 53090
timestamp: 1488178414548
```
### telnet远程诊断
只要在上一步中启动了Arthas Server 那么你可以直接在本地针对日常环境的机器或者是跳板机针对预发和线上机器通过telnet命令直接远程连上去诊断使用上的体验完全一致。
```
➜ telnet 11.164.45.24 3658
Trying 11.164.45.24...
Connected to 11.164.45.24.
Escape character is '^]'.
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki: https://github.com/alibaba/arthas/wiki/home
version: 3.0.20170315140000
pid: 1463
timestamp: 1490938898194
$
```
## 新特性介绍
请参考[Arthas 3.0新特性](https://github.com/alibaba/arthas/wiki/arthas_3_0/new_feature)
## FAQ
首先请确保你的目标机器上Arthas 2.0的server正常的shutdown了。否则Arthas 3.0连上去之后不会正常启动。
### 关于web console中文本的复制粘贴
目前不同浏览器对复制粘贴的支持程度各不相同mac下的Chrome是支持的最好的目前的支持情况如下我们正在想办法提供更好的复制粘贴体验
| 操作系统 | 浏览器 | 复制 | 粘贴 |
| ------- | ------- | -------------- | ---------------- |
| macOS | Chrome | COMMAND-C鼠标右键-复制 | COMMAND-V鼠标右键-粘贴 |
| macOS | Safari | 鼠标右键-复制 | 鼠标右键-粘贴 |
| macOS | Firefox | | |
| Windows | Chrome | Ctrl + C | Ctrl + Shift + V |
| Windows | Firefox | | |
### 关于字体大小
如果觉得字体太小可以通过浏览器内置的字体调整功能进行web console支持自适应调整。
| 操作系统 | 浏览器 | 增大字体 | 减小字体 |
| ------- | ------- | -------------- | ---------------- |
| macOS | Chrome | COMMAND加= | COMMAND加- |
| macOS | Safari | COMMAND加= | COMMAND加- | |
| macOS | Firefox | | |
| Windows | Chrome | | |
| Windows | Firefox | | |

@ -1,196 +0,0 @@
Arthas 3.0新特性介绍
===
Arthas 3.0在架构上做了重大改造,通过引入`termd`完整的支持了telnet协议并基于websocket封装了telnet协议实现了`Telnet over HTTP`使得在线诊断成为了可能并且保证了本地启动telnet远程访问在线诊断三种方式的体验完全一致。都支持自动补全高亮显示等功能。并且支持`多人同时在线诊断`。
### 在线诊断
Arthas 3.0最重要的特性通过Arthas在线诊断平台无需再登陆目标机器一键启动Arthas并开启诊断
![image](TODO image.png)
具体使用方法请参见[在线诊断使用说明](https://github.com/alibaba/arthas/wiki/arthas_3_0/home)
### 管道支持
Arthas 3.0开始支持管道, 率先提供了`grep`,`wc`,`plaintext`的支持。
```bash
java.vendor.url http://java.oracle.com/
java.vm.vendor Oracle Corporation
java.runtime.name Java(TM) SE Runtime Environment
sun.java.command org.apache.catalina.startup.Bootstrap start
java.class.path /Users/wangtao/work/ali-tomcat-home/ant-develop/output/build/bin/bootstrap.jar
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.version 1.8
java.awt.headless true
java.io.tmpdir /Users/wangtao/work/ali-tomcat-home/ant-develop/output/build/temp
java.vendor.url.bug http://bugreport.sun.com/bugreport/
java.awt.graphicsenv sun.awt.CGraphicsEnvironment
java.ext.dirs /Users/wangtao/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.
/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
java.vm.name Java HotSpot(TM) 64-Bit Server VM
java.specification.version 1.8
$ sysprop | grep java | wc -l
36
```
### 启动自检
针对启动时经常出现的权限问题在启动脚本中增加了自检逻辑脚本会自动判断目标进程是否具备attach权限并给出进一步的提示。
```
[huxing.zhx@v125056161.bja /home/huxing.zhx]
$./as.sh 32260
The current user (huxing.zhx) does not match with the owner of process 32260 (admin).
To solve this, choose one of the following command:
1) sudo su admin && ./as.sh
2) sudo -u admin -EH ./as.sh
```
### 去groovy依赖
groovy表达式在arthas2.0中大量使用例如watch表达式
```bash
watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add "params + ' ' + returnObj" params.size()==2
```
其中`"params + ' ' + returnObj"`以及`params.size()==2`背后其实都使用了groovy来进行表达式求值如果反复大量的运行这些表达式groovy会创建大量的classloader打满perm区从而触发FGC。
为了避免这个问题Arthas 3.0中使用了ognl这个更加轻量的表达式求值库来代替groovy彻底解决了groovy引起的FGC风险。但由于这个替换导致原来使用groovy脚本编写的自定义脚本失效。这个问题留待后续解决。
在3.0中watch命令的表达式部分的书写有了一些改变详见[这里](https://arthas.aliyun.com/doc/watch)
### 提升rt统计精度
Arthas 2.0中统计rt都是以`ms`为单位对于某些比较小的方法调用耗时在毫秒以下的都会被认为是0ms造成trace总时间和各方法的时间相加不一致等问题虽然这里面确实会有误差主要Arthas自身的开销。Arthas 3.0中所有rt的单位统一改为使用`ns`来统计精准捕获你的方法耗时让0ms这样无意义的统计数据不再出现
```
$ tt -l
INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD
------------------------------------------------------------------------------------------------------------------------------------------------------------
1000 2017-02-24 10:56:46 808.743525 true false 0x3bd5e918 TestTraceServlet doGet
1001 2017-02-24 10:56:55 805.799155 true false 0x3bd5e918 TestTraceServlet doGet
1002 2017-02-24 10:57:04 808.026935 true false 0x3bd5e918 TestTraceServlet doGet
1003 2017-02-24 10:57:22 805.036963 true false 0x3bd5e918 TestTraceServlet doGet
1004 2017-02-24 10:57:24 803.581886 true false 0x3bd5e918 TestTraceServlet doGet
1005 2017-02-24 10:57:39 814.657657 true false 0x3bd5e918 TestTraceServlet doGet
```
### watch/stack/trace命令支持按耗时过滤
我们在trace的时候经常会出现某个方法间隙性的rt飙高但是我们只想知道rt高的时候是哪里慢了对于正常rt的方法我们并不关心Arthas 3.0支持了按`#cost`(方法执行耗时,单位为`ms`)进行过滤只输出符合条件的trace路径。
具体用法为:
```
trace/watch/stack class_name method cost_expression
```
例如:
```
$ trace test.arthas.TestTraceServlet doGet #cost>800
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 137 ms.
trace test.arthas.TestTraceServlet doGet #cost>800
`---thread_name=http-bio-8080-exec-9;id=6e;is_daemon=true;priority=5;TCCL=org.apache.catalina.loader.WebappClassLoader
`---[816.880001ms] test.arthas.TestTraceServlet:doGet()
+---[min=0.019223ms,max=1.192115ms,total=1.211338ms,count=2] java.lang.System:currentTimeMillis()
+---[1.407006ms] test.arthas.TestTraceServlet:call1()
+---[381.970892ms] test.arthas.TestTraceServlet:callhsfL1()
+---[0.018866ms] test.arthas.TestPathTrace:<init>()
+---[375.753301ms] test.arthas.TestPathTrace:callPathTrace()
+---[12.352252ms] test.arthas.TestTraceServlet:call3()
+---[2.758025ms] test.arthas.TestTraceServlet:call4()
+---[1.246057ms] test.arthas.TestTraceServlet:call5()
+---[10.306568ms] test.arthas.TestTraceServlet:call6()
+---[8.891933ms] test.arthas.TestTraceServlet:call7()
+---[4.030325ms] test.arthas.TestTraceServlet:call8()
+---[6.51316ms] test.arthas.TestTraceServlet:call9()
+---[0.059405ms] javax.servlet.http.HttpServletResponse:getWriter()
+---[0.013107ms] java.lang.StringBuilder:<init>()
+---[min=0.004892ms,max=0.06357ms,total=0.100672ms,count=3] java.lang.StringBuilder:append()
+---[0.018255ms] java.lang.StringBuilder:toString()
`---[0.028812ms] java.io.PrintWriter:write()
```
上述命令只有当`test.arthas.TestTraceServlet#doGet`方法执行耗时大于800ms时才会输出。
### trace命令优化
#### 自动高亮显示最耗时方法调用
trace命令现在会自动显示
![image](TODO/image.png)
#### 带条件过滤的多级trace
目前trace默认只输出一级方法调用耗时有时候并不能完全看出问题。但是如果展开多级的话每一个方法的耗时都统计会造成方法数量迅速膨胀大大增加trace的开销。
TODO
#### 显示当前线程的信息及eagleeye的traceId
```
trace test.arthas.TestTraceServlet doGet
`---thread_name=http-bio-8080-exec-10;id=da;is_daemon=true;priority=5;TCCL=org.apache.catalina.loader.WebappClassLoader;trace_id=1e09489014879085429791006d969d
```
### sysprop命令操作SystemProperty
sysprop命令支持查看所有的系统属性以及针对特定属性进行查看和修改。
```
$ sysprop
...
os.arch x86_64
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
user.dir /Users/wangtao/work/ali-tomcat-home/ant-develop/output/build
catalina.vendor alibaba
line.separator
java.vm.name Java HotSpot(TM) 64-Bit Server VM
file.encoding UTF-8
org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUA true
LS_IN_VALUE
com.taobao.tomcat.info Apache Tomcat/7.0.70.1548
java.specification.version 1.8
$ sysprop java.version
java.version=1.8.0_51
$ sysprop production.mode true
Successfully changed the system property.
production.mode=true
```
### thread命令支持指定采样时间
thread命令计算线程cpu占用的逻辑默认是采样100ms内各个线程的cpu使用情况并计算cpu消耗占比。有时候100ms的时间间隔太短看不出问题所在Arthas3.0中thread命令支持设置采样间隔(以`ms`为单位)可以观察任意时间段内的cpu消耗占比情况。
```
$ thread -i 1000
Threads Total: 74, NEW: 0, RUNNABLE: 17, BLOCKED: 0, WAITING: 15, TIMED_WAITING: 42, TERMINATED: 0
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON
78 com.taobao.config.client.timer main 5 TIMED_WAITING 22 0:0 false true
92 Abandoned connection cleanup thread main 5 TIMED_WAITING 15 0:2 false true
361 as-command-execute-daemon system 10 RUNNABLE 14 0:0 false true
67 HSF-Remoting-Timer-10-thread-1 main 10 TIMED_WAITING 12 0:2 false true
113 JamScheduleThread system 9 TIMED_WAITING 2 0:0 false true
14 Thread-3 main 5 RUNNABLE 2 0:0 false false
81 com.taobao.remoting.TimerThread main 5 TIMED_WAITING 2 0:0 false true
104 http-bio-7001-AsyncTimeout main 5 TIMED_WAITING 2 0:0 false true
123 nioEventLoopGroup-2-1 system 10 RUNNABLE 2 0:0 false false
127 nioEventLoopGroup-3-2 system 10 RUNNABLE 2 0:0 false false
345 nioEventLoopGroup-3-3 system 10 RUNNABLE 2 0:0 false false
358 nioEventLoopGroup-3-4 system 10 RUNNABLE 2 0:0 false false
27 qos-boss-1-1 main 5 RUNNABLE 2 0:0 false true
22 EagleEye-AsyncAppender-Thread-BizLog main 5 TIMED_WAITING 1 0:0 false true
```

@ -1,69 +0,0 @@
Arthas后台异步任务
===
[`后台异步任务`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=case-async-jobs)
arthas中的后台异步任务使用了仿linux系统任务相关的命令。[linux任务相关介绍](https://ehlxr.me/2017/01/18/Linux-%E4%B8%AD-fg%E3%80%81bg%E3%80%81jobs%E3%80%81-%E6%8C%87%E4%BB%A4/)。
## 1. 使用&在后台执行任务
比如希望执行后台执行trace命令那么调用下面命令
```bash
trace Test t &
```
这时命令在后台执行可以在console中继续执行其他命令。
## 2. 通过jobs查看任务
如果希望查看当前有哪些arthas任务在执行可以执行jobs命令执行结果如下
```bash
$ jobs
[10]*
Stopped watch com.taobao.container.Test test "params[0].{? #this.name == null }" -x 2
execution count : 19
start time : Fri Sep 22 09:59:55 CST 2017
timeout date : Sat Sep 23 09:59:55 CST 2017
session : 3648e874-5e69-473f-9eed-7f89660b079b (current)
```
可以看到目前有一个后台任务在执行。
* job id是10, `*` 表示此job是当前session创建
* 状态是Stopped
* execution count是执行次数从启动开始已经执行了19次
* timeout date是超时的时间到这个时间任务将会自动超时退出
## 3. 任务暂停和取消
当任务正在前台执行,比如直接调用命令`trace Test t`或者调用后台执行命令`trace Test t &`后又通过`fg`命令将任务转到前台。这时console中无法继续执行命令但是可以接收并处理以下事件
* ctrl + z将任务暂停。通过`jbos`查看任务状态将会变为Stopped通过`bg <job-id>`或者`fg <job-id>`可让任务重新开始执行
* ctrl + c停止任务
* ctrl + d按照linux语义应当是退出终端目前arthas中是空实现不处理
## 4. fg、bg命令将命令转到前台、后台继续执行
* 任务在后台执行或者暂停状态(`ctrl + z`暂停任务)时,执行`fg <job-id>`将可以把对应的任务转到前台继续执行。在前台执行时无法在console中执行其他命令
* 当任务处于暂停状态时(`ctrl + z`暂停任务),执行`bg <job-id>`将可以把对应的任务在后台继续执行
* 非当前session创建的job只能由当前session fg到前台执行
## 5. 任务输出重定向
可通过`>`或者`>>`将任务输出结果输出到指定的文件中,可以和`&`一起使用实现arthas命令的后台异步任务。比如
```bash
$ trace Test t >> test.out &
```
这时trace命令会在后台执行并且把结果输出到~/logs/arthas-cache/test.out。可继续执行其他命令。并可查看文件中的命令执行结果。
当连接到远程的arthas server时可能无法查看远程机器的文件arthas同时支持了自动重定向到本地缓存路径。使用方法如下
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/gehui/logs/arthas-cache/28198/2
```
可以看到并没有指定重定向文件位置arthas自动重定向到缓存中了执行命令后会输出job id和cache location。cache location就是重定向文件的路径在系统logs目录下路径包括pid和job id避免和其他任务冲突。命令输出结果到`/Users/gehui/logs/arthas-cache/28198/2`中job id为2。
## 6. 停止命令
异步执行的命令如果希望停止可执行kill <job-id>
## 7. 其他
* 最多同时支持8个命令使用重定向将结果写日志
* 请勿同时开启过多的后台异步命令以免对目标JVM性能造成影响
* 如果不想停止arthas继续执行后台任务可以执行 `quit` 退出arthas控制台`stop` 会停止arthas 服务)

@ -1,82 +0,0 @@
auth
===
> 验证当前会话
### 配置用户名和密码
在attach时可以在命令行指定密码。比如
```
java -jar arthas-boot.jar --password ppp
```
* 可以通过 `--username` 选项来指定用户,默认值是`arthas`。
* 也可以在 `arthas.properties` 里中配置 username/password。命令行的优先级大于配置文件。
* 如果只配置`username`,没有配置`password`,则会生成随机密码,打印在`~/logs/arthas/arthas.log`中
```
Using generated security password: 0vUBJpRIppkKuZ7dYzYqOKtranj4unGh
```
### 本地连接不鉴权
默认情况下,在`arthas.properties`文件里有配置:
```
arthas.localConnectionNonAuth=true
```
当配置密码时使用本地连接也不需要鉴权。默认配置值是true方便本地连接使用。只有远程连接时才需要鉴权。
### 在telnet console里鉴权
连接到arthas后直接执行命令会提示需要鉴权
```bash
[arthas@37430]$ help
Error! command not permitted, try to use 'auth' command to authenticates.
```
使用`auth`命令来鉴权,成功之后可以执行其它命令。
```
[arthas@37430]$ auth ppp
Authentication result: true
```
* 可以通过 `--username` 选项来指定用户,默认值是`arthas`。
### Web console密码验证
打开浏览器,会有弹窗提示需要输入 用户名 和 密码。
成功之后,则可以直接连接上 web console。
### HTTP API 验证
#### Authorization Header方式推荐
Arthas 采用的是 HTTP 标准的 Basic Authorization客户端请求时增加对应的header即可。
* 参考:[https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)
例如,用户名是:`admin`,密码是 `admin`,则组合为字符串: `admin:admin`base64结果是 `YWRtaW46YWRtaW4=`则HTTP 请求增加`Authorization` header
```bash
curl 'http://localhost:8563/api' \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{"action":"exec","command":"version"}'
```
#### URL 参数传递方式
为了方便各种特殊情况,支持了以 parameters 方式传递username和password。比如
```bash
curl 'http://localhost:8563/api?password=admin' \
--data-raw '{"action":"exec","command":"version"}'
```

@ -1,245 +0,0 @@
AutoStructify Component
=======================
AutoStructify is a component in recommonmark that takes a parsed docutil AST by `CommonMarkParser`,
and transform it to another AST that introduces some of more. This enables additional features
of recommonmark syntax, to introduce more structure into the final generated document.
Configuring AutoStructify
-------------------------
The behavior of AutoStructify can be configured via a dict in document setting.
In sphinx, you can configure it by `conf.py`. The following snippet
is what is actually used to generate this document, see full code at [conf.py](conf.py).
```python
github_doc_root = 'https://github.com/rtfd/recommonmark/tree/master/doc/'
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)
```
All the features are by default enabled
***List of options***
* __enable_auto_toc_tree__: whether enable [Auto Toc Tree](#auto-toc-tree) feature.
* __auto_toc_tree_section__: when enabled, [Auto Toc Tree](#auto-toc-tree) will only be enabled on section that matches the title.
* __enable_auto_doc_ref__: whether enable [Auto Doc Ref](#auto-doc-ref) feature. **Deprecated**
* __enable_math__: whether enable [Math Formula](#math-formula)
* __enable_inline_math__: whether enable [Inline Math](#inline-math)
* __enable_eval_rst__: whether [Embed reStructuredText](#embed-restructuredtext) is enabled.
* __url_resolver__: a function that maps a existing relative position in the document to a http link
Auto Toc Tree
-------------
One of important command in tools like sphinx is `toctree`. This is a command to generate table of contents and
tell sphinx about the structure of the documents. In markdown, usually we manually list of contents by a bullet list
of url reference to the other documents.
AutoStructify will transforms bullet list of document URLs
```
* [Title1](doc1.md)
* [Title2](doc2.md)
```
will be translated to the AST of following reStructuredText code
```rst
.. toctree::
:maxdepth: 1
doc1
doc2
```
You can also find the usage of this feature in `index.md` of this document.
Auto Doc Ref
------------
```eval_rst
.. note:: **This option is deprecated.**
This option has been superseded by the default linking behavior, which
will first try to resolve as an internal reference, and then as an
external reference.
```
It is common to refer to another document page in one document. We usually use reference to do that.
AutoStructify will translate these reference block into a structured document reference. For example
```
[API Reference](api_ref.md)
```
will be translated to the AST of following reStructuredText code
```
:doc:`API Reference </api_ref>`
```
And it will be rendered as [API Reference](api_ref)
URL Resolver
------------
Sometimes in a markdown, we want to refer to the code in the same repo.
This can usually be done by a reference by reference path. However, since the generated document is hosted elsewhere,
the relative path may not work in generated document site. URL resolver is introduced to solve this problem.
Basically, you can define a function that maps an relative path of document to the http path that you wish to link to.
For example, the setting mentioned in the beginning of this document used a resolver that maps the files to github.
So `[parser code](../recommonmark/parser.py)` will be translated into [parser code](../recommonmark/parser.py)
Note that the reference to the internal document will not be passed to url resolver, and will be linked to the internal document pages correctly, see [Auto Doc Ref](#auto-doc-ref).
Codeblock Extensions
--------------------
In markdown, you can write codeblocks fenced by (at least) three backticks
(```` ``` ````). The following is an example of codeblock.
````
``` language
some code block
```
````
Codeblock extensions are mechanism that specialize certain codeblocks to different render behaviors.
The extension will be trigger by the language argument to the codeblck
### Syntax Highlight
You can highlight syntax of codeblocks by specifying the language you need. For example,
````
```python
def function():
return True
```
````
will be rendered as
```python
def function():
return True
```
### Math Formula
You can normally write latex math formula with `math` codeblock. See also [Inline Math](#inline-math).
Example
````
```math
E = m c^2
```
````
will be rendered as
```math
E = m c^2
```
### Embed reStructuredText
Recommonmark also allows embedding reStructuredText syntax in the codeblocks.
There are two styles for embedding reStructuredText. The first is enabled by `eval_rst` codeblock. The content of codeblock will be parsed as reStructuredText and insert into the document. This can be used to quickly introduce some of reStructuredText command that not yet available in markdown. For example,
````
```eval_rst
.. autoclass:: recommonmark.transform.AutoStructify
:show-inheritance:
```
````
will be rendered as
```eval_rst
.. autoclass:: recommonmark.transform.AutoStructify
:show-inheritance:
```
This example used to use sphinx autodoc to insert document of AutoStructify class definition into the document.
The second style is a shorthand of the above style. It allows you to leave off the eval_rst .. portion and directly render directives. For example,
````rst
``` important:: Its a note! in markdown!
```
````
will be rendered as
``` important:: Its a note! in markdown!
```
#### An Advanced Example
````rst
``` sidebar:: Line numbers and highlights
emphasis-lines:
highlights the lines.
linenos:
shows the line numbers as well.
caption:
shown at the top of the code block.
name:
may be referenced with `:ref:` later.
```
``` code-block:: markdown
:linenos:
:emphasize-lines: 3,5
:caption: An example code-block with everything turned on.
:name: Full code-block example
# Comment line
import System
System.run_emphasis_line
# Long lines in code blocks create a auto horizontal scrollbar
System.exit!
```
````
will be rendered as
``` sidebar:: Line numbers and highlights
emphasis-lines:
highlights the lines.
linenos:
shows the line numbers as well.
caption:
shown at the top of the code block.
name:
may be referenced with `:ref:` later.
```
``` code-block:: markdown
:linenos:
:emphasize-lines: 3,5
:caption: An example code-block with everything turned on.
:name: Full code-block example
# Comment line
import System
System.run_emphasis_line
# Long lines in code blocks create a auto horizontal scrollbar
System.exit!
```
The `<div style="clear: right;"></div>` line clears the sidebar for the next title.
<div style="clear: right;"></div>
Inline Math
-----------
Besides the [Math Formula](#math-formula), you can also write latex math in inline codeblock text. You can do so by inserting `$`
in the beginning and end of inline codeblock.
Example
```
This formula `$ y=\sum_{i=1}^n g(x_i) $`
```
will be rendered as:
This formula `$ y=\sum_{i=1}^n g(x_i) $`

@ -1,36 +0,0 @@
base64
===
> base64编码转换和linux里的 base64 命令类似。
### 对文件进行 base64 编码
```bash
[arthas@70070]$ echo 'abc' > /tmp/test.txt
[arthas@70070]$ cat /tmp/test.txt
abc
[arthas@70070]$ base64 /tmp/test.txt
YWJjCg==
```
### 对文件进行 base64 编码并把结果保存到文件里
```bash
$ base64 --input /tmp/test.txt --output /tmp/result.txt
```
### 用 base64 解码文件
```
$ base64 -d /tmp/result.txt
abc
```
### 用 base64 解码文件并保存结果到文件里
```bash
$ base64 -d /tmp/result.txt --output /tmp/bbb.txt
```

@ -1,45 +0,0 @@
批处理功能
===
> 通过批处理功能arthas支持一次性批量运行多个命令并取得命令执行的结果。
### 使用方法
#### 第一步: 创建你的批处理脚本
这里我们新建了一个`test.as`脚本,为了规范,我们采用了.as后缀名但事实上任意的文本文件都ok。
> 注意事项
> * 目前需要每个命令占一行
> * dashboard务必指定执行次数(`-n`),否则会导致批处理脚本无法终止
> * watch/tt/trace/monitor/stack等命令务必指定执行次数(`-n`),否则会导致批处理脚本无法终止
> * 可以使用异步后台任务,如 `watch c.t.X test returnObj > &`,让命令一直在后台运行,通过日志获取结果,[获取更多异步任务的信息](async.md)
```
➜ arthas git:(develop) cat /var/tmp/test.as
help
dashboard -n 1
session
thread
sc -d org.apache.commons.lang.StringUtils
```
#### 第二步: 运行你的批处理脚本
通过`-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。
```bash
./as.sh -f /var/tmp/test.as <pid> > test.out # pid 可以通过 jps 命令查看
```
也可以通过 `-c` 来指定指行的命令,比如
```bash
./as.sh -c 'sysprop; thread' <pid> > test.out # pid 可以通过 jps 命令查看
```
#### 第三步: 查看运行结果
```bash
cat test.out
```

@ -1,11 +0,0 @@
cat
===
[`cat`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-cat)
> 打印文件内容和linux里的cat命令类似。
```bash
$ cat /tmp/a.txt
```

@ -1,160 +0,0 @@
classloader
===
[`classloader`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=command-classloader)
> 查看classloader的继承树urls类加载信息
`classloader` 命令将 JVM 中所有的classloader的信息统计出来并可以展示继承树urls等。
可以让指定的classloader去getResources打印出所有查找到的resources的url。对于`ResourceNotFoundException`比较有用。
### 参数说明
|参数名称|参数说明|
|---:|:---|
|[l]|按类加载实例进行统计|
|[t]|打印所有ClassLoader的继承树|
|[a]|列出所有ClassLoader加载的类请谨慎使用|
|`[c:]`|ClassLoader的hashcode|
|`[classLoaderClass:]`|指定执行表达式的 ClassLoader 的 class name|
|`[c: r:]`|用ClassLoader去查找resource|
|`[c: load:]`|用ClassLoader去加载指定的类|
### 使用参考
#### 按类加载类型查看统计信息
```bash
$ classloader
name numberOfInstances loadedCountTotal
com.taobao.arthas.agent.ArthasClassloader 1 2115
BootstrapClassLoader 1 1861
sun.reflect.DelegatingClassLoader 5 5
sun.misc.Launcher$AppClassLoader 1 4
sun.misc.Launcher$ExtClassLoader 1 1
Affect(row-cnt:5) cost in 3 ms.
```
#### 按类加载实例查看统计信息
```bash
$ classloader -l
name loadedCount hash parent
BootstrapClassLoader 1861 null null
com.taobao.arthas.agent.ArthasClassloader@68b31f0a 2115 68b31f0a sun.misc.Launcher$ExtClassLoader@66350f69
sun.misc.Launcher$AppClassLoader@3d4eac69 4 3d4eac69 sun.misc.Launcher$ExtClassLoader@66350f69
sun.misc.Launcher$ExtClassLoader@66350f69 1 66350f69 null
Affect(row-cnt:4) cost in 2 ms.
```
#### 查看ClassLoader的继承树
```bash
$ classloader -t
+-BootstrapClassLoader
+-sun.misc.Launcher$ExtClassLoader@66350f69
+-com.taobao.arthas.agent.ArthasClassloader@68b31f0a
+-sun.misc.Launcher$AppClassLoader@3d4eac69
Affect(row-cnt:4) cost in 3 ms.
```
#### 查看URLClassLoader实际的urls
```bash
$ classloader -c 3d4eac69
file:/private/tmp/math-game.jar
file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar
Affect(row-cnt:9) cost in 3 ms.
```
*注意* hashcode是变化的需要先查看当前的ClassLoader信息提取对应ClassLoader的hashcode。
对于只有唯一实例的ClassLoader可以通过class name指定使用起来更加方便
```bash
$ classloader --classLoaderClass sun.misc.Launcher$AppClassLoader
file:/private/tmp/math-game.jar
file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar
Affect(row-cnt:9) cost in 3 ms.
```
#### 使用ClassLoader去查找resource
```bash
$ classloader -c 3d4eac69 -r META-INF/MANIFEST.MF
jar:file:/System/Library/Java/Extensions/MRJToolkit.jar!/META-INF/MANIFEST.MF
jar:file:/private/tmp/math-game.jar!/META-INF/MANIFEST.MF
jar:file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar!/META-INF/MANIFEST.MF
```
也可以尝试查找类的class文件
```bash
$ 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
```
#### 使用ClassLoader去加载类
```bash
$ classloader -c 3d4eac69 --load demo.MathGame
load class success.
class-info demo.MathGame
code-source /private/tmp/math-game.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
```
#### 统计ClassLoader实际使用URL和未使用的URL
> 注意基于JVM目前已加载的所有类统计不代表`Unused URLs`可以从应用中删掉。因为可能将来需要从`Unused URLs`里加载类,或者需要加载`resources`。
```
$ classloader --url-stat
com.taobao.arthas.agent.ArthasClassloader@3c41660, hash:3c41660
Used URLs:
file:/Users/admin/.arthas/lib/3.5.6/arthas/arthas-core.jar
Unused URLs:
sun.misc.Launcher$AppClassLoader@75b84c92, hash:75b84c92
Used URLs:
file:/Users/admin/code/java/arthas/math-game/target/math-game.jar
file:/Users/admin/.arthas/lib/3.5.6/arthas/arthas-agent.jar
Unused URLs:
sun.misc.Launcher$ExtClassLoader@7f31245a, hash:7f31245a
Used URLs:
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/sunec.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/sunjce_provider.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/localedata.jar
Unused URLs:
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/nashorn.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/cldrdata.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/legacy8ujsse.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/jfxrt.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/dnsns.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/openjsse.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/sunpkcs11.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/jaccess.jar
file:/tmp/jdk1.8/Contents/Home/jre/lib/ext/zipfs.jar
```

@ -1,7 +0,0 @@
cls
===
清空当前屏幕区域。
> 非终端模式下使用cls指令会提示"Command 'cls' is only support tty session."。

@ -1,57 +0,0 @@
命令列表
=============
* [dashboard](dashboard.md)
* [thread](thread.md)
* [jvm](jvm.md)
* [memory](memory.md)
* [sysprop](sysprop.md)
* [sysenv](sysenv.md)
* [vmoption](vmoption.md)
* [perfcounter](perfcounter.md)
* [logger](logger.md)
* [mbean](mbean.md)
* [getstatic](getstatic.md)
* [ognl](ognl.md)
* [sc](sc.md)
* [sm](sm.md)
* [dump](dump.md)
* [heapdump](heapdump.md)
* [vmtool](vmtool.md)
* [jad](jad.md)
* [classloader](classloader.md)
* [mc](mc.md)
* [retransform](retransform.md)
* [redefine](redefine.md)
* [monitor](monitor.md)
* [watch](watch.md)
* [trace](trace.md)
* [stack](stack.md)
* [tt](tt.md)
* [profiler](profiler.md)
* [cat](cat.md)
* [echo](echo.md)
* [grep](grep.md)
* [base64](base64.md)
* [tee](tee.md)
* [pwd](pwd.md)
* [auth](auth.md)
* [options](options.md)
### Arthas 基础命令
* [help](help.md)
* [cls](cls.md)
* [session](session.md)
* [reset](reset.md)
* [version](version.md)
* [history](history.md)
* [quit](quit.md)
* [stop](stop.md)
* [keymap](keymap.md)

@ -1,44 +0,0 @@
联系我们
===
## 招聘
* [期待你的加入](https://mp.weixin.qq.com/s/XQv8GnqGT3pzceVwzeiy-A)
### Issues
使用疑问意见可以直接在Issues里提出 [https://github.com/alibaba/arthas/issues](https://github.com/alibaba/arthas/issues)
### 微信公众号
欢迎关注公众号获取Arthas项目的信息、源码分析、案例实践。
![](_static/qrcode_gongzhonghao.jpg)
### 钉钉群
* Arthas开源交流钉钉群 21965291 ,搜索群号即可加入。
![](_static/dingding_qr.jpg)
* Arthas开源交流钉钉群2 30707824 ,搜索群号即可加入。
![](_static/dingding2_qr.jpg)
### QQ群
Arthas开源交流QQ群 916328269
![](_static/qqgroup_qr.jpg)
Arthas开源交流QQ群2 854625984
![](_static/qqgroup2_qr.jpg)

@ -1,82 +0,0 @@
dashboard
===
[`dashboard`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-dashboard)
> 当前系统的实时数据面板,按 ctrl+c 退出。
当运行在Ali-tomcat时会显示当前tomcat的实时信息如HTTP请求的qps, rt, 错误数, 线程池信息等等。
### 参数说明
|参数名称|参数说明|
|---:|:---|
|[i:]|刷新实时数据的时间间隔 (ms)默认5000ms|
|[n:]|刷新实时数据的次数|
### 使用参考
```
$ dashboard
ID NAME GROUP PRIORITY STATE %CPU DELTA_TIME TIME INTERRUPTE DAEMON
-1 C2 CompilerThread0 - -1 - 1.55 0.077 0:8.684 false true
53 Timer-for-arthas-dashboard-07b system 5 RUNNABLE 0.08 0.004 0:0.004 false true
22 scheduling-1 main 5 TIMED_WAI 0.06 0.003 0:0.287 false false
-1 C1 CompilerThread0 - -1 - 0.06 0.003 0:2.171 false true
-1 VM Periodic Task Thread - -1 - 0.03 0.001 0:0.092 false true
49 arthas-NettyHttpTelnetBootstra system 5 RUNNABLE 0.02 0.001 0:0.156 false true
16 Catalina-utility-1 main 1 TIMED_WAI 0.0 0.000 0:0.029 false false
-1 G1 Young RemSet Sampling - -1 - 0.0 0.000 0:0.019 false true
17 Catalina-utility-2 main 1 WAITING 0.0 0.000 0:0.025 false false
34 http-nio-8080-ClientPoller main 5 RUNNABLE 0.0 0.000 0:0.016 false true
23 http-nio-8080-BlockPoller main 5 RUNNABLE 0.0 0.000 0:0.011 false true
-1 VM Thread - -1 - 0.0 0.000 0:0.032 false true
-1 Service Thread - -1 - 0.0 0.000 0:0.006 false true
-1 GC Thread#5 - -1 - 0.0 0.000 0:0.043 false true
Memory used total max usage GC
heap 36M 70M 4096M 0.90% gc.g1_young_generation.count 12
g1_eden_space 6M 18M -1 33.33% 86
g1_old_gen 30M 50M 4096M 0.74% gc.g1_old_generation.count 0
g1_survivor_space 491K 2048K -1 24.01% gc.g1_old_generation.time(ms) 0
nonheap 66M 69M -1 96.56%
codeheap_'non-nmethods' 1M 2M 5M 22.39%
metaspace 46M 47M -1 98.01%
Runtime
os.name Mac OS X
os.version 10.15.4
java.version 15
java.home /Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home
systemload.average 10.68
processors 8
uptime 272s
```
### 数据说明
* ID: Java级别的线程ID注意这个ID不能跟jstack中的nativeID一一对应。
* NAME: 线程名
* GROUP: 线程组名
* PRIORITY: 线程优先级, 1~10之间的数字越大表示优先级越高
* STATE: 线程的状态
* CPU%: 线程的cpu使用率。比如采样间隔1000ms某个线程的增量cpu时间为100ms则cpu使用率=100/1000=10%
* DELTA_TIME: 上次采样之后线程运行增量CPU时间数据格式为`秒`
* TIME: 线程运行总CPU时间数据格式为`分:秒`
* INTERRUPTED: 线程当前的中断位状态
* DAEMON: 是否是daemon线程
#### JVM内部线程
Java 8之后支持获取JVM内部线程CPU时间这些线程只有名称和CPU时间没有ID及状态等信息显示ID为-1
通过内部线程可以观测到JVM活动如GC、JIT编译等占用CPU情况方便了解JVM整体运行状况。
* 当JVM 堆(heap)/元数据(metaspace)空间不足或OOM时可以看到GC线程的CPU占用率明显高于其他的线程。
* 当执行`trace/watch/tt/redefine`等命令后可以看到JIT线程活动变得更频繁。因为JVM热更新class字节码时清除了此class相关的JIT编译结果需要重新编译。
JVM内部线程包括下面几种
* JIT编译线程: 如 `C1 CompilerThread0`, `C2 CompilerThread0`
* GC线程: 如`GC Thread0`, `G1 Young RemSet Sampling`
* 其它内部线程: 如`VM Periodic Task Thread`, `VM Thread`, `Service Thread`
### 截图展示
![](_static/dashboard.png "dashboard")

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save