Triggers not working

Questions about YourKit Java Profiler
Post Reply
chrisgrind
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Triggers not working

Post by chrisgrind »

YK log file here:
http://pastebin.com/9X8CxJVk

OSX 10.10.1 (14B25)
YK version 2014 build 14114

App runs under
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)

YK runs under
Java(TM) SE Runtime Environment (build 1.8.0-b132)

I attach a trigger to a method that is called, but trigger is not executed.

I have a simple class with a simple method that is run when I click a button.
I added a trigger via the UI then exported it into ~/.yjp/triggers.txt

Code: Select all

cat ~/.yjp/triggers.txt
MethodListener methodPattern=cbg.play.Hello:doWork(int,List,String) instanceOf= fillThis=true fillParams=true fillReturnValue=true maxTriggerCount=-1
  onenter: PrintMessage message=Method:\s${CLASS}:${METHOD}${PARAM_TYPES}\n\s\sthis:\s${THIS}\n\s\sparams:\n${PARAMS} output=stdout
Here's the method that is called when the button is clicked. That works fine, I see the output in the console.

Code: Select all

protected void doWork(int i, List list, String string) {
    System.out.println("start work");
    try {
        Thread.sleep(5_000);
    } catch (InterruptedException e) {}
    System.out.println("stop work");
}
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Post by Anton Katilin »

Please use a fully qualified class name for List in the method pattern: java.util.List

Please see:
http://www.yourkit.com/docs/java/help/m ... attern.jsp
Class names should be full qualified, dot-separated, except for java.lang.Object, java.lang.Object[], java.lang.String, java.lang.String[] for which a short form is allowed: Object, Object[], String, String[].

Primitive types should be named as in Java source code: int, char etc.
chrisgrind
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Post by chrisgrind »

Thanks, two suggestions:
  • Include a link to that on the help page for triggers. I looked for a syntax example I did not find one from here. http://www.yourkit.com/docs/java/help/triggers.jsp
  • When selecting Copy to Clipboard from a CPU sample copy in the format that trigger expects so you can simply paste. I tried that earlier...
I made the change, but still does not work.

Code: Select all

MethodListener methodPattern=cbg.play.Hello:doWork(int,java.util.List,String) instanceOf= fillThis=true fillParams=true fillReturnValue=true maxTriggerCount=-1
  onenter: PrintMessage message=Method:\s${CLASS}:${METHOD}${PARAM_TYPES}\n\s\sthis:\s${THIS}\n\s\sparams:\n${PARAMS} output=stdout
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Post by Anton Katilin »

Hi,

According to the first log, the trigger is loaded. I suppose it is not applied because of a wrong method pattern.

Could you please check the exact class of doWork's list parameter: perhaps it's not from java.util in your case. Alternatively, you can try a wildcard: cbg.play.Hello:doWork(*)

If nothing helps, could you please specify startup option "debug=all" and provide the new log file.

How to specify startup options:
http://www.yourkit.com/docs/java/help/s ... ptions.jsp

Best regards,
Anton
chrisgrind
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Post by chrisgrind »

Still not working. http://pastebin.com/dQNvK7Yf

Code: Select all

MethodListener methodPattern=cbg.play.Hello:doWork(*) instanceOf= fillThis=true fillParams=true fillReturnValue=true maxTriggerCount=-1
  onenter: PrintMessage message=Method:\s${CLASS}:${METHOD}${PARAM_TYPES}\n\s\sthis:\s${THIS}\n\s\sparams:\n${PARAMS} output=stdout
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Post by Anton Katilin »

Hi,

It seems we've found the problem. The trigger's output to console was not immediately flushed. We'll fix this in 14116.

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Post by Anton Katilin »

P.S. As a workaround for build 14114 please choose output to a file or to messages.
chrisgrind
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Post by chrisgrind »

\o/

That did the trick. I tried that yesterday before posting, but not before fixing the java.util.List syntax.

Appreciate the help, thanks for an awesome tool, and have a great Christmas!
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Post by Anton Katilin »

Thank you!

Build 14116 is available for download.

Merry Christmas!
chrisgrind
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Post by chrisgrind »

Verified fixed in 14116. Thanks again.
Post Reply