lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Philippe Proulx via lttng-dev <lttng-dev@lists.lttng.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Philippe Proulx <pproulx@efficios.com>,
	Jeremie Galarneau <jgalar@efficios.com>,
	 rostedt <rostedt@goodmis.org>,
	lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: [lttng-dev] Usage example of libbabeltrace (babeltrace2) to read CTF traces from a GUI
Date: Tue, 15 Jun 2021 11:13:41 -0400	[thread overview]
Message-ID: <CAB4xu_1H-4gdandyRx+F0nb1g+sLKatx=oJdzQspM+3hJXoYhA@mail.gmail.com> (raw)
In-Reply-To: <1119833442.5505.1623700847146.JavaMail.zimbra@efficios.com>

On Mon, Jun 14, 2021 at 4:01 PM Mathieu Desnoyers via lttng-dev
<lttng-dev@lists.lttng.org> wrote:
>
> Hi Philippe, Hi Jeremie,
>
> Steven is interested to use libbabeltrace as a CTF trace reader in the KernelShark
> project. It's a GUI which shows Linux kernel traces.
>
> He notices that most of the documented usage examples of the libbabeltrace API
> focus on use-cases where a custom trace format is converted into CTF.
>
> I know that the babeltrace2 program is the main user of libbabeltrace at this
> point, and that it reads CTF as source.
>
> For using libbabeltrace as CTF reader for a GUI, what would be the best examples
> to look at as starting point ? Perhaps the babeltrace2 binary, or just adapt a
> smaller example program and change the custom trace format source to "ctf.fs" ?
> Or anything else ?

Hello,

Unfortunately, the Babeltrace 2 C API documentation [1] doesn't offer a
graph building example at the moment.

Therefore, indeed, the "best" example would be the babeltrace2(1) CLI
(see `src/cli`), although I understand that it's a very generic example
which can be overwhelming to explore.

However, note that instead of instantiating an existing sink component
class (as found in a plugin), you'll want to make your own sink
component class to get access to each event message while also
controlling the graph operations. Using
bt_graph_add_simple_sink_component() [2] would be a good start.

I can cook a minimal working example in the following days.

Phil

[1]: https://babeltrace.org/docs/v2.0/libbabeltrace2/
[2]: https://babeltrace.org/docs/v2.0/libbabeltrace2/group__api-graph.html#gaa8432f03a967d01b764fb1bc959c8e89

>
> Thanks,
>
> Mathieu
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

  reply	other threads:[~2021-06-15 15:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 20:00 [lttng-dev] Usage example of libbabeltrace (babeltrace2) to read CTF traces from a GUI Mathieu Desnoyers via lttng-dev
2021-06-15 15:13 ` Philippe Proulx via lttng-dev [this message]
2021-06-15 15:57   ` Steven Rostedt via lttng-dev
2021-06-19  3:42     ` Philippe Proulx via lttng-dev

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='CAB4xu_1H-4gdandyRx+F0nb1g+sLKatx=oJdzQspM+3hJXoYhA@mail.gmail.com' \
    --to=lttng-dev@lists.lttng.org \
    --cc=jgalar@efficios.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=pproulx@efficios.com \
    --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).