Linux Perf Users
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Howard Chu <howardchu95@gmail.com>,
	Dominique Martinet <asmadeus@codewreck.org>,
	Levi Yun <yeoreum.yun@arm.com>,
	"Dr. David Alan Gilbert" <linux@treblig.org>,
	Andi Kleen <ak@linux.intel.com>,
	James Clark <james.clark@linaro.org>,
	Weilin Wang <weilin.wang@intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/5] perf parse-events: Add debug dump of evlist if reordered
Date: Wed, 2 Apr 2025 14:28:37 -0400	[thread overview]
Message-ID: <07fec072-9e2a-4de1-b31b-66dd3a5af6e8@linux.intel.com> (raw)
In-Reply-To: <CAP-5=fXhpx7O-BRLaaCpiXaG+vdcD+s8jpBJwzk3qptFRXsZEg@mail.gmail.com>



On 2025-04-02 2:15 p.m., Ian Rogers wrote:
> On Wed, Apr 2, 2025 at 10:52 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
>>
>>
>>
>> On 2025-04-02 12:47 p.m., Ian Rogers wrote:
>>> Add debug verbose output to show how evsels were reordered by
>>> parse_events__sort_events_and_fix_groups. For example:
>>> ```
>>> $ perf record -v -e '{instructions,cycles}' true
>>> Using CPUID GenuineIntel-6-B7-1
>>> WARNING: events were regrouped to match PMUs
>>> evlist after sorting/fixing: '{cpu_atom/instructions/,cpu_atom/cycles/},{cpu_core/instructions/,cpu_core/cycles/}'
>>> ```
>>>
>>> Signed-off-by: Ian Rogers <irogers@google.com>
>>> ---
>>>  tools/perf/util/parse-events.c | 16 +++++++++++++---
>>>  1 file changed, 13 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
>>> index 5152fd5a6ead..0f8fd5bee3a7 100644
>>> --- a/tools/perf/util/parse-events.c
>>> +++ b/tools/perf/util/parse-events.c
>>> @@ -28,6 +28,7 @@
>>>  #include "util/evsel_config.h"
>>>  #include "util/event.h"
>>>  #include "util/bpf-filter.h"
>>> +#include "util/stat.h"
>>>  #include "util/util.h"
>>>  #include "tracepoint.h"
>>>
>>> @@ -2196,14 +2197,23 @@ int __parse_events(struct evlist *evlist, const char *str, const char *pmu_filte
>>>       if (ret2 < 0)
>>>               return ret;
>>>
>>> -     if (ret2 && warn_if_reordered && !parse_state.wild_card_pmus)
>>> -             pr_warning("WARNING: events were regrouped to match PMUs\n");
>>> -
>>>       /*
>>>        * Add list to the evlist even with errors to allow callers to clean up.
>>>        */
>>>       evlist__splice_list_tail(evlist, &parse_state.list);
>>>
>>> +     if (ret2 && warn_if_reordered && !parse_state.wild_card_pmus) {
>>> +             pr_warning("WARNING: events were regrouped to match PMUs\n");
>>> +
>>> +             if (verbose > 0) {
>>> +                     struct strbuf sb = STRBUF_INIT;
>>> +
>>> +                     evlist__uniquify_name(evlist);
>>> +                     evlist__format_evsels(evlist, &sb, 1024);
>>
>> Why is the size even less than the one in pr_err?
>>
>> The user probably prefer to get the complete list in the debug.
> 
> I thought the previous 2048 excessive but kept it for the previous
> case to not change anything. If you are happier with 2048 here I don't
> particularly mind, it is a lot to display in verbose output.

Yes, I think the verbose output wouldn't bother the normal user. We only
use it when there is a problem. So detailed information should be
preferred.

Thanks,
Kan>
> Thanks,
> Ian
> 
>> Thanks,
>> Kan> +                  pr_debug("evlist after sorting/fixing: '%s'\n", sb.buf);
>>> +                     strbuf_release(&sb);
>>> +             }
>>> +     }
>>>       if (!ret) {
>>>               struct evsel *last;
>>>
>>
> 


      reply	other threads:[~2025-04-02 18:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02 16:47 [PATCH v2 0/5] NMI warning and debug improvements Ian Rogers
2025-04-02 16:47 ` [PATCH v2 1/5] perf stat: Better hybrid support for the NMI watchdog warning Ian Rogers
2025-04-02 16:47 ` [PATCH v2 2/5] perf stat: Remove print_mixed_hw_group_error Ian Rogers
2025-04-02 16:47 ` [PATCH v2 3/5] perf evlist: Refactor evlist__scnprintf_evsels Ian Rogers
2025-04-02 16:47 ` [PATCH v2 4/5] perf evlist: Add groups to evlist__format_evsels Ian Rogers
2025-04-02 16:47 ` [PATCH v2 5/5] perf parse-events: Add debug dump of evlist if reordered Ian Rogers
2025-04-02 17:52   ` Liang, Kan
2025-04-02 18:15     ` Ian Rogers
2025-04-02 18:28       ` Liang, Kan [this message]

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=07fec072-9e2a-4de1-b31b-66dd3a5af6e8@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=asmadeus@codewreck.org \
    --cc=howardchu95@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=weilin.wang@intel.com \
    --cc=yeoreum.yun@arm.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