src.ctf.fs: use the new metadata stream parser and message iterator
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 15:29:53 +0000 (11:29 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
commit75b1d74428c7f54d8850cafc2590aa3621dc6ebc
tree12a307c21e023df73de7653ada59e9854b90bfa1
parent879d875729f0d6d85bfcc7e1b4e138496fd802a6
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>
32 files changed:
src/plugins/ctf/common/metadata/ctf-ir.hpp
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/Makefile.am
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]
src/plugins/ctf/fs-src/metadata.hpp [deleted file]
src/plugins/ctf/fs-src/query.cpp
tests/data/plugins/flt.lttng-utils.debug-info/trace-debug-info.expect
tests/data/plugins/sink.text.details/succeed/default-compact-without-time.expect
tests/data/plugins/sink.text.details/succeed/default-compact.expect
tests/data/plugins/sink.text.details/succeed/default-without-data.expect
tests/data/plugins/sink.text.details/succeed/default-without-names.expect
tests/data/plugins/sink.text.details/succeed/default-without-time.expect
tests/data/plugins/sink.text.details/succeed/default-without-trace-name.expect
tests/data/plugins/sink.text.details/succeed/default-without-uuid.expect
tests/data/plugins/sink.text.details/succeed/default.expect
tests/data/plugins/src.ctf.fs/succeed/trace-2packets-barectf-event-before-packet.expect
tests/data/plugins/src.ctf.fs/succeed/trace-2packets.expect
tests/data/plugins/src.ctf.fs/succeed/trace-barectf-event-before-packet.expect
tests/data/plugins/src.ctf.fs/succeed/trace-session-rotation.expect
tests/plugins/src.ctf.fs/fail/test_fail
tests/plugins/src.ctf.fs/test_deterministic_ordering
tests/plugins/src.ctf.lttng-live/test_live
This page took 0.029322 seconds and 5 git commands to generate.