From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: "Jin, Yao" <yao.jin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
jolsa@kernel.org, Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH] perf util: Use target->per_thread and target->system_wide flags
Date: Mon, 22 Jan 2018 16:55:22 -0700 [thread overview]
Message-ID: <CANLsYkxJpXDPUVssR2pQPVmwwV8iDfKPK+9psLzVgL8nvVvZ0g@mail.gmail.com> (raw)
In-Reply-To: <06929c28-6431-29f2-340e-6dbc2302c78b@linux.intel.com>
On 22 January 2018 at 16:02, Jin, Yao <yao.jin@linux.intel.com> wrote:
>
>
> On 1/23/2018 5:10 AM, Mathieu Poirier wrote:
>>
>> On 22 January 2018 at 15:15, Jin Yao <yao.jin@linux.intel.com> wrote:
>>>
>>> Mathieu Poirier reports issue in commit ("73c0ca1eee3d perf thread_map:
>>> Enumerate all threads from /proc") that it has negative impact on
>>> 'perf record --per-thread'. It has the effect of creating a kernel event
>>> for each thread in the system for 'perf record --per-thread'.
>>>
>>> Mathieu Poirier's patch ("perf util: Do not reuse target->per_thread
>>> flag")
>>> can fix this issue by creating a new target->all_threads flag.
>>>
>>> This patch is based on Mathieu Poirier's patch but it doesn't use a new
>>> target->all_threads flag. This patch just uses 'target->per_thread &&
>>> target->system_wide' as a condition to check for all threads case.
>>>
>>> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
>>> ---
>>> tools/perf/util/evlist.c | 2 +-
>>> tools/perf/util/thread_map.c | 4 ++--
>>> tools/perf/util/thread_map.h | 2 +-
>>> 3 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>>> index 120efd8..9dff74a 100644
>>> --- a/tools/perf/util/evlist.c
>>> +++ b/tools/perf/util/evlist.c
>>> @@ -1106,7 +1106,7 @@ int perf_evlist__create_maps(struct perf_evlist
>>> *evlist, struct target *target)
>>> struct thread_map *threads;
>>>
>>> threads = thread_map__new_str(target->pid, target->tid,
>>> target->uid,
>>> - target->per_thread);
>>> + target->per_thread &&
>>> target->system_wide);
>>
>>
>> At first glance I thought your solution would do the trick but perf
>> record does use target->system_wide when the '-a' switch is used.
>> Moreover specifying the '-a' switch doesn't prevent the '--per-thread'
>> option from being used as well, making both target->perf_thread and
>> target_system_wide equal to true (and that is not good).
>>
>> Although not a fan of adding more to struct target, the advantage of
>> having target->all_threads is that we are guaranteed that it isn't
>> used anywhere else.
>>
>> Let me know what you think,
>> Mathieu
>>
>
> If we specify both '-a' and '--per-thread' to perf record, perf record will
> override'--per-thread'. So now target->per_thread = false, and
> target->system_wide = true.
Just spent time looking at it further and target__validate() will make
sure per thread and cpu wide options are mutually exclusive. I like
your approach better so let's go with that.
Thanks,
Mathieu
>
> If we specify '--per-thread' only to perf record, target->per_thread = true,
> and target->system_wide = false.
>
> So whatever for any case, target->per_thread && target->system_wide is
> false.
>
> Since the parameter is false, in thread_map__new_str(), it will not execute
> the thread_map__new_all_cpus(). So that will not change perf record previous
> behavior.
>
> In perf stat, it allows the case that target->per_thread and
> target->system_wide are all true. That means we want to collect system-wide
> per-thread metrics.
>
> That's my current thinking.
>
> Thanks
> Jin Yao
next prev parent reply other threads:[~2018-01-22 23:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 22:15 [PATCH] perf util: Use target->per_thread and target->system_wide flags Jin Yao
2018-01-22 21:10 ` Mathieu Poirier
2018-01-22 23:02 ` Jin, Yao
2018-01-22 23:55 ` Mathieu Poirier [this message]
2018-01-23 14:40 ` Jiri Olsa
2018-01-24 0:12 ` Jin, Yao
2018-01-22 23:56 ` Mathieu Poirier
2018-01-23 1:08 ` Jin, Yao
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=CANLsYkxJpXDPUVssR2pQPVmwwV8iDfKPK+9psLzVgL8nvVvZ0g@mail.gmail.com \
--to=mathieu.poirier@linaro.org \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
--cc=yao.jin@linux.intel.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;
as well as URLs for NNTP newsgroup(s).