src.ctf.fs: add stream port name to trace-info query, use it for stream intersection
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 28 May 2019 16:01:36 +0000 (12:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 13 Jun 2019 21:24:21 +0000 (17:24 -0400)
commitddf49b2756afc3d38fc8acf4f635277e3648d166
tree24d227eb3abd9cdeef3e95ea658d6a4204cb5f37
parentf873b2e6b14c2919d045b005189b8e1335b32447
src.ctf.fs: add stream port name to trace-info query, use it for stream intersection

For creating stream intersection trimmers, we currently rely on the fact
that the CLI and the Python bindings know that src.ctf.fs component port
names are the path to the data stream files (or the first data stream
file for the corresponding stream, if there are multiple files).  Using
this information, they can deduce which trace (from the trace-info
query) this port is from, by checking for a trace whose path is a prefix
of the port name.

This patch changes how this works to avoid the CLI and Python bindings
having internal knowledge of how the src.ctf.fs component class names
the ports.  The trace-info query now include a "port-name" property for
each stream.  This property contains the name that a src.ctf.fs
component would give the port associated to this stream.  This allows
the CLI and the Python bindings to match a port with a trace (and
therefore an intersection range) just by comparing the port name in the
actual component instance with the port name in the trace-info query
result.

Here's an excerpt (just two streams) from a trace-info result with this patch
applied:

    -
      range-ns:
        begin: 1556911621056878212
        end: 1556911631077588247
      class-id: 0
      paths:
        - /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-20190503-152658/archives/20190503T152700-0400-20190503T152703-0400-1/ust/pid/hello-ust-2335-20190503-152701/chan_2
        - /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-20190503-152658/20190503T152705-0400-3/ust/pid/hello-ust-2335-20190503-152701/chan_2
      port-name: 1838b922-0089-497c-96e7-2c7ad63e901e | 0 | 2
      id: 2
    -
      range-ns:
        begin: 1556911621053751789
        end: 1556911631077569864
      class-id: 0
      paths:
        - /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-20190503-152658/archives/20190503T152700-0400-20190503T152703-0400-1/ust/pid/hello-ust-2335-20190503-152701/chan_1
        - /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-20190503-152658/20190503T152705-0400-3/ust/pid/hello-ust-2335-20190503-152701/chan_1
      port-name: 1838b922-0089-497c-96e7-2c7ad63e901e | 0 | 1
      id: 1

I added some simple tests, although they don't cover all the cases.  We
currently don't have a trace without uuid, or a trace with
stream_instance_id fields, to test the remaining possibilities.  I plan
on adding some soon, when adding tests for the trace merging feature, at
which point we can also enhance
test_query_trace_info.QueryTraceInfoPortNameTestCase.

Change-Id: Ib3afc19f2c0e09a7235475b53f8023c8a2f40ebf
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1339
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
bindings/python/bt2/bt2/trace_collection_message_iterator.py
cli/babeltrace.c
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/fs.h
plugins/ctf/fs-src/query.c
tests/plugins/ctf/test_query_trace_info.py
This page took 0.028628 seconds and 4 git commands to generate.