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)
commit9f2636716abf0d6cc188fed380ba77a621a370c1
treeff1fc5430de8119c22025259f1d58c0c330b40b2
parent7e547df6a875230134157556398e767574a3da69
tests: Replace babelstats.pl with bt2 plugins

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>
18 files changed:
CONTRIBUTING.md
README.adoc
configure.ac
tests/regression/tools/exclusion/test_exclusion
tests/regression/tools/filtering/test_valid_filter
tests/regression/tools/tracefile-limits/test_tracefile_count
tests/utils/Makefile.am
tests/utils/babelstats.pl [deleted file]
tests/utils/bt2_plugins/Makefile.am [new file with mode: 0644]
tests/utils/bt2_plugins/README.md [new file with mode: 0644]
tests/utils/bt2_plugins/event_name/Makefile.am [new file with mode: 0644]
tests/utils/bt2_plugins/event_name/event_name.cpp [new file with mode: 0644]
tests/utils/bt2_plugins/event_name/event_name.hpp [new file with mode: 0644]
tests/utils/bt2_plugins/field_stats/Makefile.am [new file with mode: 0644]
tests/utils/bt2_plugins/field_stats/field_stats.cpp [new file with mode: 0644]
tests/utils/bt2_plugins/field_stats/field_stats.hpp [new file with mode: 0644]
tests/utils/bt2_plugins/fmt.hpp [new file with mode: 0644]
tests/utils/bt2_plugins/lttngtest-plugin.cpp [new file with mode: 0644]
This page took 0.031828 seconds and 4 git commands to generate.