public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Namhyung Kim <namhyung.kim@lge.com>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf-record: Create events initially disabled -- again
Date: Mon, 14 May 2012 07:09:48 -0600	[thread overview]
Message-ID: <4FB1041C.1050903@gmail.com> (raw)
In-Reply-To: <87sjf31a8c.fsf@sejong.aot.lge.com>

On 5/14/12 1:40 AM, Namhyung Kim wrote:
> Hi,
>
> On Sun, 13 May 2012 22:01:28 -0600, David Ahern wrote:
>> 764e16a changed perf-record to create events disabled by default and
>> enable them once perf initializations are done. This setting was dropped
>> by 0f82ebc. Now perf events are once again generated during perf's
>> initialization phase (e.g., generating maps).
>>
>> As an example, perf opens a lot of files at startup. Unpatched:
>>
>> perf record -e syscalls:sys_enter_open -ga -fo /tmp/perf.data -- sleep 1
>> [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 0.087 MB /tmp/perf.data (~3798 samples) ]
>>
>> Using perf-script to look at the samples shows the perf command generating
>> 563 of the 566 total events.
>>
>> Patched:
>>
>> perf record -e syscalls:sys_enter_open -ga -fo /tmp/perf.data -- sleep 1
>> [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 0.028 MB /tmp/perf.data (~1206 samples) ]
>>
>> Using perf-script to look at the samples does not show perf command.
>>
>> Signed-off-by: David Ahern<dsahern@gmail.com>
>> ---
>>   tools/perf/util/evsel.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>> index 21eaab2..6710cfe 100644
>> --- a/tools/perf/util/evsel.c
>> +++ b/tools/perf/util/evsel.c
>> @@ -70,6 +70,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
>>   	struct perf_event_attr *attr =&evsel->attr;
>>   	int track = !evsel->idx; /* only the first counter needs these */
>>
>> +	attr->disabled = 1;
>>   	attr->sample_id_all = opts->sample_id_all_missing ? 0 : 1;
>>   	attr->inherit	    = !opts->no_inherit;
>>   	attr->read_format   = PERF_FORMAT_TOTAL_TIME_ENABLED |
>> @@ -138,7 +139,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
>>
>>   	if (perf_target__none(&opts->target)&&
>>   	(!opts->group || evsel == first)) {
>> -		attr->disabled = 1;
>>   		attr->enable_on_exec = 1;
>>   	}
>>   }
>
> A problem I see is that it'll break group handling again:
>
> $ ./perf stat -g sleep 1
>
>   Performance counter stats for 'sleep 1':
>
>       <not counted>  task-clock
>       <not counted>  context-switches
>       <not counted>  CPU-migrations
>       <not counted>  page-faults
>       <not counted>  cycles
>       <not counted>  stalled-cycles-frontend
>       <not counted>  stalled-cycles-backend
>       <not counted>  instructions
>       <not counted>  branches
>       <not counted>  branch-misses
>
>         1.000868932 seconds time elapsed
>
> So I suggest changing perf_target__none() check to a proper one
> (perf_target__no_cpu? - the name might be changed soon) for your
> purpose.
>
> Thanks,
> Namhyung

Something else is wrong then. I tested that command (saw your patch in 
the history) and it worked for me. Also, this code path does not affect 
perf-stat -- it touches perf-record and perf-test only.

David

  reply	other threads:[~2012-05-14 13:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14  4:01 [PATCH] perf-record: Create events initially disabled -- again David Ahern
2012-05-14  7:40 ` Namhyung Kim
2012-05-14 13:09   ` David Ahern [this message]
2012-05-14 14:21     ` David Ahern
2012-05-14 14:54       ` Arnaldo Carvalho de Melo
2012-05-15  1:52         ` David Ahern
2012-05-15  3:28           ` David Ahern
2012-05-15  3:46             ` Arnaldo Carvalho de Melo
2012-05-15  4:28             ` Namhyung Kim
2012-05-15  1:07     ` Namhyung Kim
2012-05-15  1:42       ` David Ahern
2012-05-15  1:46         ` Arnaldo Carvalho de Melo
2012-05-15  1:54           ` Namhyung Kim
2012-05-15  1:54           ` David Ahern
2012-05-15  3:22           ` Lucas Meneghel Rodrigues
2012-05-14 13:48 ` Arnaldo Carvalho de Melo
2012-05-21  7:41 ` [tip:perf/core] perf evsel: " tip-bot for David Ahern

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=4FB1041C.1050903@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung.kim@lge.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox