为什么VisualVM Profiler配置文件我的应用程序? [英] Why won't the VisualVM Profiler profile my application?

查看:266
本文介绍了为什么VisualVM Profiler配置文件我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的1文件java应用程序,遍历循环,调用一些函数,分配一些内存,添加一些数字等。我通过eclipse的 Run As-> Java应用程序



运行的应用程序显示在Java VisualVM下的 Local 下。



我双击该应用程序,转到Profiler选项卡。



默认设置为:



从类开始分析:my.main。包。**



不要配置类:java。*,javax。*,
sun *,sunw。*,com.sun。*



我点击 CPU 。 CPU $ 内存按钮灰色。没有任何事情发生。



状态剖析不活动



当我的应用程序终止状态应用程序终止



我在这里做错什么?有没有一些我需要调整的设置?我启动应用程序时需要设置VM标志吗?

解决方案

我猜这个问题与应用程序有关从Eclipse开始,这是因为JVisualVM希望在 java.io.tmpdir 目录中找到数据(通常是 C:\Users\ [您的用户名] \AppData\Local\Temp\hsperfdata_ [您的用户名] 在Windows系统上)。



假设而不是在JPS,JVisualVM等期望的正常位置,Eclipse将数据放在自己的temp文件夹中?



如果是,请尝试使用调用JVisualVM jvisualvm -J-Djava.io.tmpdir = [Eclipse的临时目录] 明确地告诉它数据在哪里。



如果找不到 hsperfdata_ $ USER 文件夹,请尝试只需在Eclipse中以通常的命令行Java方式运行应用程序。



还要注意,在1.6.0_23左右引入了一个影响临时文件夹(大小写敏感)的错误,所以也许你可以通过更新到最新的Java 6(或7)版本来获益?


I've created a simple 1 file java application that iterates through a loop, calls some functions, allocates some memory, adds some numbers, etc. I run that application via eclipse's Run As->Java Application.

The running application shows up in Java VisualVM under Local.

I double click on that application and go to the Profiler tab.

The default settings are:

Start profiling from classes: my.main.package.**

Do not profile classes: java.*, javax.*, sun.*, sunw.*, com.sun.*

I click on CPU. The CPU and Memory buttons gray out. Nothing happens.

The Status says profiling inactive.

When my application terminates the Status says application terminated.

What am I doing wrong here? Are there some settings I need to tweak? Do I need to set a VM flag when I launch my application?

解决方案

I'd guess the issue relates to the application being started from within Eclipse, this is because JVisualVM expects to find data in the java.io.tmpdir directory (usually C:\Users\[your username]\AppData\Local\Temp\hsperfdata_[your username] on a Windows system).

I assume rather than in the normal location where JPS, JVisualVM etc. expects it, Eclipse puts the data in it's own temp folder?

If so, try invoking JVisualVM using jvisualvm -J-Djava.io.tmpdir=[Eclipse's temp directory] to explicitly tell it where that data is.

If you can't find the hsperfdata_$USER folder, try just running your application outside Eclipse in the usual command line Java way.

Also note that there was a bug affecting the temp folder (case sensitivity) introduced around 1.6.0_23, so maybe you'd benefit by updating to a more recent Java 6 (or 7) build?

这篇关于为什么VisualVM Profiler配置文件我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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