CPU tracing with filter not filtering out methods

Questions about YourKit Java Profiler
Post Reply
fcastano
Posts: 2
Joined: Wed Aug 23, 2017 4:05 am

CPU tracing with filter not filtering out methods

Post by fcastano »

Hello forum,

I cannot connect the GUI to my app, so I do it all via CLI and using the controller class.

I am using latest version of yourkit. I am starting BCI instrumentation (i.e. cpu tracing) of my app with these filters [1] , which I pass as the settings argument to Controller startCPUTracing [2].

based on yourkit log I confirm that they are accepted:

...
7.02-63 13929.540: CPU tracing started: oracle.*\nforcasting.*\njdk.*\nanalytics.*\nsun.*\njava.*\napex.*\ncom.*\nmetering.*\ncommon.*\ncore.*\nsfdc.*\norg.*\nsystem.*\nconfig.*\nlib.*\n+search.solr.client.*
...

According to the documentation, any class with signature org.* will be filtered out form my tracing profile (i.e., not traced) and any class with the signature search.solr.client.* should be traced.

But when I pull the snapshot and open it with yourkit GUI, I see methods traced (i.e. with filled blue arrows) with signature matching org.*, for example. Traced methods have a filled blue arrow according to your doc [3]. Why do I see these methods. How do I trace only the methods with signature search.solr.client* ?

TIA for your prompt help,

Fernando


[1] "klein94.*\\nconfiguration.*\\nui.*\\ndataclud.*\\nbuffalo.*\\noracle.*\\nforcasting.*\\njdk.*\\nanalytics.*\\nsun.*\\njava.*\\napex.*\\ncom.*\\nmetering.*\\ncommon.*\\ncore.*\\nsfdc.*\\norg.*\\nsystem.*\\nconfig.*\\nlib.*\\n+search.solr.client.*"

[2] startCPUTracing(java.lang.String settings) from https://www.yourkit.com/docs/java/api/index.html

[3] https://www.yourkit.com/docs/java/help/filters.jsp
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: CPU tracing with filter not filtering out methods

Post by Anton Katilin »

Hi Fernando

Filtering works differently. It does not fully eliminate calls of specified methods. Instead, it skips successive calls of methods from filtered classes. You see them as entry points, with no further detail.

You may fully prevent bytecode instrumentation of particular classes and methods by specifying their patterns in a config file ~/.yjp/bci_filter.txt. The pattern format is the same as for the filters. The file does not exist by default, create it if necessary. To specify several patterns please put one pattern per line.

Best regards,
Anton
fcastano
Posts: 2
Joined: Wed Aug 23, 2017 4:05 am

Re: CPU tracing with filter not filtering out methods

Post by fcastano »

Thanks! I will try that. A few followup questions:

-will this file be read every time before I start tracing (so I can stop profiling, change it, and start again), or only once when the app comes up?

-I can still pass explicit patters not to be filtered out via the settings param, and those will override anything in the ~/yjp/bci_filter.txt, correct? For example, I may have "com.*" in the bci_filter.txt file, but if I pass in settings argument to controller method the string "+com.foo.*" then any class matching the com.foo.* pattern will be traced.

thanks again,

-fdo
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: CPU tracing with filter not filtering out methods

Post by Anton Katilin »

Hi fdo
-will this file be read every time before I start tracing (so I can stop profiling, change it, and start again), or only once when the app comes up?
Once the app comes up. To use different settings, the profiled app should be restarted.
-I can still pass explicit patters not to be filtered out via the settings param, and those will override anything in the ~/yjp/bci_filter.txt, correct? For example, I may have "com.*" in the bci_filter.txt file, but if I pass in settings argument to controller method the string "+com.foo.*" then any class matching the com.foo.* pattern will be traced.
They work at different levels.

The settings in bci_filter.txt determine which classes and methods should not be instrumented at all, i.e. will be totally invisible for profiling modes depending on bytecode instrumentation such as CPU tracing.

Filters work in the UI. In simple words, they affect default call folding in call trees:
https://www.yourkit.com/docs/java/help/filters.jsp

Please note that all CPU tracing settings passed to the controller are described here:
https://www.yourkit.com/docs/java/help/ ... ttings.jsp
There are no filters among them.

Best regards,
Anton
Post Reply