All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] perf, tools: Stop perf stat -p when profiled process exits v2
Date: Wed, 12 Sep 2012 08:54:18 -0600	[thread overview]
Message-ID: <5050A21A.3030102@gmail.com> (raw)
In-Reply-To: <1347460832-32118-1-git-send-email-andi@firstfloor.org>

On 9/12/12 8:40 AM, Andi Kleen wrote:
> -		while(!done) sleep(1);
> +		char piddir[40];
> +		if (target.pid && access("/proc", X_OK) == 0)
> +			snprintf(piddir, sizeof piddir, "/proc/%d", atoi(target.pid));

else path has piddir not set. Also as Namyhung pointed out target.pid 
can have multiple pids in it, so this fails if a user specified -p 
pid1,pid2 -- it will only check if the first process died.

Perhaps a more generic perf_target__is_alive function is needed that can 
check if the given tid(s) or pid(s) have terminated.

David

  reply	other threads:[~2012-09-12 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 14:40 [PATCH] perf, tools: Stop perf stat -p when profiled process exits v2 Andi Kleen
2012-09-12 14:54 ` David Ahern [this message]
2012-09-13 15:52   ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5050A21A.3030102@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.