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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:12:56 +0000 (00:12 -0400)
commitfbea9a539c88e075c1a11fd727f9c5a6ed536856
tree9b5a160f2329a5ef38218882cbd8d24204ec2ba5
parent327e0310d225dbadf0309fcce22b05e73d511fd3
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.025292 seconds and 5 git commands to generate.