This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: kernel read fault using task_state()


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]