public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: acme@kernel.org, irogers@google.com, peterz@infradead.org,
	mingo@kernel.org, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf report: Support --total-cycles --group in the tui mode
Date: Fri, 16 Aug 2024 15:34:41 -0400	[thread overview]
Message-ID: <1b0464bf-0258-44d3-adca-4346a9fdfd31@linux.intel.com> (raw)
In-Reply-To: <CAM9d7ciPg_1DJ+gJxqU2O0nwX_L9-2+K+NkObq64e12_6vDA_g@mail.gmail.com>



On 2024-08-15 6:44 p.m., Namhyung Kim wrote:
> Hi Kan,
> 
> On Wed, Aug 14, 2024 at 7:19 AM <kan.liang@linux.intel.com> wrote:
>>
>> From: Kan Liang <kan.liang@linux.intel.com>
>>
>> With the --total-cycles, the --group is only supported in the stdio
>> mode, but not supported in the tui mode. The output is inconsistent
>> with different modes.
>>
>> if symbol_conf.event_group is applied, always output the event group
>> information together in tui mode as well.
>>
>> $perf record -e "{cycles,instructions}",cache-misses -b sleep 1
>> $perf report --total-cycles --group --tui
>>
>> Before the patch,
>>
>> Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                         [Pro
>>           6.45%            2.0K        0.57%         667    [dl-cacheinfo.h:164 -> dl
>>           5.62%            1.7K        0.74%         871            [dl-cache.c:230 -
>>           5.21%            1.6K        1.37%        1.6K          [setup-vdso.h:37 ->
>>           4.92%            1.5K        0.09%         109            [dl-cache.c:367 -
>>
>> Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                         [Pro
>>           5.62%            1.7K        2.76%         871            [dl-cache.c:230 -
>>           4.92%            1.5K        0.35%         109            [dl-cache.c:367 -
>>           1.12%             346        0.55%         173
>>           0.87%             270        0.43%         135                    [rtld.c:5
>>           0.64%             197        0.03%           8      [dl-tunables.c:305 -> d
>>           0.60%             185        0.01%           3      [dl-tunables.c:305 -> d
>>
>> Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                         [Pro
>>           5.90%            1.8K        1.28%        1.8K                  [strtod.c:8
>>           5.70%            1.8K        1.24%        1.8K            [strtod_l.c:681 -
>>           5.68%            1.8K        1.24%        1.8K            [strtod_l.c:508 -
>>           5.48%            1.7K        1.19%        1.7K          [strtod_l.c:1175 ->
>>           5.21%            1.6K        1.13%        1.6K          [setup-vdso.h:37 ->
>>
>> With the patch,
>>
>> Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                         [Pro
>>           6.45%            2.0K        0.57%         667    [dl-cacheinfo.h:164 -> dl
>>           5.62%            1.7K        0.74%         871            [dl-cache.c:230 -
>>           5.21%            1.6K        1.37%        1.6K          [setup-vdso.h:37 ->
>>           4.92%            1.5K        0.09%         109            [dl-cache.c:367 -
> 
> Hmm.. it seems the output just removed the second one.
> I guess it should combine the first and second output somehow.
>

The patch is just to make the behavior/output the same between --stdio
and the tui mode for --group. I didn't change the algorithm of
calculating the cycles.

Yes, it looks suspicious. I will take a deep look and see how the group
information are processed.

Thanks,
Kan

> Thanks,
> Namhyung
> 
>>
>> Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                         [Pro
>>           5.90%            1.8K        1.28%        1.8K                  [strtod.c:8
>>           5.70%            1.8K        1.24%        1.8K            [strtod_l.c:681 -
>>           5.68%            1.8K        1.24%        1.8K            [strtod_l.c:508 -
>>           5.48%            1.7K        1.19%        1.7K          [strtod_l.c:1175 ->
>>           5.21%            1.6K        1.13%        1.6K          [setup-vdso.h:37 ->
>>
>> Fixes: 7fa46cbf20d3 ("perf report: Sort by sampled cycles percent per block for tui")
>> Closes: https://lore.kernel.org/lkml/ZrupfUSZwem-hCZm@x1/
>> Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
>> ---
>>  tools/perf/builtin-report.c    |  6 +++++-
>>  tools/perf/ui/browsers/hists.c | 12 ++++++++++--
>>  2 files changed, 15 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
>> index 1643113616f4..574342fb7269 100644
>> --- a/tools/perf/builtin-report.c
>> +++ b/tools/perf/builtin-report.c
>> @@ -541,7 +541,11 @@ static int evlist__tui_block_hists_browse(struct evlist *evlist, struct report *
>>         int i = 0, ret;
>>
>>         evlist__for_each_entry(evlist, pos) {
>> -               ret = report__browse_block_hists(&rep->block_reports[i++].hist,
>> +               i++;
>> +               if (symbol_conf.event_group && !evsel__is_group_leader(pos))
>> +                       continue;
>> +
>> +               ret = report__browse_block_hists(&rep->block_reports[i - 1].hist,
>>                                                  rep->min_percent, pos,
>>                                                  &rep->session->header.env);
>>                 if (ret != 0)
>> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
>> index 49ba82bf3391..22af1a6e29d6 100644
>> --- a/tools/perf/ui/browsers/hists.c
>> +++ b/tools/perf/ui/browsers/hists.c
>> @@ -3665,11 +3665,19 @@ single_entry: {
>>  static int block_hists_browser__title(struct hist_browser *browser, char *bf,
>>                                       size_t size)
>>  {
>> -       struct hists *hists = evsel__hists(browser->block_evsel);
>> -       const char *evname = evsel__name(browser->block_evsel);
>> +       struct evsel *evsel = browser->block_evsel;
>> +       struct hists *hists = evsel__hists(evsel);
>>         unsigned long nr_samples = hists->stats.nr_samples;
>> +       const char *evname;
>> +       char buf[512];
>>         int ret;
>>
>> +       if (evsel__is_group_event(evsel)) {
>> +               evsel__group_desc(evsel, buf, sizeof(buf));
>> +               evname = buf;
>> +       } else
>> +               evname = evsel__name(evsel);
>> +
>>         ret = scnprintf(bf, size, "# Samples: %lu", nr_samples);
>>         if (evname)
>>                 scnprintf(bf + ret, size -  ret, " of event '%s'", evname);
>> --
>> 2.38.1
>>
> 

      reply	other threads:[~2024-08-16 19:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 14:19 [PATCH] perf report: Support --total-cycles --group in the tui mode kan.liang
2024-08-15 22:44 ` Namhyung Kim
2024-08-16 19:34   ` 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=1b0464bf-0258-44d3-adca-4346a9fdfd31@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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