Filtering Java proxy classes

Questions about YourKit Java Profiler
Post Reply
nmishkin
Posts: 2
Joined: Fri May 08, 2020 12:37 pm

Filtering Java proxy classes

Post by nmishkin »

I tried to add a filter with the pattern "com.sun.proxy.*" but it seemed to have no effect. Is there a way to filter out Java proxy classes?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Filtering Java proxy classes

Post by Anton Katilin »

Could you please explain what you are doing and what you try to achieve.

Do you perform CPU profiling or analyze a memory snapshot?

Filters reduce the depth of call trees and length of stack traces, by skipping successive calls of methods from filtered classes, so you can more easily see the methods of the profiled application:
https://www.yourkit.com/docs/java/help/filters.jsp
nmishkin
Posts: 2
Joined: Fri May 08, 2020 12:37 pm

Re: Filtering Java proxy classes

Post by nmishkin »

I'm new to YourKit so I might not be using it right and I might be using the terminology wrong, but in answer to your question: I'm doing CPU profiling and then capturing a performance snapshot. I'm then looking at the "Call tree - All threads merged" view and drilling into stack traces. Our application makes heavy use of the Spring Framework. Spring makes heavy use of Java proxy objects. As a result, the stack contains things like this:

Code: Select all

> BTProjectServiceImpl.java:591 com.belmonttech.service.impl.BTProjectServiceImpl.findPermissionsForUser(BTProject, String, String)
    > BTProjectServiceImpl.java:624 <...> com.sun.proxy.$Proxy268.findRolesByProjectAndUser(String, String)
        > BTProjectServiceImpl.java:624 <...> com.sun.proxy.$Proxy268.findRolesByProjectAndUser(String, String)
I tried adding com.sun.proxy.* to the list of filters but it appeared to have no effect.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Filtering Java proxy classes

Post by Anton Katilin »

Thank you for the explanation. The UI works as intended. Filters collapse a sequence of filtered methods into a single call to the top method called from a non-filtered method. There is no way to totally eliminate some intermediate methods from call sequences.
Post Reply