简体   繁体   English

Java VisualVm使PID消失

[英]Java VisualVm make the PID disappear

I am making use of java visualvm for profiling purpose. 我正在使用java visualvm进行性能分析。 I am facing two issues: 我面临两个问题:

1) As statetd in the documentation 1)作为文档中的statetd

When a new local Java application is launched, a node for that application appears under the Local node. 启动新的本地Java应用程序时,该应用程序的节点将显示在“本地”节点下。 The application node disappears when the application terminates. 应用程序终止时应用程序节点消失。

This things happens with me when I run my java application, it runs for seconds. 当我运行我的java应用程序时,这件事发生在我身上,运行了几秒钟。 The Visualvm shows this PID but when my program stops then this PID also disappears. Visualvm显示此PID,但是当我的程序停止时,此PID也会消失。

How can I solve this problem? 我怎么解决这个问题?

Secondly, I run the main function in which there are calls to other functions present in other classes. 其次,我运行main函数,其中调用其他类中存在的其他函数。 I want to compute time for those functions as well . 我想为这些功能计算时间。 How can I achieve this task? 我怎样才能完成这项任务?

  1. is not a problem. 不是问题。 When java process terminates you no longer can connect to it. 当java进程终止时,您不再可以连接到它。
  2. you could run the same code 1000 times and make a snapshot in visualVM to analyze usages of memory, computations, etc. You'll have to divide the results by 1000. 您可以运行相同的代码1000次并在visualVM中创建快照来分析内存,计算等的使用情况。您必须将结果除以1000。

This gives you better results (taking time of 1000 runs and getting average), since single run can take different time at each run. 这样可以获得更好的结果(花费1000次运行并获得平均值),因为单次运行可以在每次运行时花费不同的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM