tests: Replace babelstats.pl with bt2 plugins
authorKienan Stewart <kstewart@efficios.com>
Thu, 28 Sep 2023 20:54:42 +0000 (16:54 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 8 Mar 2024 16:55:24 +0000 (11:55 -0500)
Observed Issue
==============

`tests/regression/tools/filtering/test_valid_filters` is a long running
test, especially when running as root and exercising the tests across
the kernel domain.

I observed that a sizable amount of time was being spent in the analysis
of the results using `babelstats.pl`.

Solution
========

Instead of using a script to parse the pretty output of babeltrace2, I
decided to write two C++ plugins to replicate the behaviour of the
`babelstats.pl` script.

I measured the time using `sudo -E time ./path/to/test`

| Test                 | Time with `babelstats.pl` | Time with bt2 plugins |
| test_tracefile_count | 13.04s                    | 11.73s                |
| test_exclusion       | 22.75s                    | 22.07s                |
| test_valid_filter    | 301.04s                   | 144.41s               |

The switch to using babeltrace2 plugins reduces the runtime of the
`test_valid_filter` test (when running with kernel tests) by half. The
runtime changes to the other tests that were modified are not
significant.

Known drawbacks
===============

The field_stats plugin behaviour differs from `babelstats.pl` with
regards to enumeration fields ("container" in `babelstats.pl`). However,
no tests depend on that behaviour to pass.

The field_stats sink plugin doesn't perform a lot of run-time
error-checking of functions it invokes, and doesn't fully clean up all
the references it allocates though the babeltrace2 API. As the intended
usage is for short lived invocations with relatively small traces, the
principal drawback of this approach is that errors in the plugin may be
harder to debug.

Building tests of lttng-tools will now depend on having the babeltrace2
development headers and libraries available.

Change-Id: Ie8ebdd255b6901a7d0d7c4cd584a02096cccd4fb
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>

No differences found
This page took 0.025599 seconds and 4 git commands to generate.