<liclass="toctree-l4"><aclass="reference internal"href="#generate-svg-format-results">Generate svg format results</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#generating-html-format-results">Generating html format results</a></li>
</ul>
</li>
<liclass="toctree-l3"><aclass="reference internal"href="#view-profiler-results-under-arthas-output-via-browser">View profiler results under arthas-output via browser</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md#">Compile and debug/CONTRIBUTING</a></li>
<p>The basic usage of the <codeclass="docutils literal notranslate"><spanclass="pre">profiler</span></code> command is <codeclass="docutils literal notranslate"><spanclass="pre">profiler</span><spanclass="pre">action</span><spanclass="pre">[actionArg]</span></code></p>
<divclass="section"id="start-profiler">
<h2>Start profiler<aclass="headerlink"href="#start-profiler"title="Permalink to this headline">¶</a></h2>
<div><p>By default, the sample event is <codeclass="docutils literal notranslate"><spanclass="pre">cpu</span></code>. Can be specified with the <codeclass="docutils literal notranslate"><spanclass="pre">--event</span></code> parameter.</p>
<p>By default, the generated results are saved to the <codeclass="docutils literal notranslate"><spanclass="pre">arthas-output</span></code> directory under the application’s <codeclass="docutils literal notranslate"><spanclass="pre">working</span><spanclass="pre">directory</span></code>. The output result path can be specified by the <codeclass="docutils literal notranslate"><spanclass="pre">--file</span></code> parameter. such as:</p>
<h3>Generating html format results<aclass="headerlink"href="#generating-html-format-results"title="Permalink to this headline">¶</a></h3>
<p>By default, the result file is <codeclass="docutils literal notranslate"><spanclass="pre">svg</span></code> format. If you want to generate the <codeclass="docutils literal notranslate"><spanclass="pre">html</span></code> format, you can specify it with the <codeclass="docutils literal notranslate"><spanclass="pre">--format</span></code> parameter:</p>
<divclass="highlight-bash notranslate"><divclass="highlight hljs"><preclass="bash">$ profiler stop --format html
<p>Or use the file name name format in the <codeclass="docutils literal notranslate"><spanclass="pre">--file</span></code> parameter. For example, <codeclass="docutils literal notranslate"><spanclass="pre">--file</span><spanclass="pre">/tmp/result.html</span></code>.</p>
<h2>View profiler results under arthas-output via browser<aclass="headerlink"href="#view-profiler-results-under-arthas-output-via-browser"title="Permalink to this headline">¶</a></h2>
<p>By default, arthas uses port 3658, which can be opened: <aclass="reference external"href="http://localhost:3658/arthas-output/">http://localhost:3658/arthas-output/</a> View the <codeclass="docutils literal notranslate"><spanclass="pre">arthas-output</span></code> directory below Profiler results:</p>
<h2>Profiler supported events<aclass="headerlink"href="#profiler-supported-events"title="Permalink to this headline">¶</a></h2>
<p>Under different platforms and different OSs, the supported events are different. For example, under macos:</p>
<divclass="highlight-bash notranslate"><divclass="highlight hljs"><preclass="bash">$ profiler list
Basic events:
cpu
alloc
lock
wall
itimer</pre></div>
</div>
<p>Under linux</p>
<divclass="highlight-bash notranslate"><divclass="highlight hljs"><preclass="bash">$ 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</pre></div>
</div>
<p>If you encounter the permissions/configuration issues of the OS itself and then missing some events, you can refer to the <aclass="reference external"href="https://github.com/jvm-profiling-tools/async-profiler">async-profiler</a> documentation.</p>
<p>You can use the <codeclass="docutils literal notranslate"><spanclass="pre">--event</span></code> parameter to specify the event to sample, such as sampling the <codeclass="docutils literal notranslate"><spanclass="pre">alloc</span></code> event:</p>
<p>The difference between <codeclass="docutils literal notranslate"><spanclass="pre">start</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">resume</span></code> is: <codeclass="docutils literal notranslate"><spanclass="pre">start</span></code> is the new start sampling, <codeclass="docutils literal notranslate"><spanclass="pre">resume</span></code> will retain the data of the last <codeclass="docutils literal notranslate"><spanclass="pre">stop</span></code>.</p>
<p>You can verify the number of samples by executing <codeclass="docutils literal notranslate"><spanclass="pre">profiler</span><spanclass="pre">getSamples</span></code>.</p>
<h2>Use <codeclass="docutils literal notranslate"><spanclass="pre">execute</span></code> action to execute complex commands<aclass="headerlink"href="#use-execute-action-to-execute-complex-commands"title="Permalink to this headline">¶</a></h2>
<p>Specific format reference: <aclass="reference external"href="https://github.com/jvm-profiling-tools/async-profiler/blob/v1.6/src/arguments.cpp#L34">arguments.cpp#L34</a></p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<scripttype="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<divclass="github-fork-ribbon-wrapper right">
<divclass="github-fork-ribbon">
<ahref="https://github.com/alibaba/arthas"target="_blank">Fork me at GitHub</a>