This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: kernel read fault using task_state()
- From: David Smith <dsmith at redhat dot com>
- To: Frits Hoogland <frits dot hoogland at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Wed, 12 Aug 2009 09:05:13 -0500
- Subject: Re: kernel read fault using task_state()
- References: <fbb8fbcd0908120636h14acafa0s649993bb025fd5e@mail.gmail.com>
On 08/12/2009 08:36 AM, Frits Hoogland wrote:
> in order to get information about the execution of a process, I've
> made a little systemtap program:
>
> probe begin{
> printf("Start of profile of pid: %d\n", target() )
> }
> probe timer.profile {
> printf("pid: %d , state: %d ", target(), task_state(target()) )
> }
Unfortunately, your script has an error. target() returns a pid.
task_state() takes a task pointer. Your timer.profile function should
look like this:
probe timer.profile {
printf("pid: %d, state: %d\n", target(), task_state(pid2task(target())))
}
To avoid the pid2task lookup, you could cache the target's task in a
global variable in your begin probe.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)