All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: fix stat attach bogus counts
@ 2010-03-17 13:11 Stephane Eranian
  2010-03-18 17:36 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Eranian @ 2010-03-17 13:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: peterz, mingo, paulus, davem, fweisbec, robert.richter,
	perfmon2-devel, eranian, eranian

	When perf stat -p pid is used, the events must be enabled
	immediately as there is no exec and thus no enable_on_exec.

	Signed-off-by: Stephane Eranian <eranian@google.com>

--
 builtin-stat.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 95db31c..3a91fad 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -159,8 +159,10 @@ static void create_perf_stat_counter(int counter, int pid)
 		}
 	} else {
 		attr->inherit	     = inherit;
-		attr->disabled	     = 1;
-		attr->enable_on_exec = 1;
+		if (target_pid == -1) {
+			attr->disabled	     = 1;
+			attr->enable_on_exec = 1;
+		}
 
 		fd[0][counter] = sys_perf_event_open(attr, pid, -1, -1, 0);
 		if (fd[0][counter] < 0 && verbose)

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

* Re: [PATCH] perf: fix stat attach bogus counts
  2010-03-17 13:11 [PATCH] perf: fix stat attach bogus counts Stephane Eranian
@ 2010-03-18 17:36 ` Ingo Molnar
  2010-03-18 18:16   ` stephane eranian
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2010-03-18 17:36 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: linux-kernel, peterz, paulus, davem, fweisbec, robert.richter,
	perfmon2-devel, eranian


* Stephane Eranian <eranian@google.com> wrote:

> 	When perf stat -p pid is used, the events must be enabled
> 	immediately as there is no exec and thus no enable_on_exec.
> 
> 	Signed-off-by: Stephane Eranian <eranian@google.com>
> 
> --
>  builtin-stat.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 95db31c..3a91fad 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -159,8 +159,10 @@ static void create_perf_stat_counter(int counter, int pid)
>  		}
>  	} else {
>  		attr->inherit	     = inherit;
> -		attr->disabled	     = 1;
> -		attr->enable_on_exec = 1;
> +		if (target_pid == -1) {
> +			attr->disabled	     = 1;
> +			attr->enable_on_exec = 1;
> +		}

Mind checking latest -tip, which has these commits:

d6d901c: perf events: Change perf parameter --pid to process-wide collection instead of thread-wid
46be604: perf record: Enable counters only when kernel is execing subcommand
6be2850: perf stat: Enable counters when collecting process-wide or system-wide data

as they fix/improve various --pid related behavioral aspects of perf. Does it 
work fine for you now?

	Ingo

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

* Re: [PATCH] perf: fix stat attach bogus counts
  2010-03-18 17:36 ` Ingo Molnar
@ 2010-03-18 18:16   ` stephane eranian
  0 siblings, 0 replies; 3+ messages in thread
From: stephane eranian @ 2010-03-18 18:16 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Stephane Eranian, linux-kernel, peterz, paulus, davem, fweisbec,
	robert.richter, perfmon2-devel

On Thu, Mar 18, 2010 at 6:36 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Stephane Eranian <eranian@google.com> wrote:
>
>>       When perf stat -p pid is used, the events must be enabled
>>       immediately as there is no exec and thus no enable_on_exec.
>>
>>       Signed-off-by: Stephane Eranian <eranian@google.com>
>>
>> --
>>  builtin-stat.c |    6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
>> index 95db31c..3a91fad 100644
>> --- a/tools/perf/builtin-stat.c
>> +++ b/tools/perf/builtin-stat.c
>> @@ -159,8 +159,10 @@ static void create_perf_stat_counter(int counter, int pid)
>>               }
>>       } else {
>>               attr->inherit        = inherit;
>> -             attr->disabled       = 1;
>> -             attr->enable_on_exec = 1;
>> +             if (target_pid == -1) {
>> +                     attr->disabled       = 1;
>> +                     attr->enable_on_exec = 1;
>> +             }
>
> Mind checking latest -tip, which has these commits:
>
> d6d901c: perf events: Change perf parameter --pid to process-wide collection instead of thread-wid
> 46be604: perf record: Enable counters only when kernel is execing subcommand
> 6be2850: perf stat: Enable counters when collecting process-wide or system-wide data
>
> as they fix/improve various --pid related behavioral aspects of perf. Does it
> work fine for you now?
>
They indeed included the same fix.
So that's fine now.

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

end of thread, other threads:[~2010-03-18 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-17 13:11 [PATCH] perf: fix stat attach bogus counts Stephane Eranian
2010-03-18 17:36 ` Ingo Molnar
2010-03-18 18:16   ` stephane eranian

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.