Java JVisualVM for Linux 控制台?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19118797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:16:27  来源:igfitidea点击:

JVisualVM for Linux console?

javavisualvm

提问by Triton Man

I need to be able to do some memory sampling on a VM that's running on a linux box that doesn't have any XWindows running. I've tried to do it remotely but apparently JVisualVM does not support remote memory sampling.

我需要能够在没有运行任何 XWindows 的 linux 机器上运行的 VM 上进行一些内存采样。我试过远程执行,但显然 JVisualVM 不支持远程内存采样。

What are my alternatives?

我的选择是什么?

Thanks!

谢谢!

采纳答案by Rodion Gorkovenko

It depends on what type of sampling you want. jmapconsole tool (from JDK bin folder) allows some kind of memory dumping etc.

这取决于您想要的采样类型。jmap控制台工具(来自 JDK bin 文件夹)允许某种内存转储等。

回答by jtahlborn

setup a remote DISPLAY on your linux server and run jvisualvm such that the ui displays on your local xserver. it might be slow, but it will work.

在您的 linux 服务器上设置远程 DISPLAY 并运行 jvisualvm,以便 ui 显示在您的本地 xserver 上。它可能会很慢,但它会起作用。

回答by Dev

You can use jmapto take a memory sample (aka a heap dump). The command below creates a file heap.hprofin the current directory.

您可以jmap用来获取内存样本(又名堆转储)。下面的命令heap.hprof在当前目录中创建一个文件 。

jmap -dump:format=b,file=heap.hprof <pid>

Once you have the sample you can transfer it to another machine for analysis with whatever tools you like. I recommend Memory Analyzer.

获得样品后,您可以将其转移到另一台机器上,使用您喜欢的任何工具进行分析。我推荐内存分析器

回答by Kashan

Path to your software :

软件路径:

[softwares/visualvm_14/bin] -> ll

[软件/visualvm_14/bin] -> ll

-rw-r--r-- 1 xxxxxxx xx   6287 Dec 11 15:52 visualvm 
-rw-r--r-- 1 xxxxxxx xx 190464 Dec 11 15:52 visualvm.exe

1st file is for Lx OS
2nd file is for Windows OS

Command to start the application:

启动应用程序的命令:

for Linux "jvisualvm"
for Windows "double click the .exe file"