From: Philippe Proulx via lttng-dev <lttng-dev@lists.lttng.org>
To: lttng-dev <lttng-dev@lists.lttng.org>
Cc: vfialko@marvell.com
Subject: [lttng-dev] Access specific fields from metadata file
Date: Wed, 13 Dec 2023 15:42:11 -0500 [thread overview]
Message-ID: <CAB4xu_2nfjYArxyhvKB0_cHzRXoBLzcfAvJTXku5LfOdruQJdw@mail.gmail.com> (raw)
Replying to an email from Volodymyr Fialko which was mistakenly erased.
> Hello all,
>
> I'm trying to parse metadata file only, to get information about all
> possible trace points. I'm using "Inspect event classes" example:
> https://babeltrace.org/docs/v2.0/python/bt2/examples.html#inspect-event-classes
> It mainly does all what I need, but there still some fields, that I
> could not figure out how to access:
>
> 1. How to access event.header struct from stream?
> stream definition:
> stream {
> packet.context := struct {
> uint8_t core_id;
> };
> event.header := struct {
> uint8_t id;
> };
> };
>
> It's possible to access packet.context via
> stream_class.packet_context_field_class, but I dot not see similar
> property for event.header. (event_common_context_field_class -
> returns None)
You can't: headers, and some fields of the packet context, are specific
to CTF itself, therefore a `src.ctf.*` component uses them, but they
don't reach the downstream components. The libbabeltrace2 API itself
doesn't offer packet and event header access.
Why do you need them?
> 2. How to obtain string length?
> Event definition:
> typealias integer {size = 8; base = x;}:= uint8_t;
> typealias integer {size = 8; signed = false; encoding = ASCII; } := string_bounded_t;
> event {
> id = 0x00;
> name = "trace_point_1";
> fields := struct {
> uint8_t arr[32];
> string_bounded_t str[32];
> };
> };
> Fields are parsed into following Classes:
> arr: `bt2._StaticArrayFieldClassConst`: has length property
> str: `bt2._StringFieldClassConst`: no length property
> Is there some other way to get str length?
There's no way currently. A `src.ctf.*` component recognizes an array of
integer fields having an encoding as a string, and translates this to a
libbabeltrace2 string field (that's what the intention is after all).
Again, what would be the use case here?
Please note that the upcoming major revision of CTF, CTF 2, features a
JSON metadata stream, meaning you'll be able to get that information
much more easily than with the metadata DSL (TSDL) of CTF 1.8.
The latest specification RC is available here:
<https://diamon.org/ctf/files/>.
Babeltrace 2.1 and LTTng 2.15 will support CTF 2.
BR,
Philippe Proulx
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
reply other threads:[~2023-12-13 20:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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_2nfjYArxyhvKB0_cHzRXoBLzcfAvJTXku5LfOdruQJdw@mail.gmail.com \
--to=lttng-dev@lists.lttng.org \
--cc=eeppeliteloop@gmail.com \
--cc=vfialko@marvell.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 read-only IMAP folder(s) and NNTP newsgroup(s).