Frage

I am making use of java visualvm for profiling purpose. I am facing two issues:

1) As statetd in the documentation

When a new local Java application is launched, a node for that application appears under the Local node. The application node disappears when the application terminates.

This things happens with me when I run my java application, it runs for seconds. The Visualvm shows this PID but when my program stops then this PID also disappears.

How can I solve this problem?

Secondly, I run the main function in which there are calls to other functions present in other classes. I want to compute time for those functions as well . How can I achieve this task?

War es hilfreich?

Lösung

  1. is not a problem. When java process terminates you no longer can connect to it.
  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.

This gives you better results (taking time of 1000 runs and getting average), since single run can take different time at each run.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top