From: zenan via lttng-dev <lttng-dev@lists.lttng.org>
To: "Philippe Proulx" <eeppeliteloop@gmail.com>, lttng-dev@lists.lttng.org
Subject: [lttng-dev] babeltrace2 python api related question
Date: Sun, 14 Aug 2022 16:48:04 +0800 (CST) [thread overview]
Message-ID: <73fc6c02.c6f.1829b89f09c.Coremail.dantefu9001@163.com> (raw)
In-Reply-To: <CAB4xu_0FsM2k+mxr+3SMrj1MySNO_O3atCjvipbFy9etxwObbA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2582 bytes --]
In command line, I use “babeltrace2 net://somehost/some-session” to read live lttng session trace, and I want to use python bindings to do the same, is it possible?
here is my code:
import bt2
import sys
# Create an empty graph.
graph = bt2.Graph()
# Add a `source.text.dmesg` component.
#
# graph.add_component() returns the created and added component.
#
# Such a component reads Linux kernel ring buffer messages (see
# `dmesg(1)`) from the standard input and creates corresponding event
# messages. See `babeltrace2-source.text.dmesg(7)`.
#
# `my source` is the unique name of this component within `graph`.
# the original source code here in the example is:
# comp_cls = bt2.find_plugin('text').source_component_classes['dmesg']
# src_comp = graph.add_component(comp_cls,'my source')
comp_cls = bt2.find_plugin('ctf').source_component_classes['lttng-live']
src_comp = graph.add_component(comp_cls, 'my source', params = {
'inputs': [sys.argv[1]],
})
# Add a `sink.text.pretty` component.
#
# Such a component pretty-prints event messages on the standard output
# (one message per line). See `babeltrace2-sink.text.pretty(7)`.
#
# The `babeltrace2 convert` CLI command uses a `sink.text.pretty`
# sink component by default.
comp_cls = bt2.find_plugin('text').sink_component_classes['pretty']
sink_comp = graph.add_component(comp_cls, 'my sink')
# Connect the `out` output port of the `source.text.dmesg` component
# to the `in` input port of the `sink.text.pretty` component.
graph.connect_ports(src_comp.output_ports['out'], sink_comp.input_ports['in'])
# Run the trace processing graph.
graph.run()
发件人: Philippe Proulx
发送时间: 2022年8月10日 22:08
收件人: zenan
抄送: lttng-dev@lists.lttng.org
主题: Re: [lttng-dev] babeltrace2 python api related question
On Wed, Aug 10, 2022 at 9:54 AM zenan via lttng-dev
<lttng-dev@lists.lttng.org> wrote:
>
>
>
> Hi there,
>
> I’m trying to use babeltrace2 python bindings to track live lttng trace, as shown in some examples in the documents, I tried to use ctf.lttng-live( ctf.fs in the documents) plugin as source, and use text.pretty as sink, but it didn’t work out as I expected. So does the api support tracking live lttng trace and print them out yet?
>
>
What did you try exactly?
I need command lines and/or some code (keep it minimal) to help you.
Philippe
>
>
>
> Yours sincerely
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.2: Type: text/html, Size: 8340 bytes --]
[-- Attachment #2: Type: text/plain, Size: 156 bytes --]
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
next prev parent reply other threads:[~2022-08-15 13:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-10 7:01 zenan via lttng-dev
2022-08-10 14:07 ` Philippe Proulx via lttng-dev
2022-08-14 8:48 ` zenan via lttng-dev [this message]
2022-08-15 20:29 ` Philippe Proulx via lttng-dev
2022-08-16 2:29 ` 蛋丁 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=73fc6c02.c6f.1829b89f09c.Coremail.dantefu9001@163.com \
--to=lttng-dev@lists.lttng.org \
--cc=dantefu9001@163.com \
--cc=eeppeliteloop@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