我是靠谱客的博主 鲜艳猎豹,最近开发中收集的这篇文章主要介绍Arthas 生成火焰图一 点睛二 代码三 windows下进入命令界面四 实战,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

一 点睛

profiler:用于生成火焰图

二 代码

package chapter03;

import java.util.ArrayList;
import java.util.Random;

/**
* -Xms600m -Xmx600m -XX:SurvivorRatio=8
* 老年代:400m
* 伊甸园:160m
* s0:20m
* s1:20m
*/
public class OOMTest {
    public static void main(String[] args) {
        ArrayList<Picture> list = new ArrayList<>();
        while (true) {
            try {
                Thread.sleep(50);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            list.add(new Picture(new Random().nextInt(100 * 50)));
        }
    }
}

class Picture {
    private byte[] pixels;


    public Picture(int length) {
        this.pixels = new byte[length];
    }
}

三 windows下进入命令界面

D:ProgramFilesarthas-packaging-3.5.4-bin>jps
10656 Jps
12736 Launcher
2864
10668 OOMTest

D:ProgramFilesarthas-packaging-3.5.4-bin>as.bat 10668
环境变量 JAVA_TOOL_OPTIONS 没有定义
JAVA_HOME: D:ProgramFilesJavajdk1.8.0_251
telnet port: 3658
http port: 8563
信息: 用提供的模式无法找到文件。
telnet wasn't found, please google how to install telnet under windows.
Try to visit http://127.0.0.1:8563 to connecto arthas server.

四 实战

[arthas@16852]$ profiler start
AsyncProfiler error: Current OS do not support AsyncProfiler, Only support Linux/Mac.
# window下不支持,具体使用见官网
# https://arthas.aliyun.com/doc/profiler.html
# 1 启动 profiler
$ profiler start
Started [cpu] profiling
# 2 获取样本数据
$ profiler getSamples
23
# 3 查看状态
$ profiler status
[cpu] profiling is running for 4 seconds
# 4 停止
$ profiler stop
# 5 查看生成的火焰图
http://localhost:3658/arthas-output/
具体某个 JVM 的火焰图

最后

以上就是鲜艳猎豹为你收集整理的Arthas 生成火焰图一 点睛二 代码三 windows下进入命令界面四 实战的全部内容,希望文章能够帮你解决Arthas 生成火焰图一 点睛二 代码三 windows下进入命令界面四 实战所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(247)

评论列表共有 0 条评论

立即
投稿
返回
顶部