public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Howard Chu <howardchu95@gmail.com>
Subject: Re: [PATCH v2 1/4] perf trace: Allocate syscall stats only if summary is on
Date: Tue, 4 Feb 2025 11:21:22 -0800	[thread overview]
Message-ID: <Z6JosmbJBmiRHBKK@google.com> (raw)
In-Reply-To: <CAP-5=fVrFzxcLZG8DyYh2rbd3u4133V6hhrQFCHsq_QMVVW=9g@mail.gmail.com>

On Tue, Feb 04, 2025 at 07:59:01AM -0800, Ian Rogers wrote:
> On Mon, Feb 3, 2025 at 6:59 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Sat, Feb 01, 2025 at 10:57:00PM -0800, Ian Rogers wrote:
> > > On Wed, Jan 29, 2025 at 7:05 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > >
> > > > The syscall stats are used only when summary is requested.  Let's avoid
> > > > unnecessary operations.  Pass 'trace' pointer to check summary and give
> > > > output file together.
> > >
> > > I don't think this last sentence makes sense.
> >
> > Thanks for your review.  I'd say:  Pass 'trace' pointer instead of doing
> > 'summary' option and 'output' file pointer separately.
> 
> This still doesn't make sense. There is lazier initialization:
> ```
> -               ttrace->syscall_stats = intlist__new(NULL);
> +               if (trace->summary)
> +                       ttrace->syscall_stats = intlist__new(NULL);
> ```
> and there are functions that take a FILE* but now we're going to use
> the one in trace instead:

Yep, those FILE* (fp) was from trace->output.


> ```
> @@ -1568,7 +1569,7 @@ static struct thread_trace *thread__trace(struct
> thread *thread, FILE *fp)
> 
>         return ttrace;
>  fail:
> -       color_fprintf(fp, PERF_COLOR_RED,
> +       color_fprintf(trace->output, PERF_COLOR_RED,
>                       "WARNING: not enough memory, dropping samples!\n");
>         return NULL;
> ```
> So why does the one passed to trace still exist? Unfortunately names
> like "fp" and "output" are not intention revealing.

I think "fp" is a conventional name for file pointers (probably from
K&R?).

> 
> Anyway, from the commit message and the code I don't understand what
> this change is trying to do.

I don't know where you didn't get it.  Apparently my English is not good
enough.  So this commit does two things.

1. check trace->summary before allocating syscall_stats
2. change signature of thread__trace from (thread, fp) to (thread,
   trace) so that it can use trace->output (fp) and trace->summary.

I thought the change #2 is trivial enough to be in the same commit.  But
I can split that if you want.

Thanks,
Namhyung


  reply	other threads:[~2025-02-04 19:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30  3:05 [PATCH v2 0/4] perf trace: Add --summary-mode option Namhyung Kim
2025-01-30  3:05 ` [PATCH v2 1/4] perf trace: Allocate syscall stats only if summary is on Namhyung Kim
2025-02-02  6:57   ` Ian Rogers
2025-02-04  2:59     ` Namhyung Kim
2025-02-04 15:59       ` Ian Rogers
2025-02-04 19:21         ` Namhyung Kim [this message]
2025-02-04 19:30           ` Ian Rogers
2025-02-08  5:25           ` Howard Chu
2025-01-30  3:05 ` [PATCH v2 2/4] perf trace: Convert syscall_stats to hashmap Namhyung Kim
2025-02-02  7:03   ` Ian Rogers
2025-02-04  3:13     ` Namhyung Kim
2025-02-04  4:28       ` Ian Rogers
2025-02-04 19:30         ` Namhyung Kim
2025-01-30  3:05 ` [PATCH v2 3/4] perf tools: Get rid of now-unused rb_resort.h Namhyung Kim
2025-01-30  3:05 ` [PATCH v2 4/4] perf trace: Add --summary-mode option Namhyung Kim
2025-01-31 20:41 ` [PATCH v2 0/4] " Howard Chu

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=Z6JosmbJBmiRHBKK@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=howardchu95@gmail.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=mingo@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