Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use VisualVM to get the time each function costs [duplicate]

Tags:

VisualVM is a nice but a little complicated tool for me.

I wrote a class with many functions (in Eclipse). How can I get the information of how many time each function calls and the time they cost when during execution?

like image 953
wilbeibi Avatar asked May 08 '13 12:05

wilbeibi


2 Answers

It is actually simple. Run your program and it will automatically appear as a running process in the VisualVM Panel. Click on it, and go straight to the Sampler tab. Finally, click on CPU and you got it. There you can see the time each function takes.

like image 102
lfvv Avatar answered Sep 28 '22 19:09

lfvv


For exhaustive analysis need to use alternative tool, e.g. JProfiler.

According to what @TomasHurka says you can profile also with VisualVM (https://blogs.oracle.com/nbprofiler/entry/profiling_with_visualvm_part_1)

like image 38
Michal Borek Avatar answered Sep 28 '22 17:09

Michal Borek