public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Hrishikesh Suresh <hrishikesh123s@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Chun-Tse Shao <ctshao@google.com>,
	Blake Jones <blakejones@google.com>,
	Dmitry Vyukov <dvyukov@google.com>, Leo Yan <leo.yan@arm.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf session: print all machines in session dump
Date: Mon, 26 Jan 2026 18:17:21 -0300	[thread overview]
Message-ID: <aXfZ4dIUKJVMG93Q@x1> (raw)
In-Reply-To: <20260125200759.57816-1-hrishikesh123s@gmail.com>

On Sun, Jan 25, 2026 at 09:06:52PM +0100, Hrishikesh Suresh wrote:
> +++ b/tools/perf/util/session.c
> @@ -2674,11 +2674,15 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
>  
>  size_t perf_session__fprintf(struct perf_session *session, FILE *fp)
>  {
> -	/*
> -	 * FIXME: Here we have to actually print all the machines in this
> -	 * session, not just the host...
> -	 */
> -	return machine__fprintf(&session->machines.host, fp);
> +	struct rb_node *nd;
> +	struct machine *pos;
> +	size_t ret = machine__fprintf(&session->machines.host, fp);
> +
> +	for (nd = rb_first_cached(&session->machines.guests); nd; nd = rb_next(nd)) {
> +		pos = rb_entry(nd, struct machine, rb_node);
> +		ret += machine__fprintf(pos, fp);
> +	}
> +	return ret;
>  }
>  
>  void perf_session__dump_kmaps(struct perf_session *session)

Simple enough, applying after the further simplifications below, to make
it more compact.

Thanks!

- Arnaldo

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index dcbe10d6a996970d..ae62d5c9889fe2f3 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2730,12 +2730,11 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
 
 size_t perf_session__fprintf(struct perf_session *session, FILE *fp)
 {
-	struct rb_node *nd;
-	struct machine *pos;
 	size_t ret = machine__fprintf(&session->machines.host, fp);
 
-	for (nd = rb_first_cached(&session->machines.guests); nd; nd = rb_next(nd)) {
-		pos = rb_entry(nd, struct machine, rb_node);
+	for (struct rb_node *nd = rb_first_cached(&session->machines.guests); nd; nd = rb_next(nd)) {
+		struct machine *pos = rb_entry(nd, struct machine, rb_node);
+
 		ret += machine__fprintf(pos, fp);
 	}
 	return ret;

      reply	other threads:[~2026-01-26 21:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 20:06 [PATCH] perf session: print all machines in session dump Hrishikesh Suresh
2026-01-26 21:17 ` Arnaldo Carvalho de Melo [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=aXfZ4dIUKJVMG93Q@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=blakejones@google.com \
    --cc=ctshao@google.com \
    --cc=dvyukov@google.com \
    --cc=hrishikesh123s@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.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