linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 5/6] trace-cmd library man pages: Manage trace session with multiple trace peers.
Date: Wed, 13 Jan 2021 17:13:47 -0500	[thread overview]
Message-ID: <20210113171347.1e75f7a6@gandalf.local.home> (raw)
In-Reply-To: <20201223043429.586162-6-tz.stoyanov@gmail.com>


I'm assuming that you can pair multiple guests with a single host?

That is, can we have:


	bool g1 = false, g2 = false;

	host = tracecmd_open_head("trace.dat");
	tracecmd_init_data(host);
	guest1 = tracecmd_open_head("trace-Guest-1.dat");
	guest2 = tracecmd_open_head("trace-Guest-2.dat");

	guest_id_1 = tracecmd_get_traceid(guest1);
	guest_id_2 = tracecmd_get_traceid(guest1);

	if (!tracecmd_get_guest_cpumap(host, guest_id_1, &name1, &vcount1, &cpu_pids1)
		g1 = !tracecmd_init_data(guest1);

	if (!tracecmd_get_guest_cpumap(host, guest_id_2, &name2, &vcount2, &cpu_pids2)
		g2 = !tracecmd_init_data(guest2);

	if (g1) {
		int i;
		for (i = 0; i < vcount1; i++) {
			printf("Host task id %d maps to guest %s cpu %d\n",
				cpu_pids1[i], name1, i);
		}
		tracecmd_unpair_peer(guest1);
	}

	if (g2) {
		int i;
		for (i = 0; i < vcount2; i++) {
			printf("Host task id %d maps to guest %s cpu %d\n",
				cpu_pids2[i], name2, i);
		}
		tracecmd_unpair_peer(guest2);
	}

And use something like the above for the example?

-- Steve


On Wed, 23 Dec 2020 06:34:28 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> +EXAMPLE
> +-------
> +[source,c]
> +--
> +#include <trace-cmd.h>
> +...
> +struct tracecmd_input *host = tracecmd_open_head("trace.dat");
> +	if (!host) {
> +		/* Failed to open host trace file */
> +	}
> +	tracecmd_init_data(host);
> +
> +struct tracecmd_input *guest = tracecmd_open_head("trace-Guest.dat");
> +	if (!guest) {
> +		/* Failed to open guest trace file */
> +	}
> +
> +unsigned long long guest_id = tracecmd_get_traceid(guest);
> +int *cpu_pid;
> +char *name;
> +int vcount;
> +
> +	if (!tracecmd_get_guest_cpumap(host, guest_id, &name, &vcount, &cpu_pid)) {
> +		/* The Host and a guest with name was part of the same trace session.
> +		 * Got guest VCPU to host PID mapping.
> +		 */
> +		if (!tracecmd_pair_peer(guest, host)) {
> +			/* Successfully paired host to the guest handler */
> +			tracecmd_init_data(guest);
> +			...
> +			tracecmd_unpair_peer(guest);
> +		}
> +	}
> +
> +...
> +	tracecmd_close(guest);
> +	tracecmd_close(hadle);
> +
> +--

  reply	other threads:[~2021-01-14  2:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  4:34 [PATCH 0/6] libtracecmd man pages Tzvetomir Stoyanov (VMware)
2020-12-23  4:34 ` [PATCH 1/6] trace-cmd: " Tzvetomir Stoyanov (VMware)
2020-12-23  4:34 ` [PATCH 2/6] trace-cmd: Update the RESOURCES section of the trace-cmd " Tzvetomir Stoyanov (VMware)
2020-12-23  4:34 ` [PATCH 3/6] trace-cmd library man pages: Read recorded events from a trace file Tzvetomir Stoyanov (VMware)
2021-01-13 22:18   ` Steven Rostedt
2020-12-23  4:34 ` [PATCH 4/6] trace-cmd library man pages: Open and close " Tzvetomir Stoyanov (VMware)
2020-12-23  4:34 ` [PATCH 5/6] trace-cmd library man pages: Manage trace session with multiple trace peers Tzvetomir Stoyanov (VMware)
2021-01-13 22:13   ` Steven Rostedt [this message]
2021-01-15  5:02     ` Tzvetomir Stoyanov
2020-12-23  4:34 ` [PATCH 6/6] trace-cmd library man pages: Read tracing instances from a trace file Tzvetomir Stoyanov (VMware)

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=20210113171347.1e75f7a6@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.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;
as well as URLs for NNTP newsgroup(s).