在一段时间内获取Java中堆内存使用情况的可视化图表 [英] Get visual graph of heap memory usage in Java over a span of time

查看:117
本文介绍了在一段时间内获取Java中堆内存使用情况的可视化图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Visual VM来监控Java应用程序的堆内存使用情况。但是我想以某种方式看一段时间内的堆内存使用情况,例如一天而不仅仅是获取快照。我希望能够保留Visual VM或工具并让它记录内存使用情况和然后在一天之后,我可以回去查看它的图表。有没有办法使用Visual VM?如果有,怎么样?如果没有,我可以使用什么工具?

I am currently using Visual VM to monitor the heap memory usage of my Java application. However I would like to somehow see the heap memory usage over a span of time like for example a day and not just get a snapshot.I would like to be able to leave Visual VM or a tool on and let it log the memory usage and then later after one day, I can go back and see a graph of it. Is there a way to do this using Visual VM? If yes, how? If not, what tool can I used to do this?

推荐答案

使用以下Java选项运行Java程序:

Run your Java program with the following Java options:

-Xloggc:log.out -XX:+PrintGCDetails -XX:+PrintGCTimeStamps

并下载 HPjmeter 以可视化 log.out

另见SUN的 GC门户网页,以获取更多选项。由于数据被写入文件,因此收集数天或数周的数据不会有任何问题。当然,如果您希望使用大量信息可视化数据,则需要运行具有更多内存的HPjmeter。

Also see SUN's GC portal webpage for more options to run with. Since the data is written to a file, you won't have any problems collecting days or weeks worth of data. Of course, if you wish to visualize data with lots of information, you'll need to run HPjmeter with more memory.

您的另一个选择是使用 JConsole

Your other option is to use JConsole.

这篇关于在一段时间内获取Java中堆内存使用情况的可视化图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆