mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Jihong <yangjihong1@huawei.com>
To: Adrian Hunter <adrian.hunter@intel.com>, <peterz@infradead.org>,
	<mingo@redhat.com>, <acme@kernel.org>, <mark.rutland@arm.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>,
	<namhyung@kernel.org>, <irogers@google.com>,
	<kan.liang@linux.intel.com>, <linux-kernel@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>
Subject: Re: [PATCH 2/5] perf evlist: Add evlist__findnew_tracking_event() helper
Date: Wed, 12 Jul 2023 22:32:33 +0800	[thread overview]
Message-ID: <e77cf128-b8d2-9866-a80f-23ec46e2245b@huawei.com> (raw)
In-Reply-To: <5882e592-641f-71cc-7a91-66f66b58d5a6@intel.com>

Hello,

On 2023/7/11 21:13, Adrian Hunter wrote:
> On 4/07/23 10:42, Yang Jihong wrote:
>> Currently, intel-bts, intel-pt, and arm-spe may add a dummy event for
>> tracking to the evlist. We may need to search for the dummy event for
>> some settings. Therefore, add evlist__findnew_tracking_event() helper.
>>
>> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
>> ---
>>   tools/perf/builtin-record.c | 11 +++--------
>>   tools/perf/util/evlist.c    | 17 +++++++++++++++++
>>   tools/perf/util/evlist.h    |  1 +
>>   3 files changed, 21 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
>> index aec18db7ff23..8872cd037f2c 100644
>> --- a/tools/perf/builtin-record.c
>> +++ b/tools/perf/builtin-record.c
>> @@ -1295,14 +1295,9 @@ static int record__open(struct record *rec)
>>   	 */
>>   	if (opts->target.initial_delay || target__has_cpu(&opts->target) ||
>>   	    perf_pmus__num_core_pmus() > 1) {
>> -		pos = evlist__get_tracking_event(evlist);
>> -		if (!evsel__is_dummy_event(pos)) {
>> -			/* Set up dummy event. */
>> -			if (evlist__add_dummy(evlist))
>> -				return -ENOMEM;
>> -			pos = evlist__last(evlist);
>> -			evlist__set_tracking_event(evlist, pos);
>> -		}
>> +		pos = evlist__findnew_tracking_event(evlist);
>> +		if (!pos)
>> +			return -ENOMEM;
>>   
>>   		/*
>>   		 * Enable the dummy event when the process is forked for
>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>> index 7ef43f72098e..4621ddaeb8f3 100644
>> --- a/tools/perf/util/evlist.c
>> +++ b/tools/perf/util/evlist.c
>> @@ -1694,6 +1694,23 @@ void evlist__set_tracking_event(struct evlist *evlist, struct evsel *tracking_ev
>>   	tracking_evsel->tracking = true;
>>   }
>>   
>> +struct evsel *evlist__findnew_tracking_event(struct evlist *evlist)
>> +{
>> +	struct evsel *evsel;
>> +
>> +	evsel = evlist__get_tracking_event(evlist);
>> +	if (!evsel__is_dummy_event(evsel)) {
>> +		/* Set up dummy event. */
>> +		if (evlist__add_dummy(evlist))
> 
> evlist__add_dummy() does not exclude_kernel so it
> will end up relying on evsel__fallback() to work in
> cases where the user does not have kernel access.
> 
> evlist__add_aux_dummy() is probably better suited.
> Consequently perhaps pass system_wide as
> a parameter to evlist__findnew_tracking_event() and
> deal with that all inside evlist__findnew_tracking_event()
> 
OK. These two points will be modified in the next version.

Thanks,
Yang

  reply	other threads:[~2023-07-12 14:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04  7:42 [PATCH 0/5] perf record: Tracking side-band events for all CPUs when tracing selected CPUs Yang Jihong
2023-07-04  7:42 ` [PATCH 1/5] perf evlist: Export perf_evlist__propagate_maps() Yang Jihong
2023-07-11 13:12   ` Adrian Hunter
2023-07-12 14:30     ` Yang Jihong
2023-07-12 15:01       ` Adrian Hunter
2023-07-04  7:42 ` [PATCH 2/5] perf evlist: Add evlist__findnew_tracking_event() helper Yang Jihong
2023-07-11 13:13   ` Adrian Hunter
2023-07-12 14:32     ` Yang Jihong [this message]
2023-07-04  7:42 ` [PATCH 3/5] perf record: Tracking side-band events for all CPUs when tracing selected CPUs Yang Jihong
2023-07-05 21:09   ` Namhyung Kim
2023-07-06  1:39     ` Yang Jihong
2023-07-11 13:13   ` Adrian Hunter
2023-07-12 14:44     ` Yang Jihong
2023-07-12 15:03       ` Adrian Hunter
2023-07-04  7:42 ` [PATCH 4/5] perf test: Add test case for record tracking Yang Jihong
2023-07-12 20:48   ` Ian Rogers
2023-07-13  6:59     ` Yang Jihong
2023-07-04  7:42 ` [PATCH 5/5] perf record: All config tracking are integrated into record__config_tracking_events() Yang Jihong

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=e77cf128-b8d2-9866-a80f-23ec46e2245b@huawei.com \
    --to=yangjihong1@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®