Re: [PATCH] perf, tools: Stop perf stat -p when profiled process exits v3

2012-09-13 Thread Andi Kleen
> The is_alive function can be used by perf-top, perf-stat and perf-record > to know that its target has died so it can stop monitoring. Sorry that's to complicated and overengineered for me. My simple patch works for me at least. It's not solving world hunger, but it wasn't intended to do that.

Re: [PATCH] perf, tools: Stop perf stat -p when profiled process exits v3

2012-09-13 Thread David Ahern
On 9/13/12 9:58 AM, Andi Kleen wrote: From: Andi Kleen When counting a process with perf stat -p check if the process died and exit collection if yes. v2: Add more checks, handle non -p again. Handle /proc not there. v3: Handle multi pid case. Fix non /proc error path Signed-off-by: Andi Kleen

[PATCH] perf, tools: Stop perf stat -p when profiled process exits v3

2012-09-13 Thread Andi Kleen
From: Andi Kleen When counting a process with perf stat -p check if the process died and exit collection if yes. v2: Add more checks, handle non -p again. Handle /proc not there. v3: Handle multi pid case. Fix non /proc error path Signed-off-by: Andi Kleen --- tools/perf/builtin-stat.c | 14

Re: [PATCH] perf, tools: Stop perf stat -p when profiled process exits v2

2012-09-13 Thread Andi Kleen
On Wed, Sep 12, 2012 at 08:54:18AM -0600, David Ahern wrote: > 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/%

Re: [PATCH] perf, tools: Stop perf stat -p when profiled process exits v2

2012-09-12 Thread David Ahern
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

[PATCH] perf, tools: Stop perf stat -p when profiled process exits v2

2012-09-12 Thread Andi Kleen
From: Andi Kleen When counting a process with perf stat -p check if the process died and exit collection if yes. v2: Add more checks, handle non -p again. Handle /proc not there. Signed-off-by: Andi Kleen --- tools/perf/builtin-stat.c | 10 +- 1 files changed, 9 insertions(+), 1 dele

Re: [PATCH] perf, tools: Stop perf stat -p when profiled process exits

2012-09-12 Thread Namhyung Kim
Hi Andi, On Tue, 11 Sep 2012 23:09:04 -0700, Andi Kleen wrote: > From: Andi Kleen > > When counting a process with perf stat -p check if the process died > and exit collection if yes. I guess we need something similar for perf record as well. > > Signed-off-by: Andi Kleen > --- > tools/perf/b

[PATCH] perf, tools: Stop perf stat -p when profiled process exits

2012-09-11 Thread Andi Kleen
From: Andi Kleen When counting a process with perf stat -p check if the process died and exit collection if yes. Signed-off-by: Andi Kleen --- tools/perf/builtin-stat.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/built