This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: how to use task_finder
Dave Nomura wrote:
> Your wiki was very helpful but I still have a few questions about the
> wiki explanation:
>> stap_start_task_finder() should be called to start everything up.
>
> I assume this means that the task_finder goes out and matches up all of
> the pid's and pathnames can then notifies you via the callback. Is that
> right?
Yes (for a little more detail see the "under the covers" description below).
>> 'register_p' will be set to 1 if you are supposed to attach to the
>> process, 0 otherwise.
> I'm not sure what this means. If all I was expecting the task finder to
> do was to find the task matching PID_OR_NAME, why would I have to attach
> to the process?
When register_p is 1, that means "here's a thread that you said you'd be
interested in". At that point you can attach a utrace engine to the
thread, attach a uprobe to the thread, attach your itrace stuff to it, etc.
When register_p is 0, that means "hey, you know this thread I told you
about earlier? it is going away now and you need to cleanup". At this
point you can detach any utrace engines, detach uprobes, detach itrace, etc.
> I think it might be helpful to give an overview of how task_finder does
> its work in case someone needs to understand what is going on under the
> covers.
Under the covers, it attaches a utrace engine to watch
UTRACE_EVENT(CLONE) and UTRACE_EVENT(EXEC) events to every non-kernel
thread in the system, looking for pid/path matches (and monitoring all
new clone/execs). When it finds a match, it notifies the upper layer by
calling the callback (and attaches a UTRACE_EVENT(DEATH) engine). When
the matched thread dies, it notifies the upper layer by calling the
callback.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)