Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Triggers not working

Moderators: Vladimir Kondratyev, Anton Katilin

Triggers not working

Postby chrisgrind » Mon Dec 22, 2014 3:43 pm

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");
}
chrisgrind
 
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Postby Anton Katilin » Mon Dec 22, 2014 5:09 pm

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.
Anton Katilin
 
Posts: 5651
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Postby chrisgrind » Mon Dec 22, 2014 6:27 pm

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
chrisgrind
 
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Postby Anton Katilin » Mon Dec 22, 2014 8:12 pm

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
Anton Katilin
 
Posts: 5651
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Postby chrisgrind » Mon Dec 22, 2014 8:22 pm

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
chrisgrind
 
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Postby Anton Katilin » Tue Dec 23, 2014 12:40 pm

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: 5651
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Postby Anton Katilin » Tue Dec 23, 2014 12:47 pm

P.S. As a workaround for build 14114 please choose output to a file or to messages.
Anton Katilin
 
Posts: 5651
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Postby chrisgrind » Tue Dec 23, 2014 1:39 pm

\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!
chrisgrind
 
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am

Re: Triggers not working

Postby Anton Katilin » Tue Dec 23, 2014 4:24 pm

Thank you!

Build 14116 is available for download.

Merry Christmas!
Anton Katilin
 
Posts: 5651
Joined: Wed Aug 11, 2004 8:37 am

Re: Triggers not working

Postby chrisgrind » Tue Dec 23, 2014 7:03 pm

Verified fixed in 14116. Thanks again.
chrisgrind
 
Posts: 61
Joined: Thu Apr 13, 2006 11:56 am


Return to Java Profiler

Who is online

Users browsing this forum: Bing [Bot] and 12 guests