]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
test_maple_tree: Add bench_walk()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 25 Nov 2020 18:51:56 +0000 (13:51 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:28 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/test_maple_tree.c

index 36a3cf7b3acfd96537850aebd123f170cc1eb64b..0e8e995ac04809017aa28ccbfd621618055e92fb 100644 (file)
@@ -12,6 +12,7 @@
 #define CONFIG_DEBUG_MAPLE_TREE
 //#define BENCH_SLOT_STORE
 //#define BENCH_NODE_STORE
+#define BENCH_WALK
 //#define BENCH_FORK
 static
 int mtree_insert_index(struct maple_tree *mt, unsigned long index, gfp_t gfp)
@@ -35317,6 +35318,23 @@ static noinline void bench_node_store(struct maple_tree *mt)
 }
 #endif
 
+#if defined(BENCH_WALK)
+static noinline void bench_walk(struct maple_tree *mt)
+{
+       int i, max = 2500, count = 100000000;
+       MA_STATE(mas, mt, 22, 22);
+
+       for (i = 0; i < max; i += 10)
+               mtree_store_range(mt, i, i + 5, xa_mk_value(i), GFP_KERNEL);
+
+       for (i = 0; i < count; i++) {
+               mas_walk(&mas);
+               mas_reset(&mas);
+       }
+
+}
+#endif
+
 static noinline void check_forking(struct maple_tree *mt)
 {
 
@@ -35415,6 +35433,13 @@ static int maple_tree_seed(void)
        mtree_destroy(&tree);
        goto skip;
 #endif
+#if defined(BENCH_WALK)
+#define BENCH
+       mtree_init(&tree, MAPLE_ALLOC_RANGE);
+       bench_walk(&tree);
+       mtree_destroy(&tree);
+       goto skip;
+#endif
 #if defined(BENCH_FORK)
 #define BENCH
        mtree_init(&tree, MAPLE_ALLOC_RANGE);