changeset 1581:85ecc550df1f

Add systemtap java method tracing support. 2009-08-05 Mark Wielaard <mjw@redhat.com> * patches/icedtea-systemtap.patch: Remove workaround for nmethod.cpp. * tapset/hotspot.stp.in: Add tapset functions for hotspot.method_entry, hotspot.method_return, hotspot.compiled_method_load and hotspot.compiled_method_unload. * NEWS: Metion new support for java method tracing. * INSTALL: Add that java method tracing support needs systemtap 0.9.9 or higher.
author Mark Wielaard <mark@klomp.org>
date Wed, 05 Aug 2009 20:43:00 +0200
parents b0bb743c12d1
children e77f7270fd22
files ChangeLog INSTALL NEWS patches/icedtea-systemtap.patch tapset/hotspot.stp.in
diffstat 5 files changed, 92 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 17 16:24:09 2009 +0000
+++ b/ChangeLog	Wed Aug 05 20:43:00 2009 +0200
@@ -4,6 +4,16 @@
 	icedtea-6897844-xshm.patch,
 	icedtea-linux-separate-debuginfo.patch.
 
+2009-08-05  Mark Wielaard  <mjw@redhat.com>
+
+	* patches/icedtea-systemtap.patch: Remove workaround for nmethod.cpp.
+	* tapset/hotspot.stp.in: Add tapset functions for
+	hotspot.method_entry, hotspot.method_return,
+	hotspot.compiled_method_load and hotspot.compiled_method_unload.
+	* NEWS: Metion new support for java method tracing.
+	* INSTALL: Add that java method tracing support needs systemtap
+	0.9.9 or higher.
+
 2009-12-10  Andrew Haley  <aph@redhat.com>
 
 	* patches/hotspot/default/icedtea-debuginfo.patch:
--- a/INSTALL	Thu Dec 17 16:24:09 2009 +0000
+++ b/INSTALL	Wed Aug 05 20:43:00 2009 +0200
@@ -48,6 +48,7 @@
 you cannot move that to another location without adjusting the paths
 in the tapset/hotspot.stp file. For example:
  --enable-systemtap --with-abs-install-dir=/usr/lib/jvm/java-1.6.0-openjdk
+(Java method tracing works starting with systemtap 0.9.9)
 
 See ./configure --help if you need to override the defaults.
 
--- a/NEWS	Thu Dec 17 16:24:09 2009 +0000
+++ b/NEWS	Wed Aug 05 20:43:00 2009 +0200
@@ -26,6 +26,10 @@
 - Security updates from Sun.
 - Plugin/Netx security fix.
 
+New in release 1.6 (UNRELEASED)
+
+- Added java method tracing using systemtap version 0.9.9+.
+
 New in release 1.5 (2009-05-20)
 
 - Static trace support through systemtap.
--- a/patches/icedtea-systemtap.patch	Thu Dec 17 16:24:09 2009 +0000
+++ b/patches/icedtea-systemtap.patch	Wed Aug 05 20:43:00 2009 +0200
@@ -9,24 +9,6 @@
 +CFLAGS += -DDTRACE_ENABLED
 +
 +# It doesn't support HAVE_DTRACE_H though.
-diff -r 945bf7540697 src/share/vm/code/nmethod.cpp
---- openjdk/hotspot/src/share/vm/code/nmethod.cpp	Thu Jan 22 14:42:01 2009 -0800
-+++ openjdk/hotspot/src/share/vm/code/nmethod.cpp	Mon Feb 02 13:47:34 2009 +0100
-@@ -22,6 +22,14 @@
-  *
-  */
- 
-+#ifdef __GNUC__
-+// GCC seems to have some trouble with the inserted probes.
-+// error: _probe_compiled__method__unload causes a section type conflict
-+// error: compiled__method__unload_probe_name causes a section type conflict
-+// So disable probe insertion for now.
-+#undef DTRACE_ENABLED
-+#endif
-+
- # include "incls/_precompiled.incl"
- # include "incls/_nmethod.cpp.incl"
- 
 diff -r 945bf7540697 src/share/vm/prims/jni.cpp
 --- openjdk/hotspot/src/share/vm/prims/jni.cpp	Thu Jan 22 14:42:01 2009 -0800
 +++ openjdk/hotspot/src/share/vm/prims/jni.cpp	Mon Feb 02 13:47:34 2009 +0100
--- a/tapset/hotspot.stp.in	Thu Dec 17 16:24:09 2009 +0000
+++ b/tapset/hotspot.stp.in	Wed Aug 05 20:43:00 2009 +0200
@@ -409,13 +409,84 @@
                      name, thread_id, id, class);
 }
 
-// Doesn't work yet.
-// method__entry
-// method__return
+/* hotspot.method_entry (extended probe)
+   Triggers when a method is entered.
+   Sets thread_id to the current java thread id, class to the name of
+   the class, method to the name of the method, and sig to the
+   signature string of the method.
+   Needs -XX:+ExtendedDTraceProbes.
+*/
+probe hotspot.method_entry =
+  process("@ABS_CLIENT_LIBJVM_SO@").mark("method__entry"),
+  process("@ABS_SERVER_LIBJVM_SO@").mark("method__entry")
+{
+  name = "method_entry";
+  thread_id = $arg1;
+  class = user_string_n($arg2, $arg3);
+  method = user_string_n($arg4, $arg5);
+  sig = user_string_n($arg6, $arg7);
+  probestr = sprintf("%s(thread_id=%d,class='%s',method='%s',sig='%s')",
+		     name, thread_id, class, method, sig);
+}
 
-// Missing
-// compiled__method__load
-// compiled__method__unload
+/* hotspot.method_return (extended probe)
+   Triggers when a method returns.
+   Sets thread_id to the current java thread id, class to the name of
+   the class, method to the name of the method, and sig to the
+   signature string of the method.
+   Needs -XX:+ExtendedDTraceProbes.
+*/
+probe hotspot.method_return =
+  process("@ABS_CLIENT_LIBJVM_SO@").mark("method__return"),
+  process("@ABS_SERVER_LIBJVM_SO@").mark("method__return")
+{
+  name = "method_return";
+  thread_id = $arg1;
+  class = user_string_n($arg2, $arg3);
+  method = user_string_n($arg4, $arg5);
+  sig = user_string_n($arg6, $arg7);
+  probestr = sprintf("%s(thread_id=%d,class='%s',method='%s',sig='%s')",
+		     name, thread_id, class, method, sig);
+}
+
+/* hotspot.compiled_method_load
+   Triggers when a compiled method is loaded.
+   Sets class to the name of the class, method to the name of the
+   method, sig to the signature string of the method, code to the
+   address where the code is loaded and size to the number of bytes of
+   code.
+*/
+probe hotspot.compiled_method_load =
+  process("@ABS_CLIENT_LIBJVM_SO@").mark("compiled__method__load"),
+  process("@ABS_SERVER_LIBJVM_SO@").mark("compiled__method__load")
+{
+  name = "compiled_method_load";
+  class = user_string_n($arg1, $arg2);
+  method = user_string_n($arg3, $arg4);
+  sig = user_string_n($arg5, $arg6);
+  code = $arg7;
+  size = $arg8;
+  probestr = sprintf("%s(class='%s',method='%s',sig='%s',code=0x%x,size=%d)",
+		     name, class, method, sig, code, size);
+}
+
+/* hotspot.compiled_method_unload
+   Triggers when a compiled method is unloaded.
+   Sets class to the name of the class, method to the name of the
+   method, sig to the signature string of the method.
+*/
+probe hotspot.compiled_method_unload =
+  process("@ABS_CLIENT_LIBJVM_SO@").mark("compiled__method__unload"),
+  process("@ABS_SERVER_LIBJVM_SO@").mark("compiled__method__unload")
+{
+  name = "compiled_method_unload";
+  class = user_string_n($arg1, $arg2);
+  method = user_string_n($arg3, $arg4);
+  sig = user_string_n($arg5, $arg6);
+  probestr = sprintf("%s(class='%s',method='%s',sig='%s')",
+		     name, class, method, sig);
+}
+
 
 // Extra private probes
 // hashtable__new_entry