Hi Thomas,

I want to trace the thread_reaper and want to find out, how often it runs and 
how many threads it really reaps.
I use this one-liner in the first step:
[r...@itotcsol104 bin]# dtrace -n 'fbt:genunix:thread_reaper: { @num[probefunc] 
= count(); }'
dtrace: description 'fbt:genunix:thread_reaper: ' matched 1 probe
^C

During the run there were created about 40,000 threads - the threads exit 
immediately after their work. I monitored the number of threads with the 
nthread macro of mdb.
The mentioned dtrace script ran during the whole test and ~10 minutes 
afterwards, but I do not get any output from it.

What am I doing wrong? Can anybody help me out with this?

The thread_reaper thread is created early on in the boot process
and runs in perpetuity, therefore you won't see its entry or
return probes fired. It gets kicked into life whenever there
are a bunch of threads ready to be reaped. A very simple
approach would be to look at when thread_free() is called from
thread_reap_list() as in the example below. Your best bet is
to check out the code and follow it through. Someone with more
knowledge of this area may have a better approach.

#!/usr/sbin/dtrace -qs

thread_reap_list:entry
{
        self->in = 1;
}

thread_free:entry
/self->in/
{
        @["threads reaped"] = count();
}

thread_reap_list:return
/self->in/
{
        self->in = 0;
}

Jon.
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to