Steven Reynolds
2007-Apr-22 18:55 UTC
[dtrace-discuss] new chime display to display java method calls for a thread
I''ve written the attached chime display that will show a histogram of method calls for a particular Java thread. I hope that some other people might find this useful. It needs the extended probe option turned on in the JVM. You can use prstat -L -p JVM_pid to select an interesting LWP ID (thread ID). When I wrote this, I found that I had a lot of errors like "scratch space overflow". I found two main things that I needed to do to avoid this error (a) filtered on a thread ID so that the results are only collected on a single thread, and (b) set the chime option of buffer policy to "ring". It''s possible that with buffer policy set to ring, that I might be able to trace more than one thread. I tried using trunc(@method_calls,20), but this didnot seem to work while running the chime display. Can anyone confirm or dis-confirm that trunc works with chime? thanks Steven This message posted from opensolaris.org -------------- next part -------------- A non-text attachment was scrubbed... Name: java_thread_method_calls.xml Type: text/xml Size: 5091 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070422/8a0616eb/attachment.xml>
Steven Reynolds
2007-Apr-23 02:00 UTC
[dtrace-discuss] Re: new chime display to display java method calls for a thread
Here is another chime display that shows the java method calls for all threads in the JVM. So my earlier comment about needing to filter on thread id was inaccurate. Hopefully, this display might be useful to someone... This message posted from opensolaris.org -------------- next part -------------- A non-text attachment was scrubbed... Name: java_method_calls.xml Type: text/xml Size: 4633 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070422/d80e350f/attachment.xml>
Tom Erickson
2007-Apr-23 23:52 UTC
[dtrace-discuss] Re: new chime display to display java method calls for a thread
Thanks Steven, I was hoping that someone would use the Java hotspot
provider in a Chime display. For anyone trying the script, be aware it
does not work in Java 5, because it needs the DTrace support added to
the Java SE 6 HotSpot VM. A mention of that requirement could be added
to the text that appears in the Description pane:
Displays a count of method calls for the given JVM. The target JVM
must be run with the -XX:+ExtendedDTraceProbes option. You can use
the jinfo command to view and modify JVM options.
Thanks for the helpful info. That''s exactly how I hoped people would
use
the Description property (and nice job using red font for the subsequent
caution). Since many are unfamiliar with the hotspot provider, I wonder
if some additional pointers in the description would be helpful, for
example:
http://blogs.sun.com/kamg/entry/built_in_dtrace_probes_in
http://www.devx.com/Java/Article/33943
The latter is an article by Jarod Jenson. Since that article includes an
example DTrace script, I decided to attach another display,
monitor_wait_times.xml, to demonstrate what that script looks like in
Chime.
Your display uses the $target built-in varible. Chime prompts for the
target as follows:
Target Process
Command or PID [ ]
When I ran your display with a command
java -XX:+ExtendedDTraceProbes SomeJavaProgram
it failed with the error "... probe description
hotspot298736:::method-entry does not match any probes".
To support running a target command rather than grabbing an already
running process, you need to add the zdefs (-Z) option to permit probe
definitions matching zero probes until the traced application starts.
The "zdefs" option is selectable in the wizard step "Test Run the
Display" (I see you already set some other DTrace options there).
Finally, in regard to your question about the trunc() action, yes it
works in Chime. I attached a simple example, test.xml, that uses
trunc(@, 10) every five seconds to limit the output of the syscall
provider.
Tom
This message posted from opensolaris.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: monitor_wait_times.xml
Type: text/xml
Size: 3728 bytes
Desc: not available
URL:
<http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070423/c6b141e2/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.xml
Type: text/xml
Size: 1999 bytes
Desc: not available
URL:
<http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070423/c6b141e2/attachment-0001.xml>
Steven Reynolds
2007-Apr-27 03:00 UTC
[dtrace-discuss] Re: new chime display to display java method calls for a thread
Ah thanks for the help and feedback! I''m re-posting with your suggestions. -- This message posted from opensolaris.org -------------- next part -------------- A non-text attachment was scrubbed... Name: java_method_calls.xml Type: text/xml Size: 5219 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070426/f9cd87f2/attachment.xml> -------------- next part -------------- A non-text attachment was scrubbed... Name: java_thread_method_calls.xml Type: text/xml Size: 5678 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070426/f9cd87f2/attachment-0001.xml>