This discussion is archived
8 Replies Latest reply: Jul 31, 2009 1:14 AM by 807557 RSS

TSV and DRecord on Solaris

807557 Newbie
Currently Being Moderated
Hello,

Currently I am trying to monitor my Java RealTime application that runs with Sun Java RTS 2.2 on Solaris 10, using the TSV tool (that comes with Java RTS 2.2) and the DTrace utility.

The problem that I have is, that the "dmonitor" script (available under the <TSV_InstallDir>/bin directory), recommended to be used by the TSV documentation, will not work since the sched:::change-pri probe does not work. Please note that I have tried to use the drecord script as well, which also uses this DTrace probe, and it does not work either. (Please note that the dmonitor script only comes with the TSV delivered with Java RTS 2.2).

The message I get is : “... in action list: args[ ] may not be referenced because probe description sched:::change-pri matches an unstable set of probes”.
I have set the –x amin to the lowest in the dmonitor script (-x amin=Private/Private/Unknown) but the error stays.

Maybe also important to mention is, that I am starting the "dtrace" tool using "pfexec", like "pfexec dtrace ....". I have adapted the drecord and dmonitor tools for that.

For completeness, here's the dtrace script used by the dmonitor:
script='

BEGIN
{
   timeout = $1;
}

profile:::tick-1s
{
  this->count++;
}

profile-1s
/this->count >= timeout/
{
  exit(0);
}

sched:::on-cpu
/pid == $target && self->on_cpu == 0/
  {
    printf("%d on-cpu %d %d %d\n",timestamp,tid,cpu,curthread->t_pri);
    self->on_cpu = 1;
  }

sched:::off-cpu
/pid == $target && self->on_cpu == 1/
  {
    printf("%d off-cpu %d \n",timestamp,tid);
    self->on_cpu = 0;
  }

sched:::change-pri
/pid == $target/
  {    
    printf("%d change-pri %d %d\n",timestamp,args[0]->pr_lwpid,args[2]);
  }

jrts$target:::thread-set-name
{  
  printf("%d set-name %d %s\n",timestamp,(int)arg0,copyinstr(arg1,arg2));
}

jrts$target:::thread-start
{
  printf("%d set-name %d %s\n",timestamp,(int)arg0,copyinstr(arg4,arg5));
}

jrts$target:::user-event
{
    printf("%d user-event %d %d %d %s\n",timestamp,tid,cpu,curthread->t_pri,copyinstr(arg0,arg1));
}

'
Once I remove the sched:::change-pri probe completelly, the rest works.

Thank you a lot in advance for any hints ;)

Best regards,

Sergiu Burian
  • 1. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    Sergiu,

    Thanks for the detailed post (my own copy of TSV was downrev and missing the very useful dmonitor script).

    This is very puzzling. The error message means that either:

    a) the probe did not exist when Dtrace was started; or
    b) the clause matches more than one probe

    and in both cases the argument array can not be typed so you can not use arg[n] syntax to access them.

    There are a couple of possible work-arounds:

    1. Be more specific with the probe. Trying editing the script to use sched:RT:rt_change_priority:change-pri

    Of course if you want all the priority-change events then you need to produce additional clauses for the TS class as well. The full list of probes seems to be:
      986      sched           genunix                 thread_change_pri change-pri
     1020      sched                TS                ts_change_priority change-pri
     1021      sched                TS                          ts_yield change-pri
     1022      sched                TS                         ts_wakeup change-pri
     1023      sched                TS                        ts_trapret change-pri
     1024      sched                TS                          ts_sleep change-pri
     1025      sched                TS                         ts_setrun change-pri
     1026      sched                TS                        ts_preempt change-pri
     2192      sched                FX                fx_change_priority change-pri
     2193      sched                FX                          fx_yield change-pri
     2194      sched                FX                         fx_wakeup change-pri
     2195      sched                FX                        fx_preempt change-pri
     2214      sched                RT                rt_change_priority change-pri
    2. Change the script to use arg0, arg1, arg2 rather than arg[0], arg[1], arg[2] (this might entail some type casting - sorry not really my area)

    I will see if I can find out anything which may have changed in this area.

    Thanks,
    David Holmes
  • 2. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    Hi David,

    Your second suggested point has helped. This is actually a problem in the dmonitor script I would say. If I check the dtrace scripts from the Java RTS "doc/dtrace" directory, they do not use the args array, but arg0, arg1, arg2 ...

    Maybe you can address that to the TSV guys.

    Thanks a lot !

    Best regards,

    Sergiu Burian
  • 3. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    bsergiu wrote:
    Your second suggested point has helped. This is actually a problem in the dmonitor script I would say. If I check the dtrace scripts from the Java RTS "doc/dtrace" directory, they do not use the args array, but arg0, arg1, arg2 ...
    Using the untyped argN values will always work, but we remain perplexed as to why you see the problem with the args array and we don't.

    Unfortunately the DTrace folk don't seem to have any idea either:

    http://www.opensolaris.org/jive/thread.jspa?threadID=108873&tstart=0

    David
  • 4. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    Hi David,

    Thanks a lot (again!) for your support and efforts.

    Since I have seen that you have posted it on the Open Solaris forum, I just want to specify that I am encountering this issue on Sun Solaris (not Open Solaris). Maybe it is important ...
    uname -a
    SunOS sevilla 5.10 Generic_138888-07 sun4v sparc SUNW,SPARC-Enterprise-T5220
    Best regards,

    Sergiu
  • 5. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    Hi David,

    I have managed to get root rights for a short time on the machine, so I have quickly tried DTrace as root.
    The args array work, no problem !!! In that case, I am calling dtrace directly, not with pfexec.

    As a regular user, I only had rights for DTrace in user space. May this be the problem ?

    Best regards,

    Sergiu Burian
  • 6. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    Thanks for the information Sergui. (For some reason your postings didn't generate email notifications.) I'll pass this on to the DTrace folk.

    David
  • 7. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    That failure mode is caused by not having the dtrace_kernel permission.

    To use DTrace with JRTS you need to have: dtrace_user, dtrace_kernel and dtrace_proc permissions.

    David
  • 8. Re: TSV and DRecord on Solaris
    807557 Newbie
    Currently Being Moderated
    Hi David,

    Thank you again for your time and support!
    Even though the DTrace error message was a bit misleading, I am glad we have solved this problem.

    Best regards,

    Sergiu