cli, plugins/ctf/fs-src: Make src.ctf.fs accept multiple root paths
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Apr 2019 16:03:29 +0000 (12:03 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
commitbf5b774868baca41556fde4897c740098a22c590
tree0e1643faa42ee6b55461a1ef2c5b552f6270a6f6
parent242407a922a6b4792c9117dee9a0c6a31590301f
cli, plugins/ctf/fs-src: Make src.ctf.fs accept multiple root paths

A following patch will make it possible to process multiple traces that
share the same UUID as a single trace.  One requirement is to be able to
do this event when passing multiple arguments, like:

    babeltrace path1 path2 ...

With the current code, this instantiates two src.ctf.fs components, and
therefore makes it impossible to do this merging by UUID.

This patch therefore changes the design so that we only instantiate a
single src.ctf.fs component and pass an array with the paths.

We also need to make the trace-info query support receiving multiple
paths.  One reason is that in general, we want trace-info queries to
support the same parameters as the components.  A more pragmatic reason
is that it will need to do the same kind of UUID-merging anyway.  I
therefore made the trace-info query re-use more of the code used by the
component to locate and create the ctf_fs_trace list.  One difference
between the two usages is that in the case of the query, we don't want
to create IR streams or component ports.  I moved those outside of the
shared code path and made the component do that as a separate step.

One notable change in babeltrace.c is in set_stream_intersections.
We previously extracted the "path" parameter from the component creation
parameter, to make the query parameters.  Instead, we now directly pass
the component creation parameters to the query.  The idea is the same as
above, we want to pass the same parameters to the trace-info query as
what will be used to create the component, since it might alter how the
traces will be open, and therefore the results.

So in practice the changes boil down to:

- babeltrace-cfg-cli-args.c: Make it possible to serialize bt_value of
  type BT_VALUE_TYPE_ARRAY, so we can build the list of paths in a
  bt_value array, then serialize it to send it to "babeltrace run".
  Make it instantiate a single ctf component, this even simplifies the
  code a little bit.
- fs.c: Accept "paths" parameter with a list of paths, rather than
  "path" with a single path, iterate on that list to find traces and
  create trace objects just as before.  Separate creation or IR streams
  and component ports from the ctf_fs_trace creation.
- query.c: Re-use more of fs.c's functions to locate and create
  ctf_fs_trace objects.

There are no functional changes intended, except if you are the kind of
person to pass params by hand to the src.ctf.fs component.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
cli/babeltrace-cfg-cli-args.c
cli/babeltrace.c
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/fs.h
plugins/ctf/fs-src/query.c
This page took 0.02685 seconds and 4 git commands to generate.