Gaurav
2008-Jun-16 11:03 UTC
[dtrace-discuss] Stack trace of java application using Dtrace
Hi all i want to view the stack trace of the real time java application using DTrace probes. i am using jrts provider for finding the information of real time threads. In this i have used the ustack(), jstack() and this gives the following type of information libjvm.so`__1cJJavaCallsMcall_virtual6FpnJJavaValue_nGHandle_nLKlassHandle_nMsymbolHandle_5pnGThread__v_+0x5e libjvm.so`__1cMthread_entry6FpnKJavaThread_pnGThread__v_+0xc8 libjvm.so`__1cKJavaThreadRthread_main_inner6M_v_+0x51 libjvm.so`__1cKJavaThreadDrun6M_v_+0x163 libjvm.so`__1cG_start6Fpv_0_+0x4c libc.so.1`_thr_setup+0x4e libc.so.1`_lwp_start But i want to trace following type of information java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) java.io.BufferedInputStream.fill(BufferedInputStream.java:218) java.io.BufferedInputStream.read(BufferedInputStream.java:235) java.io.FilterInputStream.read(FilterInputStream.java:66) sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:448) sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) java.lang.Thread.run(Thread.java:713) -- This message posted from opensolaris.org
Frederic Parain
2008-Jun-16 11:40 UTC
[dtrace-discuss] Stack trace of java application using Dtrace
Hi, From the call stack you sent, the thread is not executing Java code yet, so only the native methods called are displayed. Here''s an output produced by jstack() where the thread has some Java methods (from classes Vector and synchronizedvector) on its call stack : libjvm.so`void ObjectMonitor::enter_interruptible(int,Thread*)+0x284 libjvm.so`void ObjectSynchronizer::instance_slow_enter(Handle,BasicLock*,int,Thread*)+0x16a libjvm.so`void ObjectSynchronizer::slow_enter_interruptible(Handle,BasicLock*,int,Thread*)+0x37 libjvm.so`void InterpreterRuntime::monitorenter(JavaThread*,BasicObjectLock*)+0x63 java/util/Vector.add synchronizedvector/Main$RealTimeProducer.run StubRoutines libjvm.so`void JavaCalls::call_helper(JavaValue*,methodHandle*,JavaCallArguments*,Thread*)+0x1a1 libjvm.so`void os::os_exception_wrapper(void(*)(JavaValue*,methodHandle*,JavaCallArguments*,Thread*),JavaValue*,methodHandle*,JavaCallArguments*,Thread*)+0x14 libjvm.so`void JavaCalls::call(JavaValue*,methodHandle,JavaCallArguments*,Thread*)+0x28 libjvm.so`void JavaCalls::call_virtual(JavaValue*,KlassHandle,symbolHandle,symbolHandle,JavaCallArguments*,Thread*)+0xa7 libjvm.so`void JavaCalls::call_virtual(JavaValue*,Handle,KlassHandle,symbolHandle,symbolHandle,Thread*)+0x5e libjvm.so`void thread_entry(JavaThread*,Thread*)+0x12b libjvm.so`void RealtimeThread::thread_main_inner()+0x154 libjvm.so`void JavaThread::run()+0x163 libjvm.so`void*_start(void*)+0x4c libc.so.1`_thr_setup+0x4e libc.so.1`_lwp_start So, jstack() prints the full stack, including native calls and Java calls. Java methods are displayed with their full Java name, but the line numbers are not displayed. The jrts provider is specific to the Java Real-Time System, so I suggest you to post your questions on the Java RTS forum : http://forum.java.sun.com/forum.jspa?forumID=548 Fred Gaurav wrote:> Hi all > > i want to view the stack trace of the real time java application using DTrace probes. > i am using jrts provider for finding the information of real time threads. > In this i have used the ustack(), jstack() and this gives the following type of information > > libjvm.so`__1cJJavaCallsMcall_virtual6FpnJJavaValue_nGHandle_nLKlassHandle_nMsymbolHandle_5pnGThread__v_+0x5e > libjvm.so`__1cMthread_entry6FpnKJavaThread_pnGThread__v_+0xc8 > libjvm.so`__1cKJavaThreadRthread_main_inner6M_v_+0x51 > libjvm.so`__1cKJavaThreadDrun6M_v_+0x163 > libjvm.so`__1cG_start6Fpv_0_+0x4c > libc.so.1`_thr_setup+0x4e > libc.so.1`_lwp_start > > But i want to trace following type of information > > java.net.SocketInputStream.socketRead0(Native Method) > java.net.SocketInputStream.read(SocketInputStream.java:129) > java.io.BufferedInputStream.fill(BufferedInputStream.java:218) > java.io.BufferedInputStream.read(BufferedInputStream.java:235) > java.io.FilterInputStream.read(FilterInputStream.java:66) > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:448) > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) > java.lang.Thread.run(Thread.java:713) > > > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >-- Frederic Parain - Sun Microsystems 180, av. de l''Europe, ZIRST de Montbonnot 38334 Saint Ismier, FRANCE Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Sun.COM