public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* pid and execname mismatches
@ 2010-07-22 14:29 tonyg362
  2010-07-22 14:50 ` Mark Wielaard
  2010-07-22 15:12 ` Frank Ch. Eigler
  0 siblings, 2 replies; 3+ messages in thread
From: tonyg362 @ 2010-07-22 14:29 UTC (permalink / raw)
  To: systemtap


I'm trying to collect the pids and execnames of every process when it enters
the scheduler. The problem is that it seems as though the pid of the process
I use for the -c option always gives me the execname of the stapio process.
I thought maybe there was a problem with looking at the incorrect
task_struct because I am inside the scheduler, so I got this info directly
from the prev task_struct using context variables. e.g.

global pidlist

probe kernel.statement("schedule@kernel/sched.c:line#") {
    ppid = $prev->tgid
    name = kernel_string($prev->comm)

    if (!([ppid] in pidlist))
        pidlist[ppid] = name
}

probe end {
    foreach ([pid] in pidlist)
        printf("%d:%s\n", pid, pidlist[pid])
}

However, if I just hook into system calls and do a similar thing the pids
and execnames match up correctly. Am I doing something wrong?
-- 
View this message in context: http://old.nabble.com/pid-and-execname-mismatches-tp29237551p29237551.html
Sent from the Sourceware - systemtap mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pid and execname mismatches
  2010-07-22 14:29 pid and execname mismatches tonyg362
@ 2010-07-22 14:50 ` Mark Wielaard
  2010-07-22 15:12 ` Frank Ch. Eigler
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2010-07-22 14:50 UTC (permalink / raw)
  To: tonyg362; +Cc: systemtap

On Thu, 2010-07-22 at 07:29 -0700, tonyg362 wrote:
> I'm trying to collect the pids and execnames of every process when it enters
> the scheduler. The problem is that it seems as though the pid of the process
> I use for the -c option always gives me the execname of the stapio process.

This might come from the the following in runtime/staprun/mainloop.c:
#define WORKAROUND_BZ467568 1  /* PR 6964; XXX: autoconf when able */
I suspect that if you remove that line things work as expected. As the
comment says, it would be good to add some sort of autoconf for this.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pid and execname mismatches
  2010-07-22 14:29 pid and execname mismatches tonyg362
  2010-07-22 14:50 ` Mark Wielaard
@ 2010-07-22 15:12 ` Frank Ch. Eigler
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Ch. Eigler @ 2010-07-22 15:12 UTC (permalink / raw)
  To: tonyg362; +Cc: systemtap

tonyg362 <tonyg3622@yahoo.com> writes:

> [...]
>     if (!([ppid] in pidlist))
>         pidlist[ppid] = name
> [...]

The problem here is that sometimes the execname() of a particular pid
changes, such as if it ever does an exec().  So you need to keep that
table updated even if a previous entry exists.

- FChE

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-22 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-22 14:29 pid and execname mismatches tonyg362
2010-07-22 14:50 ` Mark Wielaard
2010-07-22 15:12 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).