writing probe for getting function arguments and return
writing probe for getting function arguments and return
hi all
i want to get passed args and return value of all invoked methods. i couldn't find any built-in options to do this.
i suppose the only way is to write a custom probe.
can anyone show me a code snippet of doing this?
i want to get passed args and return value of all invoked methods. i couldn't find any built-in options to do this.
i suppose the only way is to write a custom probe.
can anyone show me a code snippet of doing this?
-
- Posts: 6160
- Joined: Wed Aug 11, 2004 8:37 am
- Contact:
Re: writing probe for getting function arguments and return
Hi,
Please try using triggers:
https://www.yourkit.com/docs/java/help/triggers.jsp
Add a trigger on method invocation with an action such as "Print Message Invocation Detail" to log to a file or console or "Record Method Invocation" to add events visible in the profiler results.
Please try using triggers:
https://www.yourkit.com/docs/java/help/triggers.jsp
Add a trigger on method invocation with an action such as "Print Message Invocation Detail" to log to a file or console or "Record Method Invocation" to add events visible in the profiler results.
Re: writing probe for getting function arguments and return
done exactly like the link but im not getting anything; not in the log nor in the YKJP.
im using attach mode
by log i mean the file in the ".yjp\log" folder
im using attach mode
by log i mean the file in the ".yjp\log" folder
-
- Posts: 6160
- Joined: Wed Aug 11, 2004 8:37 am
- Contact:
Re: writing probe for getting function arguments and return
Please see the actions which I recommended. They use macros which define what kind of detail is to be logged. The Print* actions allow you to choose the target file.
The simplest way to play with triggers is to connect to a profiled application and compose triggers via the user interface (add trigger, add action) as shown in the help page. You can apply the changes immediately.
You can later export the trigger description to reuse it or apply on start.
The simplest way to play with triggers is to connect to a profiled application and compose triggers via the user interface (add trigger, add action) as shown in the help page. You can apply the changes immediately.
You can later export the trigger description to reuse it or apply on start.
Re: writing probe for getting function arguments and return
i did as you told:

anything that I'm doing wrong?
anything that I'm doing wrong?
-
- Posts: 6160
- Joined: Wed Aug 11, 2004 8:37 am
- Contact:
Re: writing probe for getting function arguments and return
Sorry I cannot see the image.
-
- Posts: 6160
- Joined: Wed Aug 11, 2004 8:37 am
- Contact:
Re: writing probe for getting function arguments and return
Please specify appropriate method name pattern instead of the placeholder in the trigger properties - see the top node shown on the screenshot you provided.
You have "agentlog" specified. The output will be written to the agent log file <user home>/.yjp/log/<name>-<pid>.log. Please see the other options above the field e.g. to explicitly specify the output file name.
You have "agentlog" specified. The output will be written to the agent log file <user home>/.yjp/log/<name>-<pid>.log. Please see the other options above the field e.g. to explicitly specify the output file name.
Re: writing probe for getting function arguments and return
i know it was a stupid noob question and thanks for coping with that.
now I'm seeing the results in the log file.
now I'm seeing the results in the log file.
Re: writing probe for getting function arguments and return
btw,
im getting this with {@params} :
is there a way to log the array's contents too?(or content of custom objects)
im getting this with {@params} :
Code: Select all
22.9-166 4.402: Entering: MyTest:main(java.lang.String[])
this: MyTest
params:
[Ljava.lang.String;@6767c1fc
-
- Posts: 6160
- Joined: Wed Aug 11, 2004 8:37 am
- Contact:
Re: writing probe for getting function arguments and return
Currently this is not possible via a trigger. You should write a custom probe for more sophisticated parameter processing.