Hi Cni,

Your script is not operating the way you intended, but DTrace is
functioning properly. The fbt return probes are firing before the
syscall return probes and thus setting self->time to 0 so that when
the syscall return probe fires the predicate evaluates to false.

You don't seem to be doing any computation with self->time. If you're
just trying to count the number of times the functions you've listed
fire, you can just do this:

fbt:ipc::entry,
fbt:semsys::entry,
fbt:genunix:sem*:entry,
syscall::sem*:entry
{
     this->name = strjoin(probeprov, strjoin(strjoin(":", probemod),
strjoin(":", probefunc)));
     @semcheck[this->name] = count();
}

Adam

On Fri, Aug 26, 2011 at 1:17 AM, Juhasz Balint <cni...@gmail.com> wrote:
> Hy!
>
>
> I think i find some interesting problem (maybe it is basic :) ):
> root@thelab ~/Tools/IPC$ ./ipc_count_syscall.d
>
>  syscall::semsys                                                1690
> root@thelab ~/Tools/IPC$ cat ./ipc_count_syscall.d
> #!/usr/sbin/dtrace -qs
>
> #pragma D option quiet
> #pragma D option destructive
>
> syscall::sem*:entry
> {
>      self->time = timestamp;
> }
>
> syscall::sem*:return
> /self->time/
> {
>      this->name = strjoin(probeprov, strjoin("::",probefunc));
>      @semcheck[this->name] = count();
>      self->time = 0;
> }
>
> tick-10sec
> {
>      exit(0);
> }
>
> It's ok, but if i put fbt provider checking to this script, i can't
> see syscall fields in the count() result:
>
> root@thelab ~/Tools/IPC$ ./ipc_count_all.d
>
>  fbt:genunix:sema_destroy                                          4
>  fbt:genunix:sema_init                                             8
>  fbt:genunix:sema_tryp                                            81
>  fbt:genunix:sema_p                                              208
>  fbt:genunix:sema_v                                              289
>  fbt:ipc:ipc_lock_internal                                      1850
>  fbt:ipc:ipcperm_access                                         1850
>  fbt:semsys:sem_undo_add                                        1850
>  fbt:semsys:sem_undo_compar                                     1850
>  fbt:semsys:semsys                                              1850
> root@thelab ~/Tools/IPC$ cat ./ipc_count_all.d
> #!/usr/sbin/dtrace -qs
>
> #pragma D option quiet
> #pragma D option destructive
>
> fbt:ipc::entry,
> fbt:semsys::entry,
> fbt:genunix:sem*:entry,
> syscall::sem*:entry
> {
>      self->time = timestamp;
> }
>
> fbt:ipc::return,
> fbt:semsys::return,
> fbt:genunix:sem*:return
> /self->time/
> {
>      this->name = strjoin(probeprov,
> strjoin(strjoin(":",probemod),strjoin(":",probefunc)));
>      @semcheck[this->name] = count();
>      self->time = 0;
> }
>
> syscall::sem*:return
> /self->time/
> {
>      this->name = strjoin(probeprov, strjoin("::",probefunc));
>      @semcheck[this->name] = count();
>      self->time = 0;
> }
>
> tick-10sec
> {
>      exit(0);
> }
>
> If i modify the script, it also not working.
>
> root@thelab ~/Tools/IPC$ ./ipc_count_all.d
>
>  fbt:genunix:sema_tryp                                             1
>  fbt:genunix:sema_destroy                                          4
>  fbt:genunix:sema_init                                            14
>  fbt:genunix:sema_p                                               59
>  fbt:genunix:sema_v                                               60
>  fbt:ipc:ipc_lock_internal                                      1850
>  fbt:ipc:ipcperm_access                                         1850
>  fbt:semsys:sem_undo_add                                        1850
>  fbt:semsys:sem_undo_compar                                     1850
>  fbt:semsys:semsys                                              1850
> root@thelab ~/Tools/IPC$ cat ./ipc_count_all.d
> #!/usr/sbin/dtrace -qs
>
> #pragma D option quiet
> #pragma D option destructive
>
> fbt:ipc::entry,
> fbt:semsys::entry,
> fbt:genunix:sem*:entry,
> syscall::sem*:entry
> {
>      self->time = timestamp;
> }
>
> fbt:ipc::return,
> fbt:semsys::return,
> fbt:genunix:sem*:return,
> syscall::sem*:return
> /self->time/
> {
>      this->name = strjoin(probeprov,
> strjoin(strjoin(":",probemod),strjoin(":",probefunc)));
>      @semcheck[this->name] = count();
>      self->time = 0;
> }
>
> tick-10sec
> {
>      exit(0);
> }
>
> I know i can use printa to print probeprov, probemod and probefunc but
> i prefer strjoin :)
> In this case i doesn't understand where are syscall' count.
>
> Anyone has an idea about this problem?
>
> Cni
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org
>



-- 
Adam Leventhal, Delphix
http://dtrace.org/blogs/ahl

275 Middlefield Road, Suite 50
Menlo Park, CA 94025
http://www.delphix.com
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to