src.ctf.fs: use the new metadata stream parser and message iterator
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 30 May 2024 18:26:09 +0000 (14:26 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
commit9328f86be150d02d6c4a5f6de046cf7e4dfb8ca4
treec7218d8eb9ff565a48cdf8752fc4ae5a903072e3
parent3ca10a95a77cd126c7787831cb4ea8b90b09929a
src.ctf.fs: use the new metadata stream parser and message iterator

Update the src.ctf.fs component class to use:

  - the new metadata stream parser / IR generator (ctf::src::CtfIrGenerator)
  - the new message iterator (ctf::src::MsgIter)

The new IR generator produces a trace class instance using the new CTF
IR type, ctf::src::TraceCls.  This instance is then fed to the message
iterator.  These two changes must therefore be done in lock step.

Add ctf::src::fs::Medium, a Medium for use with ctf::src::ItemSeqIter
that reads trace data from the filesystem.  It receives an index, which
can be thought of as the "playlist" of packets that form the logical
data stream.  Its buf method needs to be able to find a packet given a
requested offset in that logical data stream.  Therefore, add a new
`offsetInStream` field in the ctf_fs_ds_index_entry structure, and the
`updateOffsetsInStream` method to compute them.  Rename
ctf_fs_ds_index_entry::offset to offsetInFile, for clarity.

Once the buf method selected the right index entry (packet), it maps
that portion of the file, and see if the returned buffer can include
some of the following packets in the file, while at it.

Other details about the changes in this patch, in no particular order:

 - Make a copy of ctf_trace_class_configure_ir_trace that works on a
   ctf::src::TraceCls instead of a struct ctf_trace_class.  The old one
   will be removed once src.ctf.lttng-live no longer uses it.

 - Remove ctf_fs_metadata, the required fields (the decoder / IR
   generator) are now directly in ctf_fs_trace.

 - The quirks to apply are saved in the ctf_fs_component object
   directly.  They were previously saved in the old IR object (struct
   ctf_trace_class), but they are not in the new IR object.  They now
   need to be passed to all instantiated message iterators.

 - Remove ctf_fs_msg_iter_data::ds_file_group, add
   ctf_fs_msg_iter_data::port_data.  This allows message iterators to
   access the ctf_fs_component and therefore the quirks.  They can still
   access the ds_file_group through the port_data.

 - Replace ctf_fs_msg_iter_data::msg_iter (the old message iterator)
   with ctf_fs_msg_iter_data::msgIter (the new message iterator).

 - Remove ctf_fs_msg_iter_data::msg_iter_medops_data, this is the data
   for the medium (medops) for the old message iterator.

 - Adjust ctf_fs_iterator_init, ctf_fs_iterator_next,
   ctf_fs_iterator_finalize to the new message iterator.

 - Adjust ctf_fs_iterator_seek_beginning to the new message iterator.
   The simplest way I found to reset the state to the beginning state is
   to delete the message iterator and instantiate a new one.

 - Update add_ds_file_to_ds_file_group to use readPktProps to read the
   stream class and id.

 - Change decode_clock_snapshot_after_event, used for working around
   known tracer bugs, to use an ItemSeqIter.  Define two item visitors,
   ClockSnapshotAfterFirstEventItemVisitor and
   ClockSnapshotAfterLastEventItemVisitor, for the two cases.

Change-Id: I8e3ce344c940da2106bdf8320c28724ca360b48a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8349
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12744
17 files changed:
src/Makefile.am
src/plugins/ctf/common/src/metadata/metadata-stream-parser-utils.cpp
src/plugins/ctf/common/src/metadata/tsdl/ast.hpp
src/plugins/ctf/common/src/metadata/tsdl/ctf-1-metadata-stream-parser.cpp
src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-configure-ir-trace.cpp
src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-configure-ir-trace.hpp
src/plugins/ctf/common/src/metadata/tsdl/decoder.cpp
src/plugins/ctf/common/src/metadata/tsdl/decoder.hpp
src/plugins/ctf/common/src/metadata/tsdl/visitor-generate-ir.cpp
src/plugins/ctf/fs-src/data-stream-file.cpp
src/plugins/ctf/fs-src/data-stream-file.hpp
src/plugins/ctf/fs-src/fs.cpp
src/plugins/ctf/fs-src/fs.hpp
src/plugins/ctf/fs-src/metadata.cpp [deleted file]
tests/plugins/src.ctf.fs/fail/test-fail.sh
tests/plugins/src.ctf.fs/test-deterministic-ordering.sh
tests/plugins/src.ctf.lttng-live/test-live.sh
This page took 0.026211 seconds and 4 git commands to generate.