Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
#开始抽样,-e可用于指定抽样的event,可以是cpu或alloc
profiler start -e cpu;
​
#查看抽样任务执行的时间
profiler status;
​
#查看抽样任务的抽样数量
profiler getSamples;
​
#结束抽样,并将结果的火焰图输出为html格式,--file可指定输出的文件
profiler stop --format html --file /mnt/d/arthas/cpu.html;


抽样任务输出火焰图后,就要基于火焰图进行分析。

y 轴表示调用栈,每一层都是一个函数。调用栈越深,火焰就越高,顶部就是正在执行的函数,下方都是它的父函数。

...

Code Block
profiler start -e cpu;
profiler stop --format html --file /mnt/d/arthas/cpu.html;

下图展示了一次简单的客户端单线程写入,IoTDB运行过程中某一段时间的CPU抽样片段。

...

Code Block
apt install openjdk-8-dbg;


启动一次CPU抽样任务,执行一段时间后即可关闭,并输出结果火焰图。

Code Block
profiler start -e alloc;
profiler stop --format html --file /mnt/d/arthas/alloc.html;

下图展示了一次简单的客户端单线程写入,IoTDB运行过程中某一段时间的内存抽样片段。

...