~roguescholar/babeltrace/+git/github:src-ctf-lttng-archive

Last commit made on 2024-07-19
Get this branch:
git clone -b src-ctf-lttng-archive https://git.launchpad.net/~roguescholar/babeltrace/+git/github

Branch merges

Branch information

Name:
src-ctf-lttng-archive
Repository:
lp:~roguescholar/babeltrace/+git/github

Recent commits

c9fdca0... by .eepp

Add `laurence.py`, a directory size monitoring daemon for LTTng archives

`laurence.py` is a program which accepts, in this command-line order:

1. An LTTng recording session name.
2. A maximum size (MS) in MiB.

`laurence.py` monitors the total size TS of the output directory of the
targeted LTTng recording session and:

If TS > MS:
    Pauses the data consumption (`lttng pause` command) for the targeted
    recording session.

Otherwise:
    Resumes the data consumption (`lttng resume` command) for the
    targeted recording session.

`laurence.py` runs the `lttng` CLI tool directly, therefore it must
be available.

Usage example:

    $ python3 laurence.py my-session 256

`laurence.py` also accepts a `--log-level` option to set its logging
level (see `--help` to learn more), for example:

    $ python3 laurence.py my-session 256 --log-level=error

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: I5e097446283cb25361f240f9c44d18d0fa82f4bd

5d357b9... by .eepp

Add `src.ctf.lttng-archive` component class

This patch adds a new component class, `src.ctf.lttng-archive`, of which
a message iterator consumes file system LTTng trace archives (the result
of an LTTng recording session rotation operation) for a given recording
session as LTTng produces them, optionally removing them when they're
not needed anymore.

This is a proof of concept, therefore it comes without documentation and
tests, and also assumes a few LTTng parameters:

• Each trace archive has a single CTF trace (in other words, only
  per-UID channels with a single user ID).

• Each trace archive has a single data stream file per channel/CPU pair.

• The number of data stream files of the earliest non-empty trace
  archive determines the expected number of data stream files in the
  following non-empty trace archives.

• The metadata streams of all the non-empty trace archives are the same
  (the component only parses the earliest).

  This means you must start at least one instance of any application to
  trace before the first recording session rotation operation.

The component accepts the following initialization parameters:

session-name=SESSION (mandatory):
    Read the trace archives of the LTTng recording session
    named SESSION.

remove-consumed-archive=false (optional):
    Don't remove completely consumed trace archives.

session-found-file-path=PATH (optional):
    When the targeted recording session (`session-name` parameter) is
    found, write an empty file to PATH.

    This is useful for short recording sessions, where the component
    could miss an lttng_list_sessions() call between the creation and
    destruction of a recording session.

The component also accepts all the `src.ctf.fs` initialization
parameters except `inputs`.

The component creates a single output port named `out`, sorting messages
internally just like `src.ctf.lttng-live` does. Therefore, you don't
need an `flt.utils.muxer` component downstream.

You must create a _single_ message iterator for a given
`src.ctf.lttng-archive` component.

The message iterator has the following stages (within its
"next" method):

1. Waits for the targeted recording session to exist, returning the "try
   again" status if it doesn't yet.

2. Waits for the first non-empty trace archive to exist, returning the
   "try again" status if it doesn't yet.

3. Consumes data stream files from existing trace archives, emitting
   corresponding messages.

   If it needs a new data stream file for a specific data stream, it
   reads it from the next trace archive. If there's no next trace
   archive, then it returns the "try again" status.

4. If it detects that the targeted recording session is destroyed, then
   it waits for the final trace archive to exist so as to consume it and
   eventually return the "end of iteration" status.

This new component uses liblttng-ctl to get some LTTng recording session
details (its output directory and whether or not it exists, for
example). Therefore, the project configuration script needs to find
liblttng-ctl through pkg-config.

With the INFO logging level enabled, you can see details whenever the
message iterator is waiting for something.

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: Iec076c4735d95be8f86ffc80ebc80776fcbe0a21

00dc939... by .eepp

tests/utils/python/mctf.py: convert JSON array → JSON text seq.

This patch updates `mctf.py` so that it converts a JSON array found in
the part named `metadata` to a JSON text sequence.

This makes it possible to write a CTF 2 metadata part without the odd
RS characters, for example:

    --- metadata
    [
      {
        "type": "preamble",
        "version": 2
      },
      {
        "type": "trace-class"
      },
      {
        "type": "data-stream-class"
      },
      {
        "name": "test",
        "payload-field-class": {
          "member-classes": [
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu1a"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu1b"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu2"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu3"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu4"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu5"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu6"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu7"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu8"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu9"
            },
            {
              "field-class": {
                "type": "variable-length-unsigned-integer"
              },
              "name": "vu10"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi1a"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi1b"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi1c"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi2"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi3"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi4"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi5"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi6"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi7"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi8"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi9"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi10a"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi10b"
            },
            {
              "field-class": {
                "type": "variable-length-signed-integer"
              },
              "name": "vi10c"
            }
          ],
          "type": "structure"
        },
        "type": "event-record-class"
      }
    ]

    --- my-stream
    [0 : uleb128] # `vu1a`
    [77 : uleb128] # `vu1b`
    [177 : uleb128] # `vu2`
    [43123 : uleb128] # `vu3`
    [21829382 : uleb128] # `vu4`
    [5121829382 : uleb128] # `vu5`
    [95121829382 : uleb128] # `vu6`
    [13895121829382 : uleb128] # `vu7`
    [913895121855555 : uleb128] # `vu8`
    [333333333333333333 : uleb128] # `vu9`
    [18446744073709551615 : uleb128] # `vu10`
    [0 : sleb128] # `vi1a`
    [-1 : sleb128] # `vi1b`
    [23 : sleb128] # `vi1c`
    [-156 : sleb128] # `vi2`
    [8556 : sleb128] # `vi3`
    [-100101001 : sleb128] # `vi4`
    [8288491823 : sleb128] # `vi5`
    [-171717171717 : sleb128] # `vi6`
    [123456787654321 : sleb128] # `vi7`
    [-1121231234123450 : sleb128] # `vi8`
    [99999999999999999 : sleb128] # `vi9`
    [9223372036853775807 : sleb128] # `vi10a`
    [9223372036854775807 : sleb128] # `vi10b`
    [-9223372036854775808 : sleb128] # `vi10c`

Detecting `[` as the first character of the part is enough because a
CTF 1.8 TSDL metadata text never starts with `[`.

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: Ic1d6fb1644870f3b951d26238f82c79d7f3cf25a

676b8c7... by .eepp

src.ctf.fs: always set the correct trace IR stream ID

In add_ds_file_to_ds_file_group(), we don't use the original CTF data
stream ID to set the trace IR stream ID whenever the beginning timestamp
is missing.

The comment says:

    if (begin_ns == -1) {
        /*
         * No beginning timestamp to sort the stream files
         * within a stream file group, so consider that this
         * file must be the only one within its group.
         */
        stream_instance_id.reset();
    }

This might be true, but there's no need to reset the data stream ID.

Then during data stream decoding, the trace IR stream ID always matches
the CTF IR data stream ID (if any), which enables some further checks.

Furthermore, a trace which goes from `src.ctf.fs` to `sink.ctf.fs` will
keep its original data stream IDs.

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: I3c6ea0a3cbd913017cd00c1c07c6c6bf83b8a534

d74fea3... by .eepp

tests/.../data_from_mp.py: add CTF 2 support

This patch changes `tests/data/plugins/src.ctf.fs/field/data_from_mp.py`
to add CTF 2 support.

The script generates a CTF 2 trace when the stripped field class text
starts with `{` (full field class) or `"` (field class alias), which are
exclusive to the CTF 2 metadata syntax (any CTF 1.8 field class starts
with some keyword).

The same automatic field class aliases as the CTF 1.8 case
are available.

_make_ctf_2_metadata() doesn't need the `@` replacement trick of
_make_ctf_1_metadata() because CTF 2 array field classes aren't
different from any CTF 2 field class, for example:

    {
      "type": "static-length-array",
      "length": 4,
      "element-field-class": "u8"
    }

vs.

    u8 @[4]

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: I6abe0776c64fde62633cfc7a89094c0aedf6b9be

583d2b9... by .eepp

src.ctf.*: make `ctf::src::ClkClsCfg` final

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: Iaf0b5564cafdca5d7ce4ca17b03639de90f69cbf

f233000... by .eepp

cpp-common/bt2c/libc-up.hpp: make `FileCloserDeleter` final

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: I50cb8185a1e929db9da8f7fc98967351e126b781

d35eb9d... by .eepp

bt2c/logging.hpp: replace `Logger::MemData` with `ConstBytes`

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: Iad923b8d42256fe02a9c3300045201776bfc0c4e

4499eae... by .eepp

cpp-common/bt2c/data-len.hpp: `static inline` → `inline`

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: I8f6a6d49d24ad312c2fdead6667bc41494f1321d

a5a98fd... by .eepp

cpp-common/bt2c/c-string-view.hpp: remove useless `bt2c::`

Signed-off-by: Philippe Proulx <email address hidden>
Change-Id: I7dd42aef2cc547f6e18d575f0366f899bc43b1df