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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 5 Jun 2019 17:47:34 +0000 (13:47 -0400)
commita38d765099a8eb46b2b319381054db90a75029a9
treea277fca45c2aa8153aeb7f0b15579f6ff49531fb
parent55c68a1a729551ca7d697d6e771064a06a19c206
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.025556 seconds and 4 git commands to generate.