Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-16 Thread Jim Mauro
What kind of system is this, and what release of Solaris?
Enabling all the probes for all the function entry points in a process
(pid$1:::entry) can take some time, and may make your terminal
window appear hung, but it should not almost hang your system
(unless you did this on a laptop or small, single CPU machine).

If you have thread contention, use the plockstat provider.
Run plockstat -V  and save the output. The -V
flag will generate the actual D that plockstat uses (to stderr if
I remember right). You can save that and use it as a building
block for chasing with threads are hitting your contended locks.

Of course, you may find the output of plockstat -A -p PID is all you
need...

Thanks,
/jim


[EMAIL PROTECTED] wrote:
 I tried this script (attached below) but it printed only 1 thread (shown 
 below). When I tried :::entry and my system was almost hung. I think pstack 
 is good enough for my purpose. :-)

 BTW any script to find out which two threads are causing lock contention 
 /deadlock?

 #!/usr/sbin/dtrace -s
 #pragma D option quiet
 #pragma D option defaultargs

 pid$1:::entry
 / this-thread_is_already_printed != 1 /
 {
this-thread_is_already_printed = 1;
printf(thread %d: \n, tid);
ustack(50);
 }

 $./pstack.d 16028
 thread 11:

  libc.so.1`_lwp_mutex_lock
  libc.so.1`_lwp_cond_reltimedwait+0x78
  libc.so.1`_lwp_cond_timedwait+0x1c
  libjvm.so`__1cHMonitorEwait6Mil_i_+0x328
  libjvm.so`__1cIVMThreadDrun6M_v_+0x1b4
  libjvm.so`__1cG_start6Fpv_0_+0x208
  libc.so.1`_lwp_start 


 --- On Fri, 11/14/08, Adam Leventhal [EMAIL PROTECTED] wrote:

   
 From: Adam Leventhal [EMAIL PROTECTED]
 Subject: Re: [dtrace-discuss] truss -fall equivalent in DTrace
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 Cc: Mark Plotnick [EMAIL PROTECTED], dtrace-discuss@opensolaris.org
 Date: Friday, November 14, 2008, 7:32 PM
 On Fri, Nov 14, 2008 at 12:40:55AM -0800,
 [EMAIL PROTECTED] wrote:
 
 Can I get pstack equivalent script using DTrace?
   
 You can use ustack() at any probe.

 Adam

 -- 
 Adam Leventhal, Fishworks
 http://blogs.sun.com/ahl
 


   
 ___
 dtrace-discuss mailing list
 dtrace-discuss@opensolaris.org
   
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-14 Thread [EMAIL PROTECTED]
Thanx a lot. 

Can I get pstack equivalent script using DTrace?

One problem is if we call java from C (using JNI) such stacks are not shown in 
pstack.

One more problem is running instance is hang thread lock can we have a script 
which shows which all threads are causing deadlock?

--- On Fri, 11/7/08, Mark Plotnick [EMAIL PROTECTED] wrote:

 Check out Brendan Gregg's dtruss shell script (available
 from his web site or as part of MacOSX Leopard). It emulates truss using
 dtrace, including truss's -f option.


  
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-14 Thread Adam Leventhal
On Fri, Nov 14, 2008 at 12:40:55AM -0800, [EMAIL PROTECTED] wrote:
 Can I get pstack equivalent script using DTrace?

You can use ustack() at any probe.

Adam

-- 
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-07 Thread P. Remek
First one note about your comparison with truss. As you said, truss follows
child processes when tracing system calls. But system calls != user-land
functions. Actually you can write dtrace script which will trace system calls
of your program and will follow forked child processes as well as  truss -fall
is doing it using syscall provider - it's probes are system-wide so there's
really nothing that would avoid you to write a d script which would trace
syscalls, and log down only those records which would match particular
PID and all its child PIDs (it is easy within dtrace to track PIDs and
dynamically
keep PID tree of some process).

When doing user-land tracing, child following is much more complicated. See
https://www.opensolaris.org/jive/thread.jspa?messageID=226151

Remek

On Wed, Nov 5, 2008 at 11:21 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I have an executable. When I attach a truss, we have to give $truss -o 
 truss.out -fall ./a.out. It shows all system calls made by this program and 
 all the child processes it forks.

 Where as if I am using a DTrace script I am not able to do it.

 ./sample.d -c a.out
 pid$1::somefunctionname:entry
 {
printf(%s is called by %d,probefunc, tid);
 }




 ___
 dtrace-discuss mailing list
 dtrace-discuss@opensolaris.org

___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-07 Thread Mark Plotnick
Check out Brendan Gregg's dtruss shell script (available from his web
site or as part of MacOSX Leopard). It emulates truss using dtrace,
including truss's -f option.
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-06 Thread [EMAIL PROTECTED]
What I mean to ask is will PID provider trace child processes forked by the 
parent process? 


--- On Wed, 11/5/08, Angelo Rajadurai [EMAIL PROTECTED] wrote:

 From: Angelo Rajadurai [EMAIL PROTECTED]
 Subject: Re: [dtrace-discuss] truss -fall equivalent in DTrace
 To: [EMAIL PROTECTED]
 Cc: dtrace-discuss@opensolaris.org
 Date: Wednesday, November 5, 2008, 2:52 PM
 Change $1 to $target!
 
 (ie)
 
 ./sample.d -c a.out
 pid$target::somefunctionname:entry
 {
printf(%s is called by %d,probefunc, tid);
 }
 
 In case you want to find the funcstions of a running
 process (say pid 1234)
 you have two options.
 
 ./sample.d --p 1234
 pid$target::somefunctionname:entry
 {
printf(%s is called by %d,probefunc, tid);
 }
 
 or
 ./sample.d  1234
 pid$1::somefunctionname:entry
 {
printf(%s is called by %d,probefunc, tid);
 }
 
 
 HTHs
 
 Angelo
 
 On Nov 5, 2008, at 5:21 AM, [EMAIL PROTECTED] wrote:
 
  I have an executable. When I attach a truss, we have
 to give $truss -o truss.out -fall ./a.out. It shows all
 system calls made by this program and all the child
 processes it forks.
  
  Where as if I am using a DTrace script I am not able
 to do it.
  
  ./sample.d -c a.out
  pid$1::somefunctionname:entry
  {
 printf(%s is called by %d,probefunc,
 tid);
  }
  
  
  
  
  ___
  dtrace-discuss mailing list
  dtrace-discuss@opensolaris.org


  
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-06 Thread michael schuster
[EMAIL PROTECTED] wrote:
 What I mean to ask is will PID provider trace child processes forked by the 
 parent process? 

no. You need to trace fork/exec system calls (or similar events) and run a 
new script (or the same again ...) with appropriate arguments (ie pid).

HTH
Michael
-- 
Michael Schuster http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


[dtrace-discuss] truss -fall equivalent in DTrace

2008-11-05 Thread [EMAIL PROTECTED]
I have an executable. When I attach a truss, we have to give $truss -o 
truss.out -fall ./a.out. It shows all system calls made by this program and all 
the child processes it forks.

Where as if I am using a DTrace script I am not able to do it.

./sample.d -c a.out
pid$1::somefunctionname:entry
{
printf(%s is called by %d,probefunc, tid);
}



  
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss -fall equivalent in DTrace

2008-11-05 Thread Angelo Rajadurai
Change $1 to $target!

(ie)

./sample.d -c a.out
pid$target::somefunctionname:entry
{
printf(%s is called by %d,probefunc, tid);
}

In case you want to find the funcstions of a running process (say pid  
1234)
you have two options.

./sample.d --p 1234
pid$target::somefunctionname:entry
{
printf(%s is called by %d,probefunc, tid);
}

or
./sample.d  1234
pid$1::somefunctionname:entry
{
printf(%s is called by %d,probefunc, tid);
}


HTHs

Angelo

On Nov 5, 2008, at 5:21 AM, [EMAIL PROTECTED] wrote:

 I have an executable. When I attach a truss, we have to give $truss - 
 o truss.out -fall ./a.out. It shows all system calls made by this  
 program and all the child processes it forks.

 Where as if I am using a DTrace script I am not able to do it.

 ./sample.d -c a.out
 pid$1::somefunctionname:entry
 {
printf(%s is called by %d,probefunc, tid);
 }




 ___
 dtrace-discuss mailing list
 dtrace-discuss@opensolaris.org

___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org