ctf plugin: add CTF metadata decoder API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 24 Mar 2017 01:39:22 +0000 (21:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:40 +0000 (12:57 -0400)
commit1e649dff604c8d842b652f9ead15267fce1f6a66
tree88b0ed7144e8c6c23d04be21209627575668b54f
parent0aeee125c8926d0bf5a04f05f19eb740bff4e56c
ctf plugin: add CTF metadata decoder API

The new plugins/ctf/common/metadata/decoder.h header exposes the CTF
metadata decoder API. This is a common API used by both the ctf.fs and
ctf.lttng-live component classes.

Once you create a CTF metadata decoder object with
ctf_metadata_decoder_create(), you can call
ctf_metadata_decoder_decode() as many times as needed to decode chunks
of metadata. Those chunks can be packetized or not, however the
resulting metadata text needs to be "complete", that is, zero or more
top-level TSDL blocks ("declarations"). If ctf_metadata_decoder_decode()
cannot decode because the metadata text is incomplete, the function
returns CTF_METADATA_DECODER_STATUS_INCOMPLETE. It is then the caller's
responsibility to keep the existing metadata and append more metadata
to it and then call ctf_metadata_decoder_decode() again with this,
until the function returns CTF_METADATA_DECODER_STATUS_OK or another
error.

At anytime you can get the CTF metadata decoder's associated CTF IR
trace object with ctf_metadata_decoder_get_trace(). The trace object is
initially empty: as you call ctf_metadata_decoder_decode(), the decoder
makes it grow by adding other CTF IR objects to it: stream classes,
event classes to new or existing stream classes, clock classes, etc.

The public ctf_metadata_decoder_is_packetized() and
ctf_metadata_decoder_packetized_file_stream_to_buf() functions exist
only for the `metadata-info` ctf.fs query for the moment.

Also in this patch:

* The identical btr/print.h and notif-iter/print.h is moved to
  metadata/print.h.
* A fix is added to the AST-to-CTF IR visitor to pop the current
  declaration scope at the end of visit_event_decl().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
15 files changed:
plugins/ctf/common/Makefile.am
plugins/ctf/common/btr/Makefile.am
plugins/ctf/common/btr/btr.c
plugins/ctf/common/btr/print.h [deleted file]
plugins/ctf/common/metadata/Makefile.am
plugins/ctf/common/metadata/ast.h
plugins/ctf/common/metadata/decoder.c [new file with mode: 0644]
plugins/ctf/common/metadata/decoder.h [new file with mode: 0644]
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/notif-iter/Makefile.am
plugins/ctf/common/notif-iter/notif-iter.c
plugins/ctf/common/notif-iter/print.h [deleted file]
plugins/ctf/common/print.h [new file with mode: 0644]
plugins/ctf/fs/fs.c
plugins/ctf/fs/metadata.c
This page took 0.02532 seconds and 4 git commands to generate.