qemu/tests
Emilio Cota e3feb2cc22 util: import GTree as QTree
The only reason to add this implementation is to control the memory allocator
used. Some users (e.g. TCG) cannot work reliably in multi-threaded
environments (e.g. forking in user-mode) with GTree's allocator, GSlice.
See https://gitlab.com/qemu-project/qemu/-/issues/285 for details.

Importing GTree is a temporary workaround until GTree migrates away
from GSlice.

This implementation is identical to that in glib v2.75.0, except that
we don't import recent additions to the API nor deprecated API calls,
none of which are used in QEMU.

I've imported tests from glib and added a benchmark just to
make sure that performance is similar. Note: it cannot be identical
because (1) we are not using GSlice, (2) we use different compilation flags
(e.g. -fPIC) and (3) we're linking statically.

$ cat /proc/cpuinfo| grep 'model name' | head -1
model name      : AMD Ryzen 7 PRO 5850U with Radeon Graphics
$ echo '0' | sudo tee /sys/devices/system/cpu/cpufreq/boost
$ tests/bench/qtree-bench

 Tree         Op      32            1024            4096          131072         1048576
------------------------------------------------------------------------------------------------
GTree     Lookup   83.23           43.08           25.31           19.40           16.22
QTree     Lookup  113.42 (1.36x)   53.83 (1.25x)   28.38 (1.12x)   17.64 (0.91x)   13.04 (0.80x)
GTree     Insert   44.23           29.37           25.83           19.49           17.03
QTree     Insert   46.87 (1.06x)   25.62 (0.87x)   24.29 (0.94x)   16.83 (0.86x)   12.97 (0.76x)
GTree     Remove   53.27           35.15           31.43           24.64           16.70
QTree     Remove   57.32 (1.08x)   41.76 (1.19x)   38.37 (1.22x)   29.30 (1.19x)   15.07 (0.90x)
GTree  RemoveAll  135.44          127.52          126.72          120.11           64.34
QTree  RemoveAll  127.15 (0.94x)  110.37 (0.87x)  107.97 (0.85x)   97.13 (0.81x)   55.10 (0.86x)
GTree   Traverse  277.71          276.09          272.78          246.72           98.47
QTree   Traverse  370.33 (1.33x)  411.97 (1.49x)  400.23 (1.47x)  262.82 (1.07x)   78.52 (0.80x)
------------------------------------------------------------------------------------------------

As a sanity check, the same benchmark when Glib's version
is >= $glib_dropped_gslice_version (i.e. QTree == GTree):

 Tree         Op      32            1024            4096          131072         1048576
------------------------------------------------------------------------------------------------
GTree     Lookup   82.72           43.09           24.18           19.73           16.09
QTree     Lookup   81.82 (0.99x)   43.10 (1.00x)   24.20 (1.00x)   19.76 (1.00x)   16.26 (1.01x)
GTree     Insert   45.07           29.62           26.34           19.90           17.18
QTree     Insert   45.72 (1.01x)   29.60 (1.00x)   26.38 (1.00x)   19.71 (0.99x)   17.20 (1.00x)
GTree     Remove   54.48           35.36           31.77           24.97           16.95
QTree     Remove   54.46 (1.00x)   35.32 (1.00x)   31.77 (1.00x)   24.91 (1.00x)   17.15 (1.01x)
GTree  RemoveAll  140.68          127.36          125.43          121.45           68.20
QTree  RemoveAll  140.65 (1.00x)  127.64 (1.00x)  125.01 (1.00x)  121.73 (1.00x)   67.06 (0.98x)
GTree   Traverse  278.68          276.05          266.75          251.65          104.93
QTree   Traverse  278.31 (1.00x)  275.78 (1.00x)  266.42 (1.00x)  247.89 (0.99x)  104.58 (1.00x)
------------------------------------------------------------------------------------------------

Signed-off-by: Emilio Cota <cota@braap.org>
Message-Id: <20230205163758.416992-2-cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-03-28 15:23:10 -07:00
..
avocado tests/avocado: don't use tags to define drive 2023-03-22 15:06:57 +00:00
bench util: import GTree as QTree 2023-03-28 15:23:10 -07:00
data bios-tables-test: use 128M numa nodes on aarch64 2023-03-20 09:59:25 +01:00
decode
docker tests/docker: all add DOCKER_BUILDKIT to RUNC environment 2023-03-22 15:06:57 +00:00
fp tests: make fp-test less chatty when running from test suite 2023-03-01 10:31:28 +00:00
guest-debug tests/guest-debug: better handle gdb crashes 2022-04-20 16:04:20 +01:00
image-fuzzer
include
keys
lcitool tests/docker: add zstdtools to the images 2023-03-01 12:45:16 +00:00
migration hw/misc/sga: Remove the deprecated "sga" device 2023-02-14 09:02:42 +01:00
multiboot
perf/block/qcow2
plugin
qapi-schema meson: replace Perl usage with Python 2023-02-02 10:44:23 +00:00
qemu-iotests iotests: register each I/O test separately with meson 2023-03-22 15:08:26 +00:00
qtest qtests: avoid printing comments before g_test_init() 2023-03-22 15:08:26 +00:00
rocker
tcg tests/tcg: add some help output for running individual tests 2023-03-22 15:06:57 +00:00
tsan
uefi-test-tools
unit util: import GTree as QTree 2023-03-28 15:23:10 -07:00
vm tests/vm: custom openbsd partitioning to increase /home space 2023-03-22 15:08:22 +00:00
vmstate-static-checker-data
dbus-vmstate-daemon.sh
Makefile.include configure: move tests/tcg/Makefile.prereqs to root build directory 2022-10-06 11:53:40 +01:00
meson.build meson: create have_vhost_* variables 2022-05-07 07:46:58 +02:00
requirements.txt tests: install "qemu" namespace package into venv 2022-06-06 09:26:54 +02:00
test-qht-par.c
vhost-user-bridge.c error handling: Use RETRY_ON_EINTR() macro where applicable 2023-01-09 13:50:47 +01:00