Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jprofiler or other: how do I roll up recursive method calls?

I have a long operation that I want to profile in JProfiler (or other suggestions), but the method is very recursive, so the tree view in CPU View doesn't help very much. It shows me CPU times like this:

beginOperation 100%
|- recursiveMethod 99%
| | - recursiveMethod 98%
| | | - recursiveMethod 97%
| | | | - ...more recursion
| | |- otherMethods 1%
| | - otherMethod 1%
| - otherMethods 1%

You see, the recursiveMethod really doesn't take any time at all. Rather, its the otherMethods that take up time, and are the ones I want to profile. My ideal view would show recursiveMethod having next to 0% time, and the otherMethods combining to near 100%.

So is there any way in JProfiler to roll this view up so that I can view where my CPU time is being spent more clearly? Does anyone have a suggestion for another profiler that can do this?

Note: I am using JProfiler 6, but could potentially upgrade if another version could do this.

Thanks!

like image 714
Sean Adkinson Avatar asked Aug 05 '11 15:08

Sean Adkinson


1 Answers

JProfiler has a 'Hot Spots' view useful for gathering these types of performance metrics. To get to this view, go to 'CPU Views' on the left hand navigation and 'Hot Spots' should be the second button the left at the bottom of the application window. (These instructions are based on JProfiler 5, but I believe this is the same on version 6).

You can sort by inhernet time (probably what you're looking for), average time and invocations and then follow the call stack up from where those expensive calls were made. At the top of the view, there's also a drop down to change the 'Hot Spot Type', so you can look at the time consumed by JDBC queries, invoked URL and many other options.

like image 76
Jason Gritman Avatar answered Nov 03 '22 20:11

Jason Gritman