]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
test-qht: speed up + test qht_resize
authorEmilio G. Cota <cota@braap.org>
Fri, 17 Aug 2018 22:15:52 +0000 (18:15 -0400)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 26 Sep 2018 15:55:54 +0000 (08:55 -0700)
Perform first the tests that exercise code paths that are
easier to hit at small table sizes, and then resize the table
to speed up subsequent tests. If this resize is not too large,
we can make the test faster with no code coverage loss.

- With gcov enabled:

Before: 20.568s, 90.28% qht.c coverage
After:   5.168s, 93.06% qht.c coverage

The coverage increase is entirely due to calling qht_resize,
which we weren't calling before. Note that the code paths
that remain to be tested are either error handling or
can only occur when several threads are accessing the
hash table concurrently (e.g. seqlock retry, trylock fail).

- Without gcov:

Before: 1.987s
After:  0.528s

The speedup is almost the same as with gcov, although the
"before" run is a lot faster.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tests/test-qht.c

index 77666e8c5f4aa5d45112bdac7fce74a1544d026d..1ec039d63691d5058330d9d9b6b4845cfab803e9 100644 (file)
@@ -189,6 +189,10 @@ static void qht_do_test(unsigned int mode, size_t init_entries)
     rm_nonexist(7, 8);
     iter_rm_mod(1);
 
+    if (!(mode & QHT_MODE_AUTO_RESIZE)) {
+        qht_resize(&ht, init_entries * 4 + 4);
+    }
+
     check_n(0);
     rm_nonexist(0, 10);
     insert(0, N);