|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
|
<meta name="generator" content="VuePress 2.0.0-beta.51">
|
|
|
|
|
<style>
|
|
|
|
|
:root {
|
|
|
|
|
--c-bg: #fff;
|
|
|
|
|
}
|
|
|
|
|
html.dark {
|
|
|
|
|
--c-bg: #22272e;
|
|
|
|
|
}
|
|
|
|
|
html, body {
|
|
|
|
|
background-color: var(--c-bg);
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<script>
|
|
|
|
|
const userMode = localStorage.getItem('vuepress-color-scheme');
|
|
|
|
|
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
|
|
|
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
|
|
|
|
|
document.documentElement.classList.toggle('dark', true);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<link rel="icon" href="/images/favicon.ico"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta property="og:title" content="Arthas"><meta property="og:image:alt" content="Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas - alibaba/arthas: Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas"><meta property="og:image" content="/images/arthas_mate_image.png"><meta property="og:description" content="Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas - alibaba/arthas: Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="600"><meta property="twitter:image:src" content="/images/arthas_mate_image.png"><meta property="twitter:image:alt" content="Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas - alibaba/arthas: Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas"><meta itemprop="name" content="Arthas"><meta itemprop="image" content="/images/arthas_mate_image.png"><meta itemprop="description" content="Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas - alibaba/arthas: Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas"><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><meta name="aes-config" content="pid=xux-opensource&user_type=101&uid=&username=&dim10=arthas"><script src="//g.alicdn.com/alilog/mlog/aplus_v2.js" id="beacon-aplus" exparams="clog=o&aplus&sidx=aplusSidx&ckx=aplusCkx"></script><script src="//g.alicdn.com/aes/??tracker/1.0.34/index.js,tracker-plugin-pv/2.4.5/index.js,tracker-plugin-event/1.2.5/index.js,tracker-plugin-jserror/1.0.13/index.js,tracker-plugin-api/1.1.14/index.js,tracker-plugin-perf/1.1.8/index.js,tracker-plugin-eventTiming/1.0.4/index.js"></script><title>profiler | arthas</title><meta name="description" content="arthas 使用文档">
|
|
|
|
|
<link rel="modulepreload" href="/3.x/assets/app.4d248835.js"><link rel="modulepreload" href="/3.x/assets/profiler.html.e7f88019.js"><link rel="modulepreload" href="/3.x/assets/arthas-output-svg.30f64f53.js"><link rel="modulepreload" href="/3.x/assets/profiler.html.2fe5463f.js"><link rel="prefetch" href="/3.x/assets/index.html.6c4675e2.js"><link rel="prefetch" href="/3.x/assets/index.html.636fad3d.js"><link rel="prefetch" href="/3.x/assets/advanced-use.html.94d49710.js"><link rel="prefetch" href="/3.x/assets/advice-class.html.0e371faa.js"><link rel="prefetch" href="/3.x/assets/agent.html.2c661add.js"><link rel="prefetch" href="/3.x/assets/arthas-properties.html.c6a378d8.js"><link rel="prefetch" href="/3.x/assets/arthas3.html.f5096367.js"><link rel="prefetch" href="/3.x/assets/async.html.08408f7f.js"><link rel="prefetch" href="/3.x/assets/auth.html.0cae929d.js"><link rel="prefetch" href="/3.x/assets/base64.html.e5a32bd6.js"><link rel="prefetch" href="/3.x/assets/batch-support.html.acbd1eb9.js"><link rel="prefetch" href="/3.x/assets/cat.html.79af7693.js"><link rel="prefetch" href="/3.x/assets/classloader.html.5b255ef1.js"><link rel="prefetch" href="/3.x/assets/cls.html.9332bbdf.js"><link rel="prefetch" href="/3.x/assets/commands.html.e2567b24.js"><link rel="prefetch" href="/3.x/assets/contact-us.html.6d0fe4e6.js"><link rel="prefetch" href="/3.x/assets/dashboard.html.c7a97553.js"><link rel="prefetch" href="/3.x/assets/docker.html.030cca04.js"><link rel="prefetch" href="/3.x/assets/download.html.b853bfd7.js"><link rel="prefetch" href="/3.x/assets/dump.html.3f441711.js"><link rel="prefetch" href="/3.x/assets/echo.html.239528da.js"><link rel="prefetch" href="/3.x/assets/faq.html.abd28b1f.js"><link rel="prefetch" href="/3.x/assets/getstatic.html.2229049b.js"><link rel="prefetch" href="/3.x/assets/grep.html.4aa91236.js"><link rel="prefetch" href="/3.x/assets/groovy.html.21de60b6.js"><link rel="prefetch" href="/3.x/assets/heapdump.html.3fe356b2.js"><link rel="prefetch" href="/3.x/assets/help.html.7ba26453.js"><link rel="prefetch" href="/3.x/assets/history.html.5c8da1d4.js"><link rel="prefetch" href="/3.x/assets/http-api.html.f5e81364.js"><link rel="prefetch" href="/3.x/assets/idea-plugin.html.d7acd139.js"><link rel="prefetch" href="/3.x/assets/install-detail.html.0c410a89.js"><link rel="prefetch" href="/3.x/assets/jad.html.d639a8bb.js"><link rel="prefetch" href="/3.x/assets/jfr.html.e858c4d3.js"><link rel="prefetch" href="/3.x/assets/jvm.html.a00151a5.js"><link rel="prefetch" href="/3.x/assets/keymap.html.e3647cfd.js"><link rel="prefetch" href="/3.x/assets/logger.html.7a983455.js"><link rel="prefetch" href="/3.x/assets/manual-install.html.09d3b86a.js"><link rel="prefetch" href="/3.x/assets/mbean.html.555cb2c7.js"><link rel="prefetch" href="/3.x/assets/mc.html.70645c5e.js"><link rel="prefetch" href="/3.x/assets/memory.html.078c4658.js"><link rel="prefetch" href="/3.x/assets/monitor.html.d6717549.js"><link rel="prefetch" href="/3.x/assets/ognl.html.a04123af.js"><link rel="prefetch" href="/3.x/assets/options.html.76f0ad11.js"><link rel="prefetch" href="/3.x/assets/perfcounter.html.a2008d46.js"><link rel="prefetch" href="/3.x/assets/pwd.html.b8813280.js"><link rel="prefetch" href="/3.x/assets/quick-start.html.463266ab.js"><link rel="prefetch" href="/3.x/assets/quit.html.052c6b91.js"><link rel="prefetch" href="/3.x/assets/redefine.html.a2b54a14.js"><link rel="prefetch" href="/3.x/assets/release-notes.html.bd30f66e.js"><link rel="prefetch" href="/3.x/assets/reset.html.d6cfba7b.js"><link rel="prefetch" href="/3.x/assets/retransform.html.8eba17c2.js"><link rel="prefetch" href="/3.x/assets/save-log.html.1848baa1.js"><link rel="prefetch" href="/3.x/assets/sc.html.74c76d3a.js"><link rel="prefetch" href="/3.x/assets/session.html.5c4eabed.js"><link rel="prefetch" href="/3.x/assets/sm.html.e7e61e0b.js"><link rel="prefetch" href="/3.x/assets/spring-boot-starter.html.f437e222.js"><link rel="prefetch" href="/3.x/assets/stack.html.6561e199.js"><link rel="prefetch" href="/3.x/assets/start-arthas.html.11758ed5.js"><link rel="prefetch" href="/3.x
|
|
|
|
|
<link rel="stylesheet" href="/3.x/assets/style.f2bd2fc0.css">
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="切换侧边栏" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/3.x/" class="" data-v-a8869d06><!----><span class="site-name can-hide" data-v-a8869d06>arthas</span><span class="navbar-version" data-v-a8869d06>v3.7.3</span></a></span><div class="navbar-items-wrapper" style=""><!--[--><!--]--><nav class="navbar-items can-hide"><!--[--><div class="navbar-item"><a href="/3.x/" class="" aria-label="首页"><!--[--><!--]--> 首页 <!--[--><!--]--></a></div><div class="navbar-item"><a class="external-link" href="/doc/arthas-tutorials.html?language=cn&id=arthas-basics" rel="noopener noreferrer" target="_blank" aria-label="在线教程"><!--[--><!--]--><span>在线教程</span><span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口打开</span></span><!--[--><!--]--></a></div><div class="navbar-item"><a href="/3.x/doc/" class="router-link-active" aria-label="文档"><!--[--><!--]--> 文档 <!--[--><!--]--></a></div><div class="navbar-item"><a href="/3.x/doc/commands.md" class="" aria-label="命令列表"><!--[--><!--]--> 命令列表 <!--[--><!--]--></a></div><div class="navbar-item"><a href="/3.x/doc/download.md" class="" aria-label="下载"><!--[--><!--]--> 下载 <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="版本"><span class="title">版本</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="版本"><span class="title">版本</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a class="external-link" href="https://arthas.aliyun.com/" rel="noopener noreferrer" target="_blank" aria-label="v4.x"><!--[--><!--]--><span>v4.x</span><span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口打开</span></span><!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em" style="height:1.25rem;width:1.25rem;vertical-align:bottom;" viewbox="0 0 24 24"><path fill="currentColor" d="M13.35 22q-.6 0-.862-.387q-.263-.388-.063-.963l3.65-9.675q.15-.4.563-.688Q17.05 10 17.5 10q.425 0 .85.287q.425.288.575.688l3.65 9.675q.2.575-.062.963q-.263.387-.888.387q-.275 0-.5-.175q-.225-.175-.325-.425l-.85-2.45H15.1l-.875 2.45q-.1.25-.35.425q-.25.175-.525.175Zm2.35-4.8h3.6l-1.75-4.95h-.1ZM7.15 8.55q.4.725.85 1.337q.45.613 1.05 1.263q1.1-1.2 1.825-2.462Q11.6 7.425 12.1 6H2q-.425 0-.712-.287Q1 5.425 1 5t.288-.713Q1.575 4 2 4h6V3q0-.425.288-.713Q8.575 2 9 2t.713.287Q10 2.575 10 3v1h6q.425 0 .712.287Q17 4.575 17 5t-.288.713Q16.425 6 16 6h-1.9q-.525 1.775-1.425 3.45q-.9 1.675-2.225 3.15l2.4 2.45l-.75 2.05L9 14l-4.3 4.3q-.27
|
|
|
|
|
Started [cpu] profiling
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container tip"><p class="custom-container-title">提示</p><p>默认情况下,生成的是 cpu 的火焰图,即 event 为<code>cpu</code>。可以用<code>--event</code>参数来指定。</p></div><h2 id="获取已采集的-sample-的数量" tabindex="-1"><a class="header-anchor" href="#获取已采集的-sample-的数量" aria-hidden="true">#</a> 获取已采集的 sample 的数量</h2><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>$ profiler getSamples
|
|
|
|
|
23
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="查看-profiler-状态" tabindex="-1"><a class="header-anchor" href="#查看-profiler-状态" aria-hidden="true">#</a> 查看 profiler 状态</h2><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler status
|
|
|
|
|
<span class="token punctuation">[</span>cpu<span class="token punctuation">]</span> profiling is running <span class="token keyword">for</span> <span class="token number">4</span> seconds
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><p>可以查看当前 profiler 在采样哪种<code>event</code>和采样时间。</p><h2 id="停止-profiler" tabindex="-1"><a class="header-anchor" href="#停止-profiler" aria-hidden="true">#</a> 停止 profiler</h2><h3 id="生成-html-格式结果" tabindex="-1"><a class="header-anchor" href="#生成-html-格式结果" aria-hidden="true">#</a> 生成 html 格式结果</h3><p>默认情况下,结果文件是<code>html</code>格式,也可以用<code>--format</code>参数指定:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler stop <span class="token parameter variable">--format</span> html
|
|
|
|
|
profiler output file: /tmp/test/arthas-output/20211207-111550.html
|
|
|
|
|
OK
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>或者在<code>--file</code>参数里用文件名指名格式。比如<code>--file /tmp/result.html</code> 。</p><h2 id="通过浏览器查看-arthas-output-下面的-profiler-结果" tabindex="-1"><a class="header-anchor" href="#通过浏览器查看-arthas-output-下面的-profiler-结果" aria-hidden="true">#</a> 通过浏览器查看 arthas-output 下面的 profiler 结果</h2><p>默认情况下,arthas 使用 3658 端口,则可以打开: <a href="http://localhost:3658/arthas-output/" target="_blank" rel="noopener noreferrer">http://localhost:3658/arthas-output/<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口打开</span></span></a> 查看到<code>arthas-output</code>目录下面的 profiler 结果:</p><p><img src="/3.x/images/arthas-output.jpg" alt=""></p><p>点击可以查看具体的结果:</p><p><img src="/3.x/images/arthas-output-svg.jpg" alt=""></p><div class="custom-container tip"><p class="custom-container-title">提示</p><p>如果是 chrome 浏览器,可能需要多次刷新。</p></div><h2 id="profiler-支持的-events" tabindex="-1"><a class="header-anchor" href="#profiler-支持的-events" aria-hidden="true">#</a> profiler 支持的 events</h2><p>在不同的平台,不同的 OS 下面,支持的 events 各有不同。比如在 macos 下面:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler list
|
|
|
|
|
Basic events:
|
|
|
|
|
cpu
|
|
|
|
|
alloc
|
|
|
|
|
lock
|
|
|
|
|
wall
|
|
|
|
|
itimer
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>在 linux 下面</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler list
|
|
|
|
|
Basic events:
|
|
|
|
|
cpu
|
|
|
|
|
alloc
|
|
|
|
|
lock
|
|
|
|
|
wall
|
|
|
|
|
itimer
|
|
|
|
|
Perf events:
|
|
|
|
|
page-faults
|
|
|
|
|
context-switches
|
|
|
|
|
cycles
|
|
|
|
|
instructions
|
|
|
|
|
cache-references
|
|
|
|
|
cache-misses
|
|
|
|
|
branches
|
|
|
|
|
branch-misses
|
|
|
|
|
bus-cycles
|
|
|
|
|
L1-dcache-load-misses
|
|
|
|
|
LLC-load-misses
|
|
|
|
|
dTLB-load-misses
|
|
|
|
|
mem:breakpoint
|
|
|
|
|
trace:tracepoint
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>如果遇到 OS 本身的权限/配置问题,然后 缺少部分 event,可以参考<code>async-profiler</code>本身文档:<a href="https://github.com/jvm-profiling-tools/async-profiler" target="_blank" rel="noopener noreferrer">async-profiler<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口打开</span></span></a></p><p>可以用<code>--event</code>参数指定要采样的事件,比如对<code>alloc</code>事件进入采样:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler start <span class="token parameter variable">--event</span> alloc
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h2 id="恢复采样" tabindex="-1"><a class="header-anchor" href="#恢复采样" aria-hidden="true">#</a> 恢复采样</h2><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler resume
|
|
|
|
|
Started <span class="token punctuation">[</span>cpu<span class="token punctuation">]</span> profiling
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><p><code>start</code>和<code>resume</code>的区别是:<code>start</code>是新开始采样,<code>resume</code>会保留上次<code>stop</code>时的数据。</p><p>通过执行<code>profiler getSamples</code>可以查看 samples 的数量来验证。</p><h2 id="使用execute来执行复杂的命令" tabindex="-1"><a class="header-anchor" href="#使用execute来执行复杂的命令" aria-hidden="true">#</a> 使用<code>execute</code>来执行复杂的命令</h2><p>比如开始采样:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>profiler execute <span class="token string">'start,framebuf=5000000'</span>
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>停止采样,并保存到指定文件里:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>profiler execute <span class="token string">'stop,file=/tmp/result.html'</span>
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>具体的格式参考: <a href="https://github.com/jvm-profiling-tools/async-profiler/blob/v2.5/src/arguments.cpp#L50" target="_blank" rel="noopener noreferrer">arguments.cpp<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口打开</span></span></a></p><h2 id="查看所有支持的-action" tabindex="-1"><a class="header-anchor" href="#查看所有支持的-action" aria-hidden="true">#</a> 查看所有支持的 action</h2><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler actions
|
|
|
|
|
Supported Actions: <span class="token punctuation">[</span>resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status<span class="token punctuation">]</span>
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="查看版本" tabindex="-1"><a class="header-anchor" href="#查看版本" aria-hidden="true">#</a> 查看版本</h2><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ profiler version
|
|
|
|
|
Async-profiler <span class="token number">1.6</span> built on Sep <span class="token number">9</span> <span class="token number">2019</span>
|
|
|
|
|
Copyright <span class="token number">2019</span> Andrei Pangin
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="配置-framebuf-参数" tabindex="-1"><a class="header-anchor" href="#配置-framebuf-参数" aria-hidden="true">#</a> 配置 framebuf 参数</h2><blockquote><p>如果遇到生成的火焰图有 <code>[frame_buffer_overflow]</code>,则需要增大 framebuf(默认值是 1'000'000),可以显式配置,比如:</p></blockquote><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>profiler start <span class="token parameter variable">--framebuf</span> <span class="token number">5000000</span>
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h2 id="配置-include-exclude-来过滤数据" tabindex="-1"><a class="header-anchor" href="#配置-include-exclude-来过滤数据" aria-hidden="true">#</a> 配置 include/exclude 来过滤数据</h2><p>如果应用比较复杂,生成的内容很多,想只关注部分数据,可以通过 include/exclude 来过滤。比如</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>profiler start <span class="token parameter variable">--include</span> <span class="token string">'java/*'</span> <span class="token parameter variable">--include</span> <span class="token string">'demo/*'</span> <span class="token parameter variable">--exclude</span> <span class="token string">'*Unsafe.park*'</span>
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><blockquote><p>include/exclude 都支持设置多个值 ,但是需要配置在命令行的最后。</p></blockquote><h2 id="指定执行时间" tabindex="-1"><a class="header-anchor" href="#指定执行时间" aria-hidden="true">#</a> 指定执行时间</h2><p>比如,希望 profiler 执行 300 秒自动结束,可以用 <code>-d</code>/<code>--duration</code> 参数指定:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>profiler start <span class="token parameter variable">--duration</span> <span class="token number">300</span>
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h2 id="生成-jfr-格式结果" tabindex="-1"><a class="header-anchor" href="#生成-jfr-格式结果" aria-hidden="true">#</a> 生成 jfr 格式结果</h2><blockquote><p>注意,jfr 只支持在 <code>start</code>时配置。如果是在<code>stop</code>时指定,则不会生效。</p></blockquote><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>profiler start --file /tmp/test.jfr
|
|
|
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p><code>file</code>参数支持一些变量:</p><ul><li>时间戳: <code>--file /tmp/test-%t.jfr</code></li><li>进程 ID: <code>--file /tmp/test-%p.jfr</code></li></ul><p>生成的结果可以用支持 jfr 格式的工具来查看。比如:</p><ul><li>JDK Mission Control : https://github.com/openjdk/jmc</li><li>JProfiler : https://github.com/alibaba/arthas/issues/1416</li></ul><h2 id="生成的火焰图里的-unknown" tabindex="-1"><a class="header-anchor" href="#生成的火焰图里的-unknown" aria-hidden="true">#</a> 生成的火焰图里的 unknown</h2><ul><li>https://github.com/jvm-profiling-tools/async-profiler/discussions/409</li></ul></div><!--[--><!--]--></div><footer class="page-meta right-menu-padding" data-v-fdd717e0><div class="meta-item edit-link"><a class="external-link meta-item-label" href="https://github.com/alibaba/arthas/edit/master/site/docs/doc/profiler.md" rel="noopener noreferrer" target="_blank" aria-label="在 GitHub 上编辑此页"><!--[--><!--]--><span>在 GitHub 上编辑此页</span><span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口打开</span></span><!--[--><!--]--></a></div><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><!----></div><div class="meta-item contributors"><span class="meta-item-label">贡献者: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: hengyunabc@gmail.com">hengyunabc</span><!--[-->, <!--]--><!--]--><!--[--><span class="contributor" title="email: i@fatpandac.com">Fatpandac</span><!--[-->, <!--]--><!--]--><!--[--><span class="contributor" title="email: anrun388@gmail.com">SiuHui</span><!--[-->, <!--]--><!--]--><!--[--><span class="contributor" title="email: hollowman186@vip.qq.com">Hollow Man</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav right-menu-padding" data-v-fdd717e0><p class="inner"><span class="prev"><a href="/3.x/doc/perfcounter.html" class="" aria-label="perfcounter"><!--[--><!--]--> perfcounter <!--[--><!--]--></a></span><span class="next"><a href="/3.x/doc/pwd.html" class="" aria-label="pwd"><!--[--><!--]--> pwd <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
|
|
|
|
|
<script type="module" src="/3.x/assets/app.4d248835.js" defer></script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|