From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 5/6] trace-cmd library man pages: Manage trace session with multiple trace peers.
Date: Fri, 15 Jan 2021 07:02:17 +0200 [thread overview]
Message-ID: <CAPpZLN5excLsRcmcgDMbEGV0LJGFBHRXrVXrFG6YtSgVxLxhzg@mail.gmail.com> (raw)
In-Reply-To: <20210113171347.1e75f7a6@gandalf.local.home>
On Thu, Jan 14, 2021 at 12:13 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
>
> I'm assuming that you can pair multiple guests with a single host?
Yes, this use case is tested using KernelShark. I'll extend the
example in the man page.
>
> 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);
> > +
> > +--
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
next prev parent reply other threads:[~2021-01-15 5:03 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
2021-01-15 5:02 ` Tzvetomir Stoyanov [this message]
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=CAPpZLN5excLsRcmcgDMbEGV0LJGFBHRXrVXrFG6YtSgVxLxhzg@mail.gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).